While we’re continuing to prototype features for our game “Smash Bash: Date with the Desert”, I do some tests for knowing limitations of the engine. Here I want to share some results.
One of the common cases for our game is a lot of objects at the screen: heroes, zombies, enemies, bullets, effects, objects of dynamic and static environment.
There are many post about the fact, that Defold does not fit for real time simulation using Lua. So, I’ve decided to compare how far we can go using Defold engine and another one - Unity.
For comparison I’ve implemented simple tests using Defold 1.2.107 and Unity 5.6.0p1. For measuring I’ve used my old good iPad 2 (iOS 9.3.5) and Xcode.
First test is performance of a lot of objects with logic.
I spawn a bunch of objects at random position of the screen. Each object moves in a random direction and bounces off the screen frame.
You can tap on the left part of the screen to decrease number of objects and on the right part - to increase it.
Source code is available here: Defold, Unity.
There are two cases:
- Each object include its own script component for moving.
- There is one object, which has the responsibility for moving the spawned objects.
Note: before getting the results from the table I’ve removed a sprite component from spawned object.
Results:
Table with data
Don’t use real-time simulation on Defold (at least, with Lua language). It’s much better to use the engine to make asynchronous gameplay. For example: puzzles or turn-based strategies.
(Maybe I will try to move simulation logic to native extensions and then measure it again.)
Second test is the impact of a large number of objects with sprite components on performance. Images for sprites are identical.
Results:
Table with data
It’s hard to do right conclusions without any data on GPU usage, but it looks like Defold has some bottleneck and its not on the CPU side. Data transfer to GPU? Any thoughts?
Unity uses CPU for rendering more actively, even in several threads.
What instruments do you know for profiling cpu, gpu, ram and battery usage on Android/html5 which are independent from game engine? I’d like to hear any criticism, suggestions, questions!