Update 51

I am trying now to clean and optimise the engine since most of the things are implemented. For example, a long time before when I was using SFML and a lot of bugs were not fixed I was not able to use stack allocations for the dialogues and the actions. But now I can to the many bugs and memory leaks I have fixed. But having thing stack allocated complexify things because each time they are created and destroyed so I have moved the destructor into a free method to only free the object when needed. Before I was able to check is the object was allocated simply with if(object != NULL)  {…} because with dynamic allocation you have a pointer to the object. Now I have a variable bool allocated which I set to true if the object is allocated (most of the time allocated == resources loaded).

When do you use stack allocation ? In games, most of the times the things to optimise are the loading times between levels, so for a point and click there is not much memory needed so I can have every allocation in the game loop stack allocated. The only time when I utilise dynamic allocation is when the game start, and I need to create big objects such as Game and FileManager. For texture, I use SDL_gpu wich rely on stb_image and SDL to load the images so every allocation is masked, and for sound Almixer it uses OpenAL. Each of these libraries uses dynamic allocation (malloc) for the loading/decoding of files. Now the loading times are faster than before and the navigation between maps is more fluid.

I have also found other small bugs with the audio, where I was using a thread inside another thread of Almixer because the library was compiled with the thread option…

After fixing so many things I think I am at a point when the engine is stable, but each time I find something else to change and after that, I have a lot of small bugs in the game to fix because things are not performed in the same order.

I have also finished most of the level 2 so now it’s time to fix and polish the big levels 3 and 4.

Leave a Reply

Your email address will not be published. Required fields are marked *