The much bigger issue was the triangle count. However this batching only works within a single tilemap renderer, and I used many. Each tile is rendered using two triangles, and draw calls are batched per material type. The tilemap renderer is not particularly efficient, at least when used in this manner. This also meant that the game world was renderer and almost game engine agnostic. This worked surprisingly well in my case: usually only a handful of tiles changed each frame, and a slow full re-sync only had to be done when the world changed completely. All modifications to the world data were synchronised to the corresponding tilemap renderer before the next frame. World data was stored in multiple flat arrays - one for each layer - while the tilemap system was relegated to being just a renderer. I opted instead to create a separate system for world data outside of the tilemap system to act as the single source of truth. While this certainly works, it’s not exactly ideal for games where practically every tile should have some information associated with it. One seemingly popular option is to store extra tile data separately from the tilemap in a hashmap indexed by the coordinates. You can’t easily add any custom data to individual tiles, which can be a problem with more simulation-focused games (like this one). I ended up using two tilemap renderers for each Z level, because each location can have separate floor and wall / block tiles (e.g a layer of grass covering a cube of dirt), just like Dwarf Fortress. Using it in this way requires a bit of glue code to translate 3D coordinates to the correct tilemap layer. You can emulate multiple layers by using more than one tilemap renderer at the same time, and it is exactly what I did. The system doesn’t natively support multiple layers or 3D maps. While it was good enough while experimenting with the core game mechanics, I soon ran into some limitations when trying to scale it up. It originally used Unity’s built-in tilemap system, including the tilemap renderer component. The first prototype was built using the Unity game engine. Players could switch between layers to see below ground, and layers below the current layer would also be rendered. The game would also feature an extensive underworld of natural caves, abandoned mines and mysterious dungeons, with dozens (or preferably hundreds) of layers. The idea was essentially to build a game somewhere between a town builder, a real-time strategy game and a life simulation, set in a procedurally generated voxel world with a fixed top-down camera. Hills, forests and lakes rendered using approximately 260,000 tiles.Īlmost exactly one year ago I started working on a little hobby game project, inspired by games like Dwarf Fortress, RimWorld and Prison Architect. Rendering large 3D tilemaps with a single draw call at 3000 FPS - paavohtl's blog paavohtl's blog posts about Rendering large 3D tilemaps with a single draw call at 30-04-06
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |