Gerrudo / reticulating-splines

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

Tilemap Overhaul #36

Closed Gerrudo closed 2 months ago

Gerrudo commented 2 months ago

Our Tilemaps need to be heavily modified to act as a basis for our simulation.

Tilemaps should be able to:

Related items:

Gerrudo commented 2 months ago

https://github.com/Gerrudo/reticulating-splines/commit/f858c839c590294008703297d79f6403f17010f1 Complete overhaul of our placement system, needs work still to add placeable buildings as well as zones.

This also addresses #4 by using EventSystem.current.IsPointerOverGameObject() when drawing tiles on the grid.

Gerrudo commented 2 months ago

https://github.com/Gerrudo/reticulating-splines/commit/87199096b5fb1bc90f5034d9e75efe4d9129f6bd Getting there! Certainly some sprite issues to sort out but the roads are looking good.

Image

What we have left to do:

Gerrudo commented 2 months ago

https://github.com/Gerrudo/reticulating-splines/commit/f4399b26b8dcabd636140906293271fe161fb43b Sprites looking much better, still some clipping issues but it looks like this is due to the cell size overlapping possibly which I'll need to edit on the grid or tilemap object.

Made sprite importing much easier by just using .png sprite sheets and using a 32x32 fixed cell size sprite sheet.

Image

Gerrudo commented 2 months ago

https://github.com/Gerrudo/reticulating-splines/commit/afc99ceae17e402d328cd002f6e5ece23614add0 Added a dictionary for keeping track of all our tile data, it stores the Vector3 as a key and values are from our PlaceableTile scriptable object.

How this will work is each time a tile is added or removed, we will adjust our dictionary according using the tile's Vector3 as our key.

We can also filter by TileType, and use the data stored in each tile to make decisions in code about what to do.

This essentially means our simulation will work off each tile, so no visual elements on the screen hold data, only the cityTiles dictionary.

Anytime we change data in our dictionary, we'll want to reflect this in the visual state of our game, this is actually how every SimCity game worked up until SimCity 2013, it's essentially just a very pretty spreadsheet.

(I stole this idea from here.)

Gerrudo commented 2 months ago

https://github.com/Gerrudo/reticulating-splines/commit/bfbaeff480de8f3eb001a77a7b2623c72f1d2fc8 Buildings will upgrade to a level 1 state after 1 day has passed, we can expand on this later to make it more complex.

Buildings also cannot be placed on water or other buildings.

We now just need to create a bulldozer/eraser for tiles.