I was browsing reddit (r/gamedev I believe, it's a bit fuzzy now) when I came across a post that got me thinking. I can't remember the details, but I think it was a question along the lines of how to get better at coding. I don't remember much of the top comment but the first thing it said was to "learn how to program". Seems kinda unhelpful, but they meant to learn as in to understand, and it got me thinking about how I actually learned.
I got my start with a massive book, C Primer Plus if I remember correctly, and I remember reading it quite a lot, even late at night some times. But I didn't finish it. It was a huge book, and I was in middle school. So while I understood some of it, it was also quite abstract at the time. I made all the basic programs you make like Hello World, a program that asks what your birthday is and spits it back at you, and a calculator, etc. You know the drill. After a while I set programming down for a bit. There was a lot to take in, and IDEs weren't nearly as well developed back then as they are now. I used CodeWarrior (red comments ftw) but nothing I had told me how to use CodeWarrior. Not that I remember anyways. It's entirely possible I had a book on CodeWarrior but ignored it "because it wasn't about programming". Seems like something I'd do.
Fast forward some years later where I buy Tribes 2. It seemed like a fun game where you get to fly around and shoot people. And it was! But that's not what made it great. Not for me. What made it great was all the time I spent modding it. I never really released anything, but I spend hours upon days upon weeks coming up with ideas and bringing them to life. But I didn't hit the ground running. I spent a while at the beginning only modifying data. Sure, I made new weapons with new effects and what not, but I didn't really change anything. Not code.
That is until some time after the update that add Classic Mode and Team Rabbit 2. The noteable thing about TR2 was that it added scaled up player models that could now be used in server side mods (mods with nothing but scripts to download). The mod Meltdown 2 (probably my favorite mod to play besides Construction) added a pack to the game that transformed you into a mech by swapping your player model to the huge TR2 heavy armor model and gave you weapons exclusive to that pack. I decided I wanted that, so I set out to cobble something together of my own.
It wasn't easy at first. This was my first real dive into the scripts that actually told the game what to do. Fortunately, everything I needed this pack to do existed in different parts of the game. The inventory stations gave you weapons and changed your armor model, and the shield and cload packs were active and required a key press to be used. The repair pack was even closer to what I wanted, in that it gave you a weapon when you activated that you otherwise can't get (the repair gun).
So I looked at the code in these other parts of the game, and glued them all together for my pack. It wasn't pretty. It was ugly. I don't have the code anymore, but if I did I'm sure it's something I could post to r/programminghorror. But it worked, and it gave me what I like to call my "Matrix moment". It's where the game, and programming in general, opened up to me. I felt like Neo when he could see the Matrix at the end of the movie. Of course, I wasn't The One, and we all know there's always something new to learn, but what changed is that the code in the Tribes 2 scripts was no longer intimidating. I was a fish in water. I could bend the game to my will. Mostly. There were limitations to the scripting engine.
For no real reason than to share, I've recreated what I think is one of the things I made for Tribes 2 that I think showed what I could do with the game. It was one of the last things I made, and it wasn't even for players. I made it for modders to make it easier to add weapons to the game. I've recreated it somewhat faithfully to how I did then. If I did it as I would now, I would at least keep it from modifying the player data in code, since that kinda tramples on the organization of data.
If you're curious, you can see the code here, though I'm not sure how many active Tribes 2 modders there are now days. I just want to share some of my code when I can because I think being able to see code from others is what really got me to learn. This isn't much, but it's a start. I'd love to share the code for my main project right now, but I'm using some assets from the Unity Asset Store that I wouldn't be able to share. Maybe some day I can make a smaller version of it with just my code to share, but I also have another game on the back burner that I plan to make 100% 3rd party asset free to be sure it's something I can share the source to.
Top comments (0)