Here’s post 3 of my Ventura Combat System progress.
Some quick context for new readers as to what the combat system is trying to achieve…
- 1v1 combat with teams of 5 Mercenaries
- Simultaneous Turns, with a Planning phase (making moves) and a Resolution phase (witnessing the outcomes)
- Two Maneuvers per Turn
- In your Maneuver you can Move, Attack, or Idle
- There are no targeted attacks, you select a direction and your character’s attack ‘template’ will affect tiles and enemies below it
- There are plenty of more details, but not for version 1!
Combat Week – Day 3
Integrating the Combat Grid and placing Units on it was the progress made on Day 2, now it’s time to get the Units moving on the Grid correctly.
Pathfinding is pretty advanced logic. I remember reading a ‘layman’s guide to A* pathfinding a while back and struggling to keep up. Essentially it revolved around creating an Open List of available tiles and then scanning through every single one to determine which tile is connected to which and whether the unit moving can access it (OpenList) or not (ClosedList).
Everything I just said is perhaps confusing you or completely wrong, but hey that’s the effect that the dreaded word pathfinding has on me!
Pathfinding is an example of ‘Real Code’. Since I started Game Maker, I’ve been making games using ‘Not Real Code’. Of course, this is completely wrong; all code is real code, but my indie games have been using simple Game Maker functions and terribly inefficient & crude scripts to generate whatever I want to make.
Game Maker has some great built-in functionality that helped me build my grid, and it also has some satisfactory pathfinding solutions for blocking off tiles and finding the way around them to a target location. In fact, it was these functions that completely busted my balls for about 4 hours!
Here’s a developer lesson for you: Always test stuff with debugging functions activated.
I couldn’t figure out why my first Unit could draw a path around the grid with no problems, but the other units could only draw a path on their 2nd maneuver. It was a complete mind-boggler. I tried everything to try and figure it out. Hours and hours of tweaks and prods, setting up countless variable debuggers to try and find out why it wasn’t working despite all the logic being sound.
Eventually it turned out that the other units were placing themselves on the grid as inaccessible tiles and therefore a path could not be calculated from them. I only found this out after I switched on the Grid overlay (that I had turned off because it was ugly), which displayed red over tiles that were forbidden and green over tiles that were accessible.
What a pain!
After that was fixed, everything else pathfinding was plain sailing for basic functionality. One issue I did have is that the pathfinding solution I’d used in the past (mentioned here) was apparently broken. Game Maker’s built-in functionality does not have any feature to deal with terrain costs. Units in my system have a set number of movement points and I have to use my own solution to determine how far a unit can move in a single maneuver.
Once again I spent an hour or so trying to debug it. I opened up all my old game projects to find a version that worked. 5 projects, 0 working. It’s still not working.
At this point I think I should be building my own solution, from scratch, that I understand completely. But as I want to get the game playable as quickly as possible, 3rd party solutions are still my primary plan.
Next time on Ventura Combat Week, we’ll be looking at Maneuvers… both how they were built and a little bit of design analysis on them.