Update 71

A lot of optimization and bug fixing this week, the level did not progress at all.I have optimized the text rendering with a small library

I have optimized the text rendering with a small library NFont developed by the creator of SDL_gpu. I have gained a more stable framerate 60 fps when a shader is used.

I have also improved the loading time of the game by generating sprite sheets for the objects. Doing that I have discovered the rendering of SDL_gpu (which use OpenGL) is not precise when the image is rotated, the image becomes blurry. So I add to replace SDL_gpu with a library specialized in image processing to have something precise. I have chosen a small, simple and header only library: CImg. The replacement is not finished yet, I need to redo the sprite sheets for the animations, maps, and menu.

There are so many unexpected bugs coming along, it became really difficult to have accurate estimations. The only thing I know is I have two months left before the job hunting. Hopefully, everything will be finished by then, if not I will continue working part-time on the game. I am not going to release something unfinished or not polished enough.

Update 70

A lot of profiling and refactoring have been done last week. I have also implemented some dialogs for the last level. I am trying to optimize the allocation of vectors using the function reserve. But first I have searched all over the internet to find the best free profiler. The profiler packed with visual studio 2015 seem to give the most readable result, microProfiler is also a nice one because you can profile in real time.  CodeXL doesn’t have support for intel processor and the interface is not so good.

The profiler packed with visual studio 2015 seem to give the most readable result, microProfiler is also a nice one because you can profile in real time.  CodeXL doesn’t have support for intel processor and the interface is not so good.

I am trying to optimize the text rendering in the game because sometimes when there is a shader applied the framerate drop from 60 fps to 15 fps. Maybe this is only due to the shader and I need to find a shader profiler.

For Christmas, I have received a new graphic tablet: Wacom Intuos medium pro since the small bamboo gives me wrist pain after working several hours on a piece. This tablet is better is every way possible, interface, precision, size, quality. The only downside is the price, like every other Wacom products you need to spend hundreds of dollars to have something good. I think this tablet have the best size and quality for the price since Cintiq are overpriced.

They are other brands like Huion, Ugee, Yiynova, the problem is Wacom have so many patents and years on experience on tablets it’s very difficult for new competitors to achieve the quality. Only maybe a very big corporation like Apple, Microsoft, Samsung can pull off a quality similar. And there are compatibilities problems with drivers of Wacom and other brands.

Only maybe a very big corporation like Apple, Microsoft, Samsung can pull off a quality similar. And there are compatibilities problems with drivers of Wacom and other brands. This tablet is also a best seller on amazon after the cheapest tablet of Wacom.

Update 69

The level 4 is finished, I am now working on the last level. This level is the ending of the game so it’s very short gameplay wise and they are a lot of dialogs.

Last week I have done an explosion with the particles system, this explosion has 100000 particles. At first, 100000 was too much to handle for the particle system.

After a lot of profiling, the engine I have found some interesting things:

rand() is too slow, so replace it with a xorshift generator, in the game engine I use xorshit128:

static uint32_t xor128x = 123456789;
static uint32_t xor128y = 362436069;
static uint32_t xor128z = 521288629;
static uint32_t xor128w = 88675123;
inline uint32_t xor128(void) {
	uint32_t t;
	t = xor128x ^ (xor128x << 11);
	xor128x = xor128y; 
	xor128y = xor128z; xor128z = xor128w;
	return xor128w = xor128w ^ (xor128w >> 19) ^ (t ^ (t >> 8));

Do not use std::vector to store the particles, push_back() and erase(iterator) are too slow. If you do you will see a lot CPU spent on memmove. A dynamically allocated array is way faster, only the initialization take time.

Use batching to reduce the number of draw call, with SDL_gpu the best way is to draw a lot of primitives is to use GPU_TriangleBatch. It adds a lot of code but you can’t have something faster than that.

unsigned short indices[3] = {0, 1, 2};  // These are references to the vertex array's vertices, 3 for a triangle
float values[8 * 3];  // Each vertex will need x, y, s, t, r, g, b, a (8 floats per vertex)
values[0] = x1;  // Position
values[1] = y1;
values[2] = s1;  // Texture coordinates (normalized)
values[3] = t1;
values[4] = r1;  // Color (normalized)
values[5] = g1;
values[6] = b1;
values[7] = a1;
values[8] = x2;  // Position
values[9] = y2;
values[10] = s2;  // Texture coordinates (normalized)
values[11] = t2;
values[12] = r2;  // Color (normalized)
values[13] = g2;
values[14] = b2;
values[15] = a2;
values[16] = x3;  // Position
values[17] = y3;
values[18] = s3;  // Texture coordinates (normalized)
values[19] = t3;
values[20] = r3;  // Color (normalized)
values[21] = g3;
values[22] = b3;
values[23] = a3;

GPU_TriangleBatch(image, target, 3, values, num_indices, indices, GPU_BATCH_XY_ST_RGBA);

With SDL you will need to use OpenGL VBO to achieve efficient batching.

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.