Gerrudo / reticulating-splines

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

Create Resource Management System #24

Closed Gerrudo closed 2 months ago

Gerrudo commented 2 months ago

At the moment there is no resources that the player can collect or use to make other resources.

We should look at adding fuel for our generators, so coal or wood?

And a example first resource could be clay, for our bricks.

Steps we need to take to achieve this:

Relies on #23 for the statistics panel.

Gerrudo commented 2 months ago

Added some rough clay and coal deposits, we'll alter these later. I think they'd look great as just small blobs that appear on the tile instead of a full tile being covered.

Image

For the configuration of the GridManager, we already have systems that can take care of the resources, as we use tiles for our Placement Indication.

Made good progress on https://github.com/Gerrudo/reticulating-splines/commit/7c18df224dbb3e854088fd90d5f5328bc4c23b82, need to carry on this, items for tomorrow:

Gerrudo commented 2 months ago

https://github.com/Gerrudo/reticulating-splines/commit/2ecbd06e7ce00ffc7ad128941f7dc96563cbeecc Added temporary sprites for mines, attempting to get them to work the same way CanTakeArea works but instead using IsOnResource and checking if they're placed over a resource, unfortunately our baseArray for our tiles comes back null when using resourceTilemap.

Need to keep investigating what's different between PlacementTilemap and ResourceTilemap.

Gerrudo commented 2 months ago

Image Image

Gerrudo commented 2 months ago

Fixed our Resource tile map in https://github.com/Gerrudo/reticulating-splines/commit/3ba2caf43473d1f321586109e698ec9a28a9d385, this took 2 hours! Just because I set the grid coordinates wrong when painting the tiles onto the tile map.

It's very important to make sure when painting tiles using the palette the correct Z Position is set. Luckily I could see the coordinates were different on my resource tile map compared to placement, so when our IsOnResource method would try to get an array of tiles it would return new.

The tiles were at -1 Z axis, and not 0 Z axis, like PlacementTilemap is.

Gerrudo commented 2 months ago

We now have resources being generated, we now need to make sure simulation manager is accounting for these new assets in production and spruce up the assets.

Gerrudo commented 2 months ago

Added requirements for clay and coal to produce in https://github.com/Gerrudo/reticulating-splines/commit/f39adb50eff2264214d76991485f05865e38cd5f

I think this needs more work, we should look at how we can simply these trees of resources into a simple production chain, which got me looking at ECS: https://devlog.hexops.com/2022/lets-build-ecs-part-1/

This might be overcomplicating it for our needs, but it would be worth while looking at a more modular system for resource dependency. This will be required if we want to expand this system.

Gerrudo commented 2 months ago

https://github.com/Gerrudo/reticulating-splines/commit/b421d7543ca9c80081026983475435b49e4e14c3 We are getting there! Our resource still work together, I added a BuildingType enum to our building scriptable object so we can apply certain logic to certain types of buildings.

They do need some tweaking/balancing so you can stabilise numbers.

Image

I think we update the sprites then close this one out.