Perhaps the most important critique in game development is performance. The features that I have added to my project so far inevitably reflect negatively on the game performance. Because At this stage, of course, I have to implement to more efficient ways. Basically, if you try to expand the game, you have to call more draw methods. For example, I had to call too many draw methods while adding the semi-dynamic lighting to the project. Well, my prototype didn't slow down much, but in case I use a bigger map, that's going to be problem for me. Fortunately, I learned that it is a technique that I can easily apply to my entire project. This is a system called sprite batching.
So what is this sprite batching? In short, calling multiple game objects a single draw method. For instance, that is calling 10 draw methods or 1 draw method instead of calling 100 draw methods for 100 objects. This system is a well known and used system. I have never used it until now.
Before I started typing this devlog, I had to type this system myself in a small project. I will add some benchmarks. I will evaluate the CPU, GPU, and RAM usage side of the benchmark through Task Manager. In addition, I will already get the FPS values through the program.
Firsly, I will draw each of 32px square sprites on the screen one by one. So I'm going to draw 100000 objects on the screen. In this case I have to call 100000 draw methods.
According to the values that I got:
- CPU usage(max.): 14.9%
- GPU usage(max.): 30.5%
- RAM usage: 102.1MB
- FPS: 4
- CPU usage(max.): 7.2%
- GPU usage(max.): 60%
- RAM usage: 89MB
- FPS(max. - theoric): 359
No comments:
Post a Comment