Monthly Archives: July 2018

Video #0: In-Game Overview July 2018

When sitting together with a friend and talking about my project, we came onto the subject of a dilemma I am struggling with almost since the beginning of this project: I’m very unsure of what to present on my blog.

I’m no artist at all, which means that (for the moment at least) I’m relying on bad programmer art, assets from very old games and assets made freely available on the internet (thank you, kind souls!). Especially because of the latter two, I am very reluctant to show anything on my blog. I don’t want to adorn myself with borrowed plumes and I also don’t want to raise wrong expectations what the game will look like. That’s why I almost always decided against showing something visual in the past. But if I don’t show any of this graphics off, it’s hard to show anything tangible at all because 90% of what I produce is source code and that’s very hard to present in a visual way.

However, my friend made some compelling arguments for just putting everything I produce out there at this stage of the project. His points made a lot of sense, at least to someone who admittedly deep down always wanted to do this anyway but was simply too worried.
He convinced me and I thought to myself “Yeah! I’ll go home and start putting my stuff out there! No holding back anymore!” And that’s what I did! Well, almost. This conversation with my friend took place back in March or April, I think. But hey, no good project without some good, old-fashioned delays, right?

Without further ado, I hereby present the first result caused by this decision. A short video of some of the features that are already integrated in the game:

Code Snippets #1: Simple Pooling Manager


I wrote a new pooling manager in the mean time and recommend using that. This first version won’t be improved upon anymore. However, if you just need a very simple pooling manager, feel free to use it anyway. There’s one small bug (documented further down) but that should be easy to fix. If you have problems doing so, contact me anytime. I’ll be happy to help!

Original Post

I was in need of a simple pooling manager and doing some research, I stumbled upon this helpful blog post by Dave Crook. It wasn’t exactly what I was looking for but a good starting point which inspired me to do my own thing. I’ll share it here and you can feel free to use it in any way you see fit. It still some a features one might need but for now does everything I need it to do. I’m pretty sure I’ll make some adjustments in the future and should that happen, I’ll update the code here. So, you should probably subscribe to the blog 😉

Class to manage multiple object pools:

Class representing an object pool:


  • In some places the code looks a bit inelegant (using for instead of foreach, saving the amount of objects in a list to a variable instead of using Count(), etc.
    This design decisions are intentional. I did quite a bit of profiling and came to the conclusion that writing the code this way leads to much better performance when dealing with a lot of objects.
  • If you need a large number of objects from the pool, it is advised to fetch them in one go with GetObjects(int) instead of calling GetObject() multiple times.
    I can’t say anything about the performance scaling (I would have to do more tests for that). But as a small test I fetched 2400 objects from the pool, one time all at once with GetObjects(int) and once I fetched each of them individually in a for loop. Fetching them all at once took about 19.8ms, fetching every one of them separately took 877.5ms.
  • There’s a bug when detecting that a pool object was accidentally destroyed: In that case, a new object is created and returned but the destroyed object isn’t removed from the pool. The bug is also documented in the code but I won’t fix it because I rewrote the pooling manager anyway.