A rough-and-dirty implementation of object pooling, a technique very common in game dev and proc gen. First learned about it in a Unity context, since then found out it’s quite universal and for good measure.

In this implementation you’re going down an endless grid with randomly generated object. The grid is infinitely generated ahead of you and quietly destroyed behind  you. The console reports every instantiation (and destruction) with the current object count in the scene (scene.children), which remains the same, because that’s the point.

 

(Key input doesn’t work in iframes. To actually reset the camera go directly to the source)

Leave a Reply