Appendix B. DOD vs. OOP architecture performance example
The best way to test how DOD affects performance is with an actual game. In this case, we can take the simple survivor game that we created in Chapters 4 and 5 and use it to test the difference between DOD and OOP. We’ll test how many enemies we can have on the screen, interacting with each other, while still maintaining 60 frames per second (fps).
First, we’ll set up our testing environment. Then, we’ll make an OOP version of our simple survival game and slightly modify the DOD version. Finally, we’ll run both and see which one allows us to have more enemies on the screen while maintaining 60fps.
Our simulation will look like Figure B.1:
Figure B.1 Screenshots of our simulation running on an iPhone 16 Pro. The left screenshot shows the main menu where we can select to run either the DOD or OOP simulations. The middle screenshot shows the DOD simulation running after maximizing the number of enemies. The rightmost screenshot is the OOP simulation running after maximizing the number of enemies.

The Unity project for this simulation is on GitHub, and you can run it on your own device.