I temporarily stopped working on the game in January to work on some computer science research stuff. I wanted to improve my backup plan in case Archapolis isn't successful, but ultimately the CS research was quickly becoming a time intensive endeavor. I wanted to make games after all. I should mention, I have no experience doing CS research so that I probably frustrated the few professionals I reached out to.
In February I returned to Archapolis and started working on implementing the path finding algorithm I developed, but for multi-lane roads. This exploded the complexity of the problem space. Firstly, I needed to implement a hierarchical path finding system to group lanes into edges. Then I needed to write up all the logic to switch lanes--separate from the path finding algorithm. Doing this was necessary to prevent an exponential increase in possible paths. If each lane was treated at its own edge, and the agent could switch lanes at any node, repeated for every multi-lane edge... whoops we ran out of memory.
Secondly, I needed to code in all the possible lane connections for multi-lane intersections, and use those connections in the path finding code (separate from the path storage tree that is created). Initially I could not figure out how to automate this, so I hard coded every single intersection combinations (ouch!). For example, a two lane road entering a 4-way intersection needs to split those two lanes between all the available input lanes from the other roads. Maybe the right most lane needs to go straight AND turn right, and maybe the left lane can only turn left. This is just one example from dozens (when using 1 or 2 lane roads), since the logic cannot be repeated for each direction of entrance. You can see why I decided not to build in eight degrees of travel (e.g. NW, NE, SW, and SE roads)--at least for now. Recently I figured out an algorithm that will auto-create the proper intersection connections, but that has yet to be implemented.
The reason why the intersection lane connections are separate from the path storage tree created is because the graph is only concerned about edge-node connections (since I am bundling lanes into a single edge). When the unit is path finding and reaches a node, it will look two nodes ahead to see what lane it needs to be in to reach the next next (yes, two) node. If the unit only looked at the available node connections at the next node, it could end up in the wrong lane and cause all sorts of traffic jams trying to switch lanes at the last minute.
I also worked on fleshing out the zone, building, and room code. I added pixel boarders to each zone, building, and room; refactored a bunch of the game engine code, added the bottom bar menus, implemented "lazy click" so that you can scroll on a bottom bar option and left click anywhere to activate it, or right click to pop the bottom bar state. I also added room wall output, driveway output, experimented with strongly typed ints for zone/building IDs, (similar to enum class, but different. This ended up being a failure). I also added contextual object/tile highlighting.
Published Date: 06/25/2022
Total Development Time: 3 months