- Home /
How to make a game like topple over?
Hey guys how did they make this kind of game.
here is the link to the game https://apps.apple.com/lk/app/topple-over/id1533234213
1) how did they make it run pretty smoothly on a phone
2) how did they activate the blocks to make then fall nicely when they are struck.
3) how do they detect how many pieces have fell on the ground even if i lands on a its own destructable block it still manages to detect it.
4) how did they manage to do the nice starting animation of the blocks spawning.
Answer by TheFloatingSheep · Mar 25, 2021 at 11:13 PM
It looks like they only use a few differently sized blocks with very minimal color variation. If the mesh is identical and the material is identical, GPU Instancing would make it run a lot smoother than it would otherwise. https://docs.unity3d.com/Manual/GPUInstancing.html
As for the performance of the physics, it's possible to write that into a compute shader and have it run a lot smoother than it would run on the cpu, but I highly doubt they've done that in this game. Rigidbodies would probably work just fine.
As for the animation, assuming these blocks are stored into an array as they're loaded, they could be stored in order of their Y position, straight as they're loaded from something like a json file, or if they're just plain prefabs they could be ordered based on their Y value from lower to higher being top to bottom of the hierarchy. And then you'd just need to write a coroutine with loop and break of half a second or something, going through all of the items of the array or the children of the parent prefab which you've instantiated and do SetActive on each one of them. It's pretty straight forward. I downloaded the game just to see how the animation looks, was expecting it to be more complicated.
do you know how they also manage to detect the pieces that have fallen to the ground, also thanks alot for the answer!!