tModLoader Infinite world - A proof of concept that prove nothing is impossible (W.I.P)

Dradonhunter11

Official Terrarian
Hello everyone,

I am here to present you a mod I have been working on for over 2 year and I plan to post my progress on it on this post.
The mod in question is something that was thought near impossible for a while, but now it is possible. Have you ever dreamed of exploring endless world? Well wait no more, it is now possible (theoratically). How was it achieved? How is it possible? I'll explain in this thread from the very beggining of my part (because another user named @Rartrin, which is a friend of mine).

==========================================================
The start
==========================================================​
Originally, when I started to do this, I wanted to prove that making an infinite world mod was not entirely out of reach. There was many problem so instead of going straight to infinite world, I decided to go for dimension. From that, dimlibs was born and allowed to create the very first dimension. With dimlibs, I had the intention of creating a dimension for each lunar dimension and make it so you generate a new world everytime you reach the border of the world, allowing to effectively have the effect of "infinite".

SuLKGoW.png

For a while, people kept mocking me saying that to do properly, you would need to replace the massive Main.Tile array in the source, which was impossible at that time as we didn't had mono mod (Take note of this detail, it's important). This was working well, it had some issue like world corruption problem and some spawn issue but it was working well. After trying to solve some of the issue, I found out about Method swapping (ancestor of Mono mod detour) and made dimlibs 2.0, a version of dimlibs that swapped massive method so I could implement some stuff in dimlibs. Sadly, dimlibs had an issue (Both 1.0 which is on browser and 2.0 which is not) : Multiplayer. So after seeing my plan wouldn't work as I want for MP. I decided to start standalone modding and talked to rartrin about how he did infinite world. From the discussion we did originally and some help from rartrin and another friend (I'm not gonna mention their name publicly). We implemented a chunk system and world class with an indexer and changed Main.tile[,] with Main.World and had an indexer which allowed use to simply swap the type without rewritting the entire source. Fun detail, this version of Infinite world was released by accident as a 64bit version, which I believe is now lost forever. Anyway, after some work, we came with this :

1619808864795.png

So funnily enough, in this version I had mod support, most mod were working in fact because of something I developped while working on infinite world. This thing is what I call the mass patcher (or the abomination that I wrote in 100 line). To make it short, I used the mass patcher to iterate all the instruction of a mod and replace every use of Main.Tile[,] with Main.World indexer, which worked surprisingly well at the time! After I wrote this patch, I told myself the following: If I can patch the mods, does that mean I can patch the game itself? Turn out the answer was yes! But at that time it was horribly inneficient and laggy (Taking up to 20 min per patching attempt). So after that point, I worked on the thing on and off for 2-3 year. And after a lot of work, research and time I finally pulled it, a patcher that was able to patch all the source at once (with about 2-3 min of patching on my current PC, about 5 min on the old one). The beauty of it is the fact that unlike the first version, this one is not a standalone but rather a mod made in tML which require 64bit to function. Of course, I'm not gonna release it anytime soon, but I believe that this is a good first step for what I can do in the future. Anyway, here is progress on the current mod version of the mod, world gen included!

1619811182681.png


It surely is not as polished as the other version shown, but compared to the standalone version where it was a direct source modification, this one is purely done in IL and detour, which mean it's a bit more complicated to do stuff.


============================
Update 02-05-2021
============================​
Github link is available! Dradonhunter11/InfWorld


============================
Update 03-05-2021
============================​
Mining and placing block outside of the world is now possible!

uz6mHMizVF.gif

DeAtgL2jOJ.gif


1620015758724.png

Anyway, Thanks to have come to my TED talk.
- Dradonhunter11, dev of tML 64bit (1.3)
 
Last edited:
Fun fact, while trying to remove some check, 2 of them which look the exact same are actually different IL wise. Talked about it around and it seem like it's a bug with the compiler (roslyn)! This will be fun I guess. Picture coming soon of said bug in question.
 
So here is the first stuck point on this project, I'm gonna need some people help to fix but anyway. Essentially, while patching take 2-3 min on the actual exe, it can take up 10-15 min between each mods. Not sure how I can do this in a efficient way right now, if you have suggestion tell me! Or if you want to PR it go for it. Rn, I tested Thorium, it work but like I said, it take forever to patch.
 
Thanks to @Rartrin , mod loading went from 9 min per content mod to under a minute per content mod! Massive optimization if you ask me (Also, tell him happy birthday :D) Here is latest spirit with thorium
1620192841895.png
 
Update on thing : I've been busy with exam, but I have been working on something, mainly chunk revamp
here is a fun bug :
View attachment 322762
Update on this, so I never tried to block in this world till today. Turn out that not only this is the same chunk repeating over and over, but it's literally the same instance in fact. This mean that if you break a block 1 chunk, it break in all of them.
 
Back
Top Bottom