Despot Dungeons Update 1: Setting up the basis
Originally posted on 08/08/2017 on: http://www.realfast.dk/2017/08/08/1gam-august-update-1-code-porn/
It all started while I was cleaning my hard drive. I found some old rogue-like(turn-based on a grid) game prototypes. They we’re quite abysmal and bug-filled, which immediately activated my hyperactive analytical mind. I remembered how the game had been pieced together and realized how dumb I had been. There had been no central system to handle turns and everything sorta just happened at run time randomly. This caused a lot of weird things to happen and I couldn’t help but start designing new systems in my mind.
Soon I found myself fumbling around in Unity setting up a turn-handler. A month or two ago I made a decent grid-system, which I promptly implemented into the project. Within a relatively small amount of time I had created a nice framework to build a rogue-like on.
The system was simple yet effective. An abstract class called MovementObject made sure that I’d be able to talk to a bunch of different kinds of moving objects without any hassle. I then setup a list, that’d be filled with all moving objects in the scene and also a list of tags, which could be moved around as desired. This list of tags would represent the order in which the objects got to execute their turn. This would make adding more kinds of objects easy. Just add their tag to the list and make sure they derive from MovementObject and you’re all set. I was aiming wide.
The turn execution itself was actually much simpler, than I had foreseen. Using coroutines made it easy to make sure that one object was done moving before starting to move another one. Simply check if the current object is performing a turn and when it isn’t move on to the next one.
Moving a single player around didn’t really challenge this setup, so I decided it was time for some enemies. First I just made some basic enemies who could only walk upwards. These were primitive and useless but proved that my system worked.
So with confidence in my system, I could start doing the fun stuff. I decided it had been a while since I last made an A*-algorithm. The A*-algorithm is a pathfinding algorithm, that looks at a bunch of nodes and figures out the fastest route to a given target. A bunch of nodes sounds a lot like a grid-system, so the algorithm was already perfect for me, but there’s a dark underbelly to using A*; PERFORMANCE. Thankfully my game is turn-based, which means I only have to run the algorithm once per enemy per turn. This means that the algorithm will run once every few seconds as opposed to every single frame. Also I got some help from some amazing YouTube tutorials(link), which helped me make the algorithm extremely efficient. With all my pathfinding worries gone, I had only to put the tag into my list and things started moving.
I also decided not to let enemies move diagonally, but left in the function, just in case.
Anyway, I had run out of things to code and was forced to go to the whiteboard. Design time! Honestly I wasn’t really sure what kinda game I wanted to make, but I knew it had to do with enemies, so I’d probably need some way of attacking them, and of course, a way for them to attack me. The way to do that was quite simple. Simply look at the tile, you’re about to move to. Does that tile contain an enemy? If yes, attack.
With the basic attacks down I started thinking of different attack-patterns. Maybe one weapon could attack on every tile around you, maybe one could take out an entire row / column. This would all be fairly easy to implement because of my grid-system, but just as I was about to start implementing things, my girlfriend came over to visit. With such a creature right beside me at all times, how could I ever focus on work? I didn’t work at all for the entire time, she was over, and she’ll be visiting me again in August. Don’t get me wrong I love having her over, but I don’t know how I’ll ever finish this game in time!
Which, I suppose is quite a nice segue to the next part. Planning. I’m slowly realizing that a forth of my time is already up and I don’t even know what game I’m making. So whats up for next week? I’m gonna do some game design and figure out what I’m doing. I’m gonna make some actual art, since Nintendo might get angry if I keep using Zelda-sprites and I’m gonna plan out the rest of the month. This means every feature that needs to be implemented, how much time it’ll take and when I’m gonna do it. Cant wait to see how that goes. See you next week!
-Hjalte Tagmose (@hjaltetagmose)
Indie developer and stuff.
Get Despot Dungeons
Leave a comment
Log in with itch.io to leave a comment.