Update 68

This week I needed to make some smoke  for an important object in the game so I have implemented a simple particle system. I tried to find libraries for a system particle but surprisingly there is very little free libraries still alive.  There are expensive middlewares like popcornfx and fork particle. At first, I was creating a rendered compatible with SDL_gpu for the library spark engine but after multiples unsuccessful tries I decided to make one myself, something very simple and basic.

After this key item, I can start polishing the last level.

Update 67

Lately, I have been implementing the secrets in the game but testing became a pain because I need to go to multiple maps through the game. Basically, I need to go through the whole game just to test if every secret make sense. To help me with the testing I have been trying to add a GUI menu for debugging purpose, but there is no really good GUI it seems.

I have been testing :
CEGUI 0.8.7 : The tutorial are mostly written for the previous version 0.7, a lot of things are missing. I have failed to run the examples, the library is quite big. I need to waste a lot of time on forums or adapting examples just to get something simple basic working.  A lot of dependencies are required.

kiss_sdl : Very lightweight library where the rendering is performed by SDL and SDL_image. So I need to modify the library to use SDL_gpu, quite a bit of work. Developed by one person, so it could be buggy.

nanogui-sdl : The implementation have some problem on windows, static linking is creating conflict. This is a port of another library : nanogui.

After all these research I decided to simply do a small command line tool myself something very small, where I can warp, get an object and change a variable.


Update 66

This week I have finished the small fake apps for the mobile phone in the game. I have discovered some bugs with the save file, where most of the thing on the mobile were not saved, and when you load the save you obtain old and new data mixed up (soft lock),

I have discovered some bugs with the save file, where most of the thing for the mobile were not saved, and when you load the save you obtain old and new data mixed up (soft lock). I am reimplementing that part correctly in XML because before it was done with some custom ugly formatting with many separators. The save file is bigger but this doesn’t have much importance. RapidXML is pretty fast so I can have a lot of data without having to worry about it.

I have some random disconnection from the internet which doesn’t help when I need to google some documentation or write an article on this blog for example. Nevertheless, the level 4 is progressing rapidly, each day new stuff is found and done. The save system took most of the weekend, so hopefully it’s finished tonight.

Sometimes I read some depressing stuff about indie games like that.

don’t go indie, 5 years of gamedev will kill you

Some people put everything on the line for one project, and at the end of the development : burnout and quit game development (or take a long break from it).

In my opinion, creating indie games are like writing novels or making paintings you are here for the long run. Success with the first game should not be considered the norm, but some people are lucky enough to have success for their first title : Undertale, Stardew Valley, Limbo, Fez, Dust: An elysian tale, and many others. And journalists create this myth, that anyone who works hard  can succeed, only hard work and quality matters.

Well, that’s weird why games should be more accessible than other media? They are some talented writer who works very hard on each of their books and they don’t necessarily became famous during their lifetime. It the same thing with starving artists, there are some other deciding external factors for success. There is no formula for success and all the unknown factors are called luck.

It makes me sad, when I see some people having a big hit (Minecraft, FEZ) and after that retiring from games development. It seems they don’t have enough love for their craft and take the easy path instead. I prefer to think of the courageous people who continue to make games no matter what.

Update 65

This week I have done a lot of programming with the game, I have implemented the SMS part correctly on the mobile phone in the game. Now you can use the phone to have a conversation with someone.

I have also integrated the video support with the library TheoraPlay. I need to integrate a video for one of the application in the phone :

The app is not finished yet, I need to work on the design, add buttons, etc…

The level 4 is almost finished but each time I think there are only small amount works something come and takes like a week. The only thing I can say for sure is : “It’s not done yet.”

It’s kind of preposterous to have a release with so many things changing on the fly. If you had asked me 3 days ago :

– “Do you need to have video support for that?”
– “No, why?”

3 days later 

– “Oh I see this is definitely the simplest solution ever 

Update 64

I am still writing dialogs for the level 4, the roadmaps changed a lot of things. And I have also discovered some big parts were not done or the position of the boxes was not correct.

After the dialogs are done they will be more art to do for the level I think, maybe animations. For the moment they are a lot of small things to finish before having a correct functional level with the proper endings.

For the moment the dialogs are linear, I try to handle most common  cases but after I will handle the other cases and maybe add some choices in the story without adding others endings.

There is no music at the moment, I will add the music after checking all of the levels.

Update 63

One big bug is fixed now, I have regenerated all the sprite sheets to add a small margin between objects. This small margin allows the objects to be displayed correctly when the game run in lower resolution. The second tree is finished I can now return to the level 4 of the game.

I have thought a lot about changing the system of dialogs in the game. Currently, the story is pretty much linear they are multiple paths but only at the end of the game. And when you choose a path the game continue to be linear until the end.

In this talk the system used is more interesting because you can make multiple choices that matter without having the  need to make new endings. Something linear where you do not have choices is good  for a book or a film. But for a game, this feel a little bit weak because players want something else with games. They want gameplay and replay value. Something linear the gameplay is affected and the replay value is absent. The game is done when all the endings are finished.

Most games story driven are linear because it’s already hard to create and tell a good story. But creating an interesting experience with a good story is much much harder. Because you can have a complex plot and a complex dialog system but it can be cheesy and emotionless. Most of the time harder things do not mean most impactful. It’s much more impressive and beautiful when the same thing can be achieved with less. This point of view has already been used by many games made by Fumito Ueda.

Update 62

After finishing to colorized a map I have realized that the map was only a small part of a bigger drawing. And I need to color everything because  the big view is also used in the game for another map.

