If you were to download HGE, it comes with a tutorials folder that contains 8 sample programs. One of those tutorials (#7) is called "Thousand of Hares". I decided to duplicate 90% of the functionality in that demo (I don't have any blending support yet in my engine), and see how it ran against the C++ version. Please note that the framerates provided are on my laptop, and should be much improved on a desktop.
The idea is simple: display randomly moving, scaling, and rotating "zazakas". Using the up and down arrow keys, you can adjust the number being rendered every frame between 100 and 2000. That's it. And to make a long story short, I was very impressed with the results (HGE framerate on the left vs. my framerate on the right):
100 sprites - 277 FPS vs. 251 FPS
500 sprites - 105 FPS vs. 97 FPS
1000 sprites - 63 FPS vs. 54 FPS
2000 sprites - 33 FPS vs. 27 FPS
A couple things to note: starting around 1000 sprites, HGE began to "skip" (every 100 frames or so the program would stutter). My version didn't skip at all (even after very, very prolonged running). This was actually very surprising to me, since I expected Dolphin to skip eventually due to a garbage collection. This never happened.
Also, it should be noted that I have a lot more optimizations left to do. I'm currently drawing every single sprite to the screen individually (this is very bad for performance in Direct3D) as opposed to batching them up and rendering them all in one shot (which HGE already does).
If I wasn't already feeling very good about how well the engine was going, I definitely would be now. I still have a lot of work to do (I was planning on having the above sample available for download, but there are still enough show-stopper bugs making that not possible), but the above sample was put together in about 10 minutes once I had the time to do it.
Cheers!
2 comments:
Hi Jeff,
Any chance I can get you to post some tutorials on doing the DX9 bindings? I'm new to smalltalk but not to C/C++.
Cheers,
Ben
Hello Jeff!
That's a very intersting blog of yours! In the last 3 months i've been thinking about having a taste of Smalltalk after reading "Design Patterns, elements of Reusable O.O Software". Got some research on it and what attracted me at the first moment was the cool syntax and the powerful reflective capabilities of the language.
After reading some of your experiences the idea grew stronger,i'm a gamedev beginner and i really enjoyed to read your thoughts about the Smalltalk's power from the game development point of view.
Keep rockin and spreading the word!
Best Wishes
Post a Comment