I have decided to share my story with TUG modding, it’s a great experience and I still don’t get why so few people are modding mod.
As always the beginning is the hardest, I have started looking around for mods, there where very few and most of them where outdated, but it gave me a good hint on how things work. At this stage I knew the folders where scanned for files and that there wasn’t a single file in which all object had to be defined in (good news for anyone who want to mod the game), back then mods where based on core changes and not on separate mod folders.
The next step was to analyze the API from my previous work I knew LUA had a global table (_G) in which all of the functions and variables where stored, so I tried to export it, after few tries I found that there was an Inspect class/function bundled with TUG and it work well. So I had a file similar to this one. I scanned this file whenever I wanted to find a function.
The first attempt was working, but barely, the objects where floating in the air instead of moving, the lag was real and it wasn’t persistent. But it worked so I decided to make a video about. I though who knows maybe people will like it. Guess what… everyone loved it, in 2 days the video was more popular than all of the previous videos put together(from MC modding and custom game engine). At this stage I had really no choice but to continue it, well first I had to fix it…
I started looking for a way to move objects using the physics, so I searched using related names, physics/move/motion, the last one gave me NKSetMotionType which was in the same class/category as NKSetAngularVelocity/ NKApplyForceInDirection.
The way I have scanned the file was using Notepad++. It’s really fast (especially if you have ssd, even cheap small one improves development time).
The next thing was looking for references in the code. The way I did it was again using Notepad++, the setup is easy (make sure you filter the file names, otherwise it will make long time to scan all of the files).
I found out that Lootable.lua had all of the info that I needed, I knew physics had to be active, that I could use NKSetLinearVelocity or/and NKSetAngularVelocity and more less how to use them.
After that I found that TUG has released Eternus Lua API. Which was a great help later on (the only problem with it now is that it’s only for stable releases, but it is still a good place to get an idea on how things work).
At this stage I had a Conveyor Belt, that worked really well, maybe not as realistic but definitely lag free.
The Community and Developers
While I was in the middle of fixing the Conveyor Belt, I was asked to join the IRC room and chat with the devs. At first I was like “ok… it’s not like I did anything huge” and I wasn’t sure what to expect, or what we could/would chat about. To my surprise we chatted for over 2 hours about my plans and their plans. After a while we exchanged IM nicks so that we could contact each other. The very next day I was asked “You any good at 3d modeling?”, well I’m not great (I know the formats, how to use the software and how to make basic models), which explained why I used the bed as my Conveyor Belt model. The following day I was contacted by Sigil (well the devs got the 2 of us to contact each other), he is really good graphics designer and we are working together now, Sigil does the Models and Textures and I do the code and fix things.
The Community is really friendly, they like to see new content, new ideas and welcome new people. The developers are no different, while they don’t have as much time, they help out when ever they can and they talk with the community, share ideas, listen to feedback(within reason obviously).
I’m also helping out when I can, you can find me often on the forum giving solutions and codes, on IRC (usually checking it every few hours). I’m also in progress of creating TUGModding.com, a website for modders to gather info, there are few things on it already but I have more planned after the multiplayer update. I have 2 more projects CommonLib(library for TUG with the common modding stuff, hooks, GUI, etc…) and TUG IDE. The TUG IDE will feature LUA editor, model viewer, TUGON editor (TUG’s txt format) and much much more.
The Conveyor Belt was just the beginning. After this I wanted a way to smelt ores and sort objects. While it wasn’t as easy as making the Conveyor Belt, it was fun. The previous methods worked well and I was able to make the T-Sorter and Automatic France quick enough.
Then it was time to try something harder, connecting things in a simple and understandable way, I came up with a Connector System, which allowed me to specify point and angles at which object would come together. I sounds simple, it should be simple, but quaternions are just painful to understand and it would take at least 1000 restart to get them to work. I needed a better way to inject code, so I have made a Dynamic Function Reloader (Warning this will kill your HDD, you must have an SSD and I still wouldn’t recommend running it for longer that few minutes). After that it was easy, I just needed to tweak the code until it worked, took 3 day (I can’t even imagine how long it would take without the Dynamic Function Reloader)
Well now we had a way to connect object, so it was time to make object that could use that to communicate with each other. We had this idea to create an Elevator for items, it was made of 3 parts, Elevator Base, Elevator Middle (optional) and Elevator Top. Well getting the parts to communicate was simple, but getting them to reconnect after a reload was a bit more difficult.
Once we had the Elevator “done”, is was time to animate Elevator Shield. Should be simple I said, well there where problem with it as well. The main problem was the save system, which I had to by-pass completely as it was unreliable for moving attachments. Moving attachment on their own where problematic, but I got it. It wasn’t something you would have expected, it required 2 calls to change the position is the right order, one to set the rendering object and the other one to set the physics collision mesh. Well I can’t say how I got it to work the first time, it was after 10 hours of testing around 7 am in the morning, but I slept like a baby that “night”.
Making the mod playable
Then we decided to work on getting the mod ready for Survival, the planned date was/is just before/a bit after the multiplayer. During that time I also worked on getting the basic IDE going.
After that it just went on, the to-do list is growing so fast it might as well be called endless. More and more people are waiting to see what content and API/Utilities we can come up with. My YouTube channel suddenly started to be viewed. The community is responding on Twitter and the forum, giving ideas and feedback. I’m helping other modders to get things working.
We have already made the crafting systems, casting and in-world crafting. We are currently working on the world gen, rubber gathering and getting the rest of the things configured (most of the system are already in place).
The only thing that is needed now is more people, to mod the game and to play/test the mods (soon our mod, once it will be playable in Survival).