It takes a lot of hours to colors 1920*1080 picture with lots of small things, so the tree is not finished. There are so many leaves, I am trying to have the same texture but with a pencil.


I have a bigger picture than this, so it’s easy to see the leaves but also time-consuming.

I have also retried emscripten to see if the library has progressed.

So I want to import Jpeg I have to port libjpeg and modify SDL2_image, I have already spent two weeks on SDL and Emscripten to find out the library is not yet mature.

I have changed libraries so I do not use SDL_images, I directly load the image with SDL_gpu which use stbi_image for the loading. The compilation of SDL_gpu is complete. After a small display test, it’s working fine with OpenGL ES2. I can port the game with emscripten now but there is a major downside compared to pixijs.

There are two alternatives for how files are packaged: preloading and embedding. Embedding puts the specified files inside the generated JavaScript, while preloading packages the files separately. Embedding files is much less efficient than preloading and should only be used when packaging small numbers of small files.

So the best way is to preload right? I have 60mb of resources files for the demo, so preloading seem not very efficient the person will wait maybe 10 min and it will take a lot of memory. With pixijs I can load on the fly the textures in OpenGL without having the preload all the files. There is a way to load async data with emscripten : emscripten_async_wget. So I have to change the loading system of the game to use emscripten functions, the point of emscripten is to port the c++ game without having to redo a lot of work. I have ported the demo for pixijs so I know what it means to change most of the things to make it work. The code with pixijs is cleaner because the code is already in javascript.

Note : Use emscripten when you can preload the data without having to pay a big price. If not use port the game in javascript with a good library.

Update 61

I have finished the program to launch batch jobs. Now I can compress efficiently png files with BatchGUI, for now, I can compress files with this simple script :

<?xml version="1.0" encoding="utf-8"?>
<prog out="$FILE$-new.png" exe="TruePNG" arg="/out $OUT$ /o max $IN$">

<prog out="$FILE$.png" exe="zopflipng" arg="-y -m --filters=01234mepb --lossy_transparent $IN$ $OUT$">

<prog out="$FILE$.png" exe="deflopt" arg="$IN$" />


This job consist of compressing the images with three command lines images optimizers :

Img -> TruePNG -> zoflipng -> deflopt -> Img compressed

You can replace the tool with something else and also generate multiple outputs for one input.

The interface is very simple, you load an XML script and then you drag and drop the image you want to add.

BatchGUI screenshot

I am still working on the art of the level 4, more trees, more colors and maybe shaders.

Update 60

I am drawing another tree for the level 4, after that, I need to color one character and one background.

I have an old bug everywhere in the game with the sprites sheet, every object is bonded to another object in the sprite with no margin.


But when the images of the door are displayed at lower resolutions we can see a small vertical line belonging to the other object in the sprite sheet. This is due to the round error OpenGL do when reducing the size of the object. The solution is to add a small margin of 2 pixels each side of the object.

In this image, the margin is white because I converted the image to JPEG to improve loading time, in the original margin are transparent.


After doing all the generation of the sprite sheet for the first level, I have big PNG files and I need to compress them but most of the software out there to compress images files are in command lines and not multithreaded. And the GUI programs do not let enough options and are built around one optimizer. For the moment I use PNGGauntlet, I am building a small flexible program with Qt that can use any of the command line optimizers where the user can specify the options in an XML config file.

Update 59

There is a lot of small things to do in the level 4, I am also adding maps because even if there is a lot of things to do, a lot of it is very easy. It’s time to make thing more challenging at least for some parts.

I was also thinking about maybe adding small cutscenes in the games. But how do you do that with SDL? I need a codec library to decode the video, something like FFmpeg but smaller, I only need to read one type of video. TheoraPlay seems nice for that, and there is an example using SDL. Wait a minute, the example only works for SDL 1.2? After spending some time with replacing old functions with new ones and using SDL_Texture instead of SDL_Surface, I came up with something working : Play video with SDL2 

In the game, I use SDL_gpu to render the display, so SDL_Renderer and SDL_Texture  need to be replaced with SDL_gpu stuff like GPU_Target and GPU_Image. But something is quite problematic : no YUV support well I don’t have a choice so I am trying with RGB.

The good new is TheoraPlay can decode these format :

/* NTSC colorspace, planar YCrCb 4:2:0 */
/* NTSC colorspace, planar YCbCr 4:2:0 */
/* 24 bits packed pixel RGB */
/* 32 bits packed pixel RGBA (full alpha). */

RGB is good enough for the test, how do I update the pixels, there is no SDL_LockTexture and SDL_UnlockTexture for SDL_gpu. But there is GPU_UpdateImageBytes which do the work. I can update all the pixels at the same time with RGB. With YUV there is 3 planes to update, multiple calls to memcpy are necessary :

SDL_LockTexture(texture, NULL, &pixels, &pitch);
const int w = video->width;
const int h = video->height;
const Uint8 *y = (const Uint8 *)video->pixels;
const Uint8 *u = y + (w * h);
const Uint8 *v = u + ((w / 2) * (h / 2));
Uint8 *dst = (Uint8*)pixels;
int i;
for (i = 0; i < h; i++, y += w, dst += pitch) {
memcpy(dst, y, w);
for (i = 0; i < h / 2; i++,	u += w / 2, dst += pitch / 2) {
memcpy(dst, u, w / 2);
for (i = 0; i < h / 2; i++,	v += w / 2,	dst += pitch / 2) {
memcpy(dst, v, w / 2);

With RGB and SDL_gpu I can update everything with one call :

GPU_UpdateImageBytes(texture, NULL, video->pixels, video->width * texture->bytes_per_pixel);