Update 35

This week I have tried to make the game working on an older computer. On the same computer, I have windows 7 and Ubuntu 15 it would be reasonable to think that if the game works it would be working on both OS, but that’s not the case ! It’s only working on Ubuntu without the shaders enabled (the shader load correctly but when I need to use it the framerate drop to 0). On Windows 7 it crashes when calling GPU_Flip() with an OpenGL 2 renderer and even with an OpenGL 1 renderer. The memory is corrupted after that. So the issue is in SDL_GPU, it probably tries to use some OpenGL functions not supported correctly by the driver but found by GLEW. So when the issue is probably with the graphics card driver and I have the latest update I can say the game is not supported on this computer.

I have decided to add some maps for the level 4 and time, I can have more character and, different characters by day or night to have the game world more elaborated. The story is linear but with multiple endings so I can add more conditions to have a certain

 

ending. For this chapter, the story is not very precise yet because it’s the middle part of the story so I am trying to make this part interesting and cohesive with the ending.

For the  characters, I start with a rough sketch to have a general idea and after I am convinced I refined it and correct mistakes, clean it up and add color, shadows etc…

girlSketch

Update 34

I have spent my time fixing a lot of random bugs where the game crash after exiting. I have redone the memory management of resources to avoid memory leaks. Changing libraries have such an impact on the structure, adding more buffers, deleting or adding threads. I am at the end of the level 4 but with all these bugs it may take more time, I do not have animations yet for this level. I will finish the game with the base so the game will be kind of pre-alpha, polishing the game will take months of redoing things and fixings bugs. I am doing the animations and other nice things after the story is solid and I am sure the content is definitive.

To sum up the development of the game:
current state -> rough – > base -> polished (alpha) -> beta -> released

The music will be added during the base phase of the development, for the moment, I am just testing if the libraries work fine with the game. After the base, everything should be implemented all the debugging goes into the alpha phase.

Update 33

I have discovered that you cannot integrate shaders with SDL without using pure OpenGL. The other sad thing is if you have an OpenGL context associated with a renderer you cannot use SDL_Texture and OpenGL textures at the same time because  the OpenGL backend from the SDL_Texture will interfere. So if you want to support shader you have to go full OpenGL and drop the rendering part of SDL: SDL_RenderCopy, SDL_RenderClear, SDL_RenderPresent,… and only use OpenGL and GLEW or any other libraries to load extensions to have at least OpenGL 2.1.

It’s quite sad to learn that the preferred way to do things is to reinvent the wheel especially for something “classic” like a 2D game. In this case, SFML is a lot more interesting because you can apply a shader to a sprite in one line, not ten like with OpenGL. I have seriously thought about dropping the shader support because going full OpenGL change everything and “wasting” a lot of time reinventing the wheel. You could argue that OpenGL has it’s advantage in term of performances and compatibility across mobile phone and tablet. For a 2D game developed by one person, the price to pay is important  in term of time invested and I have already said it already: I do not have all the time in the world to make this game.

The one good news is that there is a non-official extension SDL library developed by one man who fit this purpose:  SDL_gpu. I have already written a test to see if it’s working with multi-texturing and it seem to work. It uses stb_image to load images so I will drop SDL_Image, I can keep SDL_ttf because SDL_Surface can be converted into GPU_Image.

Update 32

Unlike the last week, I have spent most of my time programming and fixing bugs. On thing interesting is that I was using threads and more than two for a point and click game it’s can be seen as premature optimisation. There is not enough memory to load all the maps of the game so I have a pool of loaded maps and each time the user want to move I load the map if unloaded. I can also load all the maps adjacent in another thread but the pool will be full quite fast. SDL need to have one thread where all the rendering is done, SDL_Texture cannot be in multiple threads without context sharing and  in this case, it’s not worth it. You can load SDL_Surface in another thread with SDL_image because SDL_Surface reside in the CPU and not GPU. So you can make a loading screen with two threads without problems, I am writing a tutorial on that. Other optimizations are for example texture atlas, I am using textures atlas for inventories icons and menus and animations. At the end I should use it for everything that needs to be loaded at the beginning of the game, the size of the texture atlas will be 2048*2048. But for the moment, texture atlases can be annoying because they have to be generated in the tiles editor each time I add a new image.

Other optimizations are for example texture atlas, I am using textures atlas for inventories icons and menus and animations. At the end I should use it for everything that needs to be loaded at the beginning of the game, the size of the texture atlas will be 2048*2048. But for the moment, texture atlases can be annoying because they have to be generated in the tiles editor each time I add a new image.

I always spent a lot of time thinking about design or optimizations on things that does not need to be optimised. I think I don’t like the idea of not doing the best things to save time, I prefer doing the best thing every time worth it or not, the problem with that is the time available to work full time on this game is limited: 18 months so I cannot fool around too much if I want the game to be finished in time.