Skip to main content
15 events
when toggle format what by license comment
Apr 11 at 20:48 history edited Pow CC BY-SA 4.0
added 606 characters in body
Apr 11 at 16:12 comment added Pow @Zibelas Yeah, I wasnt really thinking, as I didnt think it would work that well anyway, and I'm kinda right, its still super laggy since I guess most of the freezing is because of repositioning and modifying the thousands of tiles. I am going to try Philipp's method of using a TileMap and see if that works.
Apr 11 at 15:56 comment added Zibelas Thats the main idea behind object pooling. It does not destroy and recreate the object which is expensive. They are usuable just not enabled and depending on your pool, just reskinned and repositioned. Depending on your interaction which the object, they might not even have the full logic for interaction on a block basis but just handed their id to a super function that handles it.
Apr 11 at 14:53 comment added Pow @OlivierJacot-Descombes You are right, I will try it now, thankyou.
Apr 11 at 13:48 comment added Olivier Jacot-Descombes "I cannot pool an infinite number of tiles", You wouldn't have to. You define a maximum view distance. Chunks coming in to view distance are added, chunks leaving view scope (view distance + some delta to avoid constant loading and unloading) are removed. So, no matter how big your world is, the number of loaded tiles is finite.
Apr 11 at 12:28 comment added DMGregory You can also store your tile type info in an array, and control the sounds / mining by looking up the corresponding array entry, again without needing game objects / components for every tile instance.
Apr 11 at 12:12 comment added Philipp "Due to the way the tiles work, they need to be individually accessable by scripts, for example for mining and walk sound effects" - Unity Tilemaps allow you to do that. You can create an own class inheriting from TileBase and store arbitrary information in tiles, and then retrieve your instances of that class with GetTile (you still need to cast them to your own class, of course).
Apr 11 at 11:01 comment added Pow @Philipp I didnt actually think about that, I suppose if I unload and reload the pooling could work.
Apr 11 at 11:00 comment added Pow Due to the way the tiles work, they need to be individually accessable by scripts, for example for mining and walk sound effects.
Apr 11 at 10:55 comment added DMGregory If your tiles are mainly graphical and most don't need script interactions, you could use a trick like the one shown here to render huge swaths of tiles on a single mesh. Depending on your gameplay, you might still need to create a collision representation, but that again can be one combined object per chunk.
Apr 11 at 10:54 comment added Philipp And have you considered to use a TileMap? The tiles on a tilemap aren't full-fledged game objects, so they are a lot more resource-friendly.
Apr 11 at 10:52 comment added Philipp I also think that you could use object-pooling here, because while you are creating chunks, you are also unloading chunks. So you can return any objects in unloaded chunks back to the pool to be reused.
Apr 11 at 10:51 comment added Philipp If you have performance problems with a very large number of very simple game objects, then that sounds like an ideal use-case for Entities.
Apr 11 at 10:28 history edited Pow CC BY-SA 4.0
added 345 characters in body
Apr 11 at 10:18 history asked Pow CC BY-SA 4.0