#12 - paths and loose ends


Take the long scenic road

I haven't posted in a few days cos I took a detour to do some engine tasks. I also spent time thinking over the balance mentioned in the last post.


I went over the list of 'next...' things I wrote in the last posts to see if I'd forgotten something, and there were a few loose ends I didn't have written locally.

Today I went over and fixed a couple of those, as well as added pathfinding.

Pathfinding

Nothing too exciting tech wise, the pathfinding uses regular astar (see implementation) and looks at the grid to add a higher cost to buildings + constructions. It'll try to avoid them unless it can't in which case it'll go through. I don't really want them ever getting stuck, so this is good.

They walk each node along the path and check for a new one, this is in case you build something in their way, they'll go around. Oh and the debug visualization won't be active for the player of course.

Soon I'll add a road building and upgrades, which will modify the costs of the tiles to be less than the default, and it's upgrades will further reduce cost making them favour better paths (the roads will also increase move speed).

The paths also change the balance a bit, which is why I wanted to get them in before I do any balancing of time or numbers.

Restocking, Unstocking, and Stockpiling

From #10 I mentioned some todos that are now resolved. I also fixed some other bugs I found, specifically around destroying buildings while tasks were moving toward them. Most tasks handled that, except for the one, it's fixed now.

- Consumers now request a restock when a threshold is hit. They have an amount total they ask for and an amount per request.
- Producers now request stock / offload_amount tasks to move stock to a stockpile, so they clear faster
- Destroying a stockpile, consumer, or producer will unload the stock into the world, so it's not lost.

This also affects balance, because if their whole day is loaded with these tasks, they'll never do anything else. There's task priorities but if the queue is always flooded anyway it's no good.

You can see this in two forms below, one as chaos and one with less going on. Note the round building that turns red is the consumer, it requires wood to operate and requests more in chunks.

next...

- Waste stock pile doesn't unload contents to the world when destroyed (I think that's the last one)
- Loose stock in the world doesn't generate requests to be moved to a stockpile

I've started adding the food and water consumption, but it's not connected yet.

Till next time.

Leave a comment

Log in with itch.io to leave a comment.