The year is 2014, Java applets are still all over the internet, and I'm super into game development. But was I really? In hindsight, I was more into game engine development judging by what I spent the vast majority of my time on. At the time, I think I was also quite into StarCraft II, as well as the intro screen from Yoshi's Island on DS. I think Notch (the creator of Minecraft) was tinkering with something similar at the time and I think the name "Mini Conquest" was inspired by his Minicraft. You'll see why this is all relevant later.
Because I liked writing things from scratch, I didn't use any libraries. This had the pleasant side-effect that somehow I was able to compile and run this project on my first try, even after all these years, which I can rarely do.
All source code is on GitHub. It's possible that I wrote this before 2014 and only put it on GitHub in 2014, given that I committed all the code at once, but let's just assume it was 2014 since it would be too complicated to figure out when exactly I wrote this. I used
make, so could compile with that, and ran the project with the command
java -cp bin core.MiniConquest. Of course applets aren't a thing anymore, but I had the foresight to have it run standalone too for development. Behold!
As the name "conquest" might hint to, I wanted to create a Real-Time Strategy (RTS) game. I remember watching some videos on how to make selections of units flow together as you move them around and wanted to work my way up to there. I started off with what I knew and made the "hero" use A* pathfinding. I added some panning and a little mini-map and didn't bother drawing any nice sprites. Even the Link sprites I nicked didn't have diagonal sprites so I just drew an arrow. I'm pretty sure the map loading system eventually evolved into this though.
Of course I decided to write my own physics engine. It was relatively simple AABB stuff but sometimes I look back and my old code and I'm a bit surprised that I wrote it. It's all so structured and clean, and it makes me wonder if I might not be as sharp as I once was? But at the same time, I didn't know about ECSs, overdid it a bit with the OOP, and created a lot of cognitive load with the synchronisation juggling between threads.
I can't believe I wrote my own vector, geometry, and even fast-maths functions. I even wrote my own fast sin/cos functions (cached values in an array), but remember, this isn't premature optimisation, this is learning and having fun on the journey! Holding shift let you place multiple units.
There was a notion of static units and dynamic ones. I always likes the way that zerglings move our of the way in SC2 when your marines walk through them, so I made it so that these barrels can be pushed around too.
Now comes the fun part and the main thing that I wanted to do with all that custom rendering code. With a bunch of affine transforms centred around the middle of the screen (no perspective transforms), we can get a pretty cool effect. The sprites stay flat on top of their position, but the tiles and mini-map are scaled, skewed, rotated, translated. The only sprite with special logic is the hero, that changes the direction he's facing as you rotate the world. This lets you go from flat top-down to a pseudo-isometric view for those cinematic battles!
The idea was that this is a two-player RTS where you play against an opponent. It looks like I already did the plumbing for some basic networking (one player acts as a host, the other a client) but didn't really do much more with that except have them send coordinates back and forth.
I doubt I will ever do anything more with this project. It was fun at the time and a learning experience. I might one day revisit this 2.5D concept and RTS mechanics in general, but certainly not over this codebase. Feel free to tinker with this!