Object Pooling, Event Systems, and Optimization

Danny Gallagher
IMM at TCNJ Senior Showcase 2017
2 min readApr 6, 2017

This week, I revamped my object pooling system, established my health controller, refined the enemy fire animation, and created the explosion pooling and instantiating system. Generally, a large portion of my work centers around object pooling and event systems. While these are a bit more complex, they optimize efficiency, and, in the case of events, allow me to listen to VR input. Essentially, pooling involves creating an array of objects entirely at the start, then saving them in memory, only causing a dip in performance on the initial load (which can be hidden by a loading screen) as opposed to throughout the project. In a game like mine, where performance is key and there are a large amount of the same objects being destroyed and instantiated, pooling is essential. Originally, I tried to use a single pool for all of the enemy objects, but this week I found that a much more elegant solution was to simply call from separate pools for each objects, as it allows easier handling of object-specific variables and parameters.

I used events mostly to listen for VR input, particularly gaze. Using events precoded into the VR interface script, I can tell only specific objects to listen for when the player’s gaze is on them, and when that player then clicks. This allows for elegant creation of raycast lasers, button presses, and other interaction.

Overall, I am finally starting to feel comfortable with these (slightly) advanced systems, and my work pace has increased rapidly. While they certainly caused me to stumble at the beginning of the project, they are proving to be worth it in the end.

--

--