Monthly Archives: September 2016

Optimizing your code when using heap and stack

Memory Usage [Image from

We all do it!

Yet, this is a topic that rarely receives attention: memory allocation and performance; When our game has been created and that functionalities have been implemented, we would typically use a profiler to try to identify issues that may slow down our code; this being aid, many of the bottlenecks detected by the profiler, may be prevented by coding defensively and avoiding some common pitfalls; these are often linked to garbage collection, memory allocation, and speed of access; in this post, we will start to talk about the heap and the stack, explain what these terms mean, how and why data are stored in these, and how to optimize our code to use them wisely and efficiently. Continue reading

Creating Your Level from a text file


In this short tutorial, we will be looking at creating levels from a text file; this will involve;

  • Creating a text file accessible from a resources folder within your project
  • Reading this file line by line
  • Instantiating objects based on the value read in the file

This technique can be used to create multiple levels very easily. This will at least do two things for you: (1) it will make it possible to modify the structure of the level without having to modify the code, and (2) to create individual files for each level.

Continue reading