Massive Rewrite


Update 4 (06.02.24)

Features Added:

- Structure Generation

- Tree Generation

- World Data Stored In Chunks to Improve FPS on large worlds (30fps -> 100+fps)

- Optimization of Physics (60fps -> 100+fps)

- Background Layer

The Rewrite

To improve the performance of the system I had to rewrite most of the code since each frame was printing hundreds of tiles individually, it caused a bottleneck in performance when trying to update physics tiles and draw new tiles to the display when moving the camera. I got over this by storing all the tiles that needed to be updated for each frame in lists. However, this made the physics system stop working because it couldn't know if a tile was free or not causing many bugs to be formed; causing water and sand tiles to disappear. These bugs were fixed by altering the if statements of each potential movement to check three different conditions with the lists to ensure that where they were moving is available and where they are moving is possible. 

I also had to rewrite the world generation system because larger worlds cause the game to lag searching for vector3 in the world data dictionary. This made me add a chunk system to hold the data so that it was quicker to search for the data, the system works fundamentally the same as before but the implementation of having a chunk system doubled the speed when using the same large world size from the previous method.

Because we are using a chunk system to load and manage the world, this means that I had to rewrite the saving and loading systems of the game to place the data into the corresponding chunks.

Issues

The main issue at the moment is managing how many tiles are on the screen at once, the more tiles that there are the slower the game gets, I have implemented a save and reload of the world which clears all the tiles and loads the world. This method works great and is fast however it is not seamless. I wanted to use a procedural removal system for the tiles that are off the screen however, adding an active tiles list halved the frame rate which was more counterproductive. But I have an idea of a work around for this issue which won't require management of active tiles.

Get Tile Engine

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.