![]() ![]() /u/idbrii for pointing out a fix that nearly doubled the FPS.You don't have to credit me, but I'd really like to know if you built something meaningful with it. It should as code is universal and doesn't use version specific tweaks in Unity (only BoxColliders2D, SpriteRenderers and SpriteMasks). Make sure you add using DTerrain at the begining of you scripts. I can't access any of the components from this package. See SampleScene2Optimized to see the idea behind it. To reduce lag separate typical collision layer into two layers: visible (only sprite renderer - one big chunk) and logic (only collision - many chunks). Also, chunks are based on SpriteRenderers meaning the more chunks camera sees the slower it will work. Recalculating colliders takes about 90% of all computation for DTerrain, keep that in mind. Reduce unnecessary per frame changes to the terrain as it makes chunk to recalculate it's colliders. Slightly increase number of chunks or reduce number of operations done on world per frame. Example scene rarely goes below ~80 FPS druing per frame destruction on my machine. Whenever a change is made (destruction) each Chunk recalculates sub-textures based on their Columns and recreates BoxColliders2D using Quadtree to fit new terrain. I found out that changing a few smaller Textures is much, much faster than changing one big texture. There are many ways you can handle destruction: if I have shape (list of Columns) I can manually remove each pixel, or use ranges of this shape to delete effectively bigger areas of terrain.Įach Chunk has their sub-texture made from original Texture. Layer is made of chunks and when any changes are made to the Layer - it changes the certain chunk (or chunks). Now I have a list of Columns that make a single Chunk. I fill those ranges using image (if color.alpha>threshold I fill it and use range to remember it effectively). One very nice feature is that all terrain is destructible. Build up your bases, prepare your team, and dive head-first into the fast and flowing turn-based combat. ALIEN invasion was a common theme of popular culture in the 1990s. Then I make a list of ranges called Column. You control a secret organisation charged with defending Earth from a brutal alien enemy. If you want to use it, clone this repository and see example scene.Īlso provides additional functionalities as painting on customizable layers. The game takes place in the year 2084, the player will have to manage a secret military organization dedicated to protecting the Earth’s population from alien invaders The game combines. This beginner friendly tool will take your game to the next level. UFO: Alien Invasion is a game that is a mixture of real-time strategy and tactical RPG, continuing the ideas and traditions of X-COM. Very reusable and customizable for your own needs. Pretty efficent and works with Unity Colliders. Simple destructible terrain in Unity based on bitmaps and Quadtree. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |