Gerrudo / reticulating-splines

An isometric city building game.
0 stars 0 forks source link

Allow roads to link up different building types #35

Open Gerrudo opened 2 months ago

Gerrudo commented 2 months ago

Roads should be able to link up different buildings, we can use this as a basis for pathfinding and making buildings into a connected state.

We can build a state system on top of this to decide functionally of buildings and even replicate this system onto possibly water pipes and power lines or even different transport like rail or walkable paths.

The system should be generic enough that we can apply different sprites/code to it for different purposes.

Gerrudo commented 1 month ago

https://github.com/Gerrudo/reticulating-splines/commit/ccd74f48cf8bb27f4bafab5804a300cec7cdbfec Added a check for connected roads, currently getting IndexOutOfRangeException when going through the neighbouring tiles, need to limit it properly or foreach through the neighbours first.

Anything that works to stop it from trying to check an index out of range for neighbours, should be easy as there's only 4.

Gerrudo commented 1 month ago

https://github.com/Gerrudo/reticulating-splines/commit/8d68692d154af3b522d42c1e9135f0a8d3e796d0 Buildings now spawn when any side is connected to road, this is controlled by isConnectedToRoad, tile is changed and calculations are done only when this is set to true for a given tile.

Image

Gerrudo commented 1 month ago

Next steps for this is to implement A* pathfinding for different building types, but I may pivot to another item for a while and come back to this one.

Gerrudo commented 3 weeks ago

Loosely tied to #45