Uncovering the secrets of

indie game dev

Get all the news !

Never miss out any update.

Category: Tutorial

  • Ocean again, sound design & NPC

    Ocean again, sound design & NPC

    Hello there,

    Welcome to the April update! What’s new this month?

    Ocean Gameplay

    I’ve been working on the ocean gameplay and now, the waves have a real influence on the gameplay! The turtle can move up and down waves and I have also added the ability to jump. This makes the controls more inline with the character and feels pretty cool. Additionally, there are crates floating in the ocean that we can destroy to get bonuses.

    It wasn’t an easy task to set up, as I had to rewrite all the water detection code to make it compliant with the physics engine. So now, the water code is computed in CPU for collision and GPU for rendering, and the two versions must behave exactly the same. It was also challenging to set up real-time NON-PLANAR reflection (due to waves).

    Here’s a video of the latest version of the ocean gameplay:

    If you can’t see the video above, check it out here: https://youtu.be/_NXH5laQU-M

    Non-Playable Characters

    I have worked on a few NPCs, including 3D models, texturing, animation, and 2D avatars for dialogues. Here are a few screenshots:

    Work in progress, of course; there are still many other ones to work on.

    New Dojo Selection Screen

    I spent some time designing a more interesting dojo selection screen. One big problem in my game was that the player collected gems but without really knowing why. Now, the first time the player enters a dojo, she can get a glimpse of what’s coming up and how much it’s going to cost. This gives good motivation to collect gems (but there are other cool things to buy, of course).

    Sound Design

    I finally started to work seriously on sound design, beginning with the main character. Now, there are sounds for footsteps, jump, roll, attack, landing, slide, and climbing. There are subtle variations (pitch, volume, audio source) on each occurrence to not annoy the player on the long run.

    Communication

    I’ve entered a few more festival selections in order to showcase the game on Steam. Sadly, I had quite a few rejections (as for now, I’ve applied to 15 festivals and was only accepted to 1). It’s kind of hard for motivation, but I’ll keep applying. Luckily, what I’ve been sharing on Reddit had some great traction and feedback until now, as you can see here:

    https://www.reddit.com/r/IndieGaming/comments/128g1sq/update_of_the_ocean_big_3d_waves_geometrical_foam/

    This is cheering me up 🙂

    And yes, I try to post in English, French, and Spanish. Not that easy…

    I’ve also shared a (French) tutorial video about how I coded the translation system in my games, and you can check it out on my YouTube channel here:

    If you don’t see the video above, check it out here: https://youtu.be/CU015hL9mUk

    Fixes & Improvements

    As usual, I’m still improving puzzles, fixing bugs here and there, and reworking on code structure, factorizing, and removing useless dependencies.

    And that’s it for this month!

    As always, thanks a lot for your interest and support!

    Peace 🙂

  • A few Blender tutorials

    A few Blender tutorials

    Hello there! It’s been a while! As always, I have many new things to share with you, and not enough time to write about it!

    But one thing at a time 😀! Today I share a few Blender video tutorials I’ve made while creating Slide Animal Race. It’s the making-of of the penguin character, from scratch to the final asset. Each video is 10-15mn long and present a single stage of the creation : modeling, texturing, rigging and animation.

    A cool penguin

    The audio is in French (so you can hear my beautiful voice 🤔), but hopefully, the video process is pretty much self explanatory so it can be understood by everyone.

    So here are the 4 videos:

    I hope you’ll like it! Peace!

  • Semi-procedural foam shader

    Semi-procedural foam shader

    Hello everyone,

    It’s been a long time since I last posted a technical tutorial, so finally, here’s a new one. This one will tackle the problem of creating procedural foam for my game. I’ll try to explain my thinking process and the different choices I’ve made to create this:

    20190114_finalMixing

    The final foam rendering in my game.

    Here, I use Unity as a game engine, Blender for modeling and texturing, and Krita to paint textures.

    I – Problem

    My game takes place in an ocean-covered world, so having foam on the shores seems necessary. My biggest problem here is that my game is still being modified and island shapes may change or new islands may appear. So, I want to find a way to create foam easily and fast enough.

    Moreover, I may change the designs many times for a single island, and I don’t want to have to re-create foam meshes from scratch every time.

     

    A while ago, some friends pointed to me the Rime VFX breakdown video by Simon Trümpler. There are many incredible tricks in this one. The foam in particular is very well crafted, and the effect is stunning (as long as you go for a stylized rendering of course).

    The only problem I saw with this approach is that it is a bit daunting to create seamless uv maps for each foam mesh. Indeed, in Blender, when you want a ring/circular mesh to have a seamless mapping, you need to  perfectly align manually the uvmap so that the image repeats itself without breaking the pattern. It’s OK for a single asset, but for many unique islands and rocks in my game, it’s more than I can handle. In addition, with cyclic seamless uv mapping, if you need to tweek the wave length afterwards, you can’t scale texture coordinates as you want; you are limited to integer multiples. I have to find something else.

    20190113_scalingUV

    Process of scaling uv map to get rid of the seam. Perfectly matching both sides of the seam can be quite long for many assets.

    II – What I want

    Ideally, I aim at:

    • An easy way to create foam in Blender, with as few clicks as possible. Ideally, I would like to only handle modeling, and no uv-mapping at all.
    • Having moving waves without (too) obvious repeating pattern
    • Easy parameter tweaks in order to change wave length, speed, or look.
    • Graphically, as I use deferred shading which is not very transparency-friendly, I want a pure colored foam with some sharp edges. So I’ll use clipping based on texture values. Here’s what I’ll try to achieve:

    20190113_foamGoal2

    III – Base texture with world coordinates

    As usual, my approach is far from perfect and is only a compromise between what matters to me and what is technically reachable (to me too :p).

    My first idea was to use automatic uv coordinates, such as vertex world coordinates, which works pretty well for my procedural terrain mapping (which I might explain too one day, hopefully). However, world coordinates do not embed any kind of information about an hypothetical “privileged” direction.

    This means I can’t have a “classical” foam texture with “lines” along the shore edge like the one below, because it would be OK on some sides of an island, but not on the other sides:

    uvFoam 20190113_foamWorldCoordsUnity

    In this texture there is a strong global direction (horizontal). The corresponding ingame look with world coordinates doesn’t work.

    When I use automatic mapping, I must have some neutral/uniform texture (direction wise) for example something like this:

    uvFoamWorld 20190113_foamWorldCoordsUnityBetter

    A simple foam texture with no main direction. The corresponding ingame look  is a bit better…

    OK, this is better, but it’s still a bit stiff and disappointing, but that’s the price to pay for an automatic method. Anyways, it doesn’t seem to be enough to get visually interesting foam.

    IV – Adding procedural  waves from v coordinate

    Now, if I want some lines along the shore, or the foam moving towards (or away from) the shore, it is absolutely mandatory that I have an additional “direction” information embedded in the mesh. This is also necessary to make the foam “vanish” when it is far away from the shore. This specific direction changes for each rendered triangle, so I need to encapsulate it in a way or another on the mesh vertices.

    Thus, I guess I still need to use a basic uv mapping to specify this “shore direction”. To achieve this, I only need 1 texture coordinate, which I choose to set to v (see picture below). The idea is to have v=0 on the outer edge loop of the foam (the “sea side”), v = 1 on the middle edge loop of the foam (the “ground side”), and v = 2 for the edge loop that will be “inside” the island.

    20190113_foamVMapping2

    The basic texture mapping. Here I don’t really care about the seam problem (you can see it at the bottom of the mesh). I only work on the v coordinate.

    So the movement towards or away from the shore will be built from this simple texture coordinate. The easiest way to create the famous “foam lines” is so use a sinus of v. To make it move, I offset it depending on the current time and the wave speed.

    20190116_sinus 20190113_movingSinus

    sinus(frequency*v + speed*time) ; clipped at 0

    Keep in mind that, in order to get sharp edges, I clip any fragment value below a certain threshold.

    20190114_movingSinusLoweredThresholdChange

    Changing the clipping threshold creates larger or smaller waves

    20190114_sinusGlobalFrequencyChangePrinciple

    Changing the frequency creates more or less waves

    Now if I want the sinus foam to wash away as it enters the sea, I need to raise the sinus according to the v coordinate, like this for example:

    20190116_sinusPlusV 20190113_movingSinusLowered

    sinus(frequency*v + speed*time)+v ; clipped at a good threshold t. Waves get thinner as they vanish in the sea

    Now let’s have fun a little bit by adding noise to this initial shader, in order to make it more “natural”. As a noise-based texture, I use a simple RGB seamless noise texture that I made with GIMP using the “solid noise” generator:

    tileable2DWave

    Seamless noise made with GIMP.

    From this, I can randomize the speed, the frequency or any other parameter of the sinus. Randomizing the frequency is quite interesting; it is a way to locally add more or less wave lines like this:

    20190113_movingSinusLoweredFrequencyChange

    Adding (world) noise to frequency: sinus((frequency+noise(xz))*v + speed*time)+v; where xz are the world horizontal coordinates. See how some zones get more foam lines, while other zones get fewer.

    The generated sinus part seems to work quite OK, but I think it still misses some “connections” betweens the foam lines, and, to add them, I need to rely on world coordinates. I could use world noise to add these connections, but I wanted to try a more controled approach by using my handmade texture on top of it.

    20190114_movingSinusLoweredPlusBaseTex

    Mixing the sinus procedural waves and the hand painted texture.

    But if I use a pure binary texture for foam connection on top of the generated sinus waves, I have no control at all on the “vanishing” of this texture. That’s why I chose to use a distance transform texture.

    V – Distance transform textures

    Distance transform images are created from a pure black or white base pattern. Each pixel of the distance transform image represents the distance to the nearest white pixel in the base pattern, like this:

    20190114_distanceTransformExplained

    Well, actually, I used an inverted distance transform here, because it’s more convenient for the clipping phase, but you get the idea 😉 And yes, I used a different pattern than the previous one.

    Distance transform images are just a way of seeing the data. You might also interpret it as a height map (even if the meaning is slightly different, it might help to grasp the concept). The basic idea is to have an image that embeds some kind of “evolution/animation” of the base pattern.

    Distance transform images may be generated through filters, but generally, these filters don’t handle very well (or even not at all) seamless images. Another way is to paint some pseudo distance transform image directly. Of course, it won’t be mathematically accurate, but as a benefit, we can create more custom animation patterns. An acceptable way I found, is to use the unusual following settings in Krita, (the painting software I use):

    • Use a “Build-up” painting mode (vs Wash by default), so that you can intersect the current stroke properly
    • Use the “Greater” brush fusion mode, so that only higher values will be drawn on top of what is already drawn (which is the correct way that real distance transform images are merged together)
    • Use a soft brush with a linear falloff from 100% to 0%, so that the maximum value range is used, which will result in smoother animations. Actually, the falloff will act as an “ease in/ease out” parameter for the animation.
    • No pressure sensitivity (well, I guess this is personal choice)
    • Activate the “Wrap Around” mode to create seamless textures (as I paint a lot of textures, this is my favorite option in Krita).

    which results in this:

    20190114_drawingDistanceTransform

    Directly painting a seamless distance transform texture. Notice the “X” pattern appearing on the intersection, this is typical of a distance transform image.

     

    Of course, this is a very “mathematical” way of approaching this idea. You can always draw with the default soft brush and get something totally OK (even more natural I think), but you have to always keep in mind that you are “painting an animation” (never thought I would say that one day).

    VI – Tweaking and mixing

    Now, I have more control on the rendering of my hand painted foam texture:

    20190114_movingFoamThreshold2

    tex(xz); clipped at a certain threshold t; Now I can control the width of the pattern by changing the clipping threshold for my hand painted foam texture.

    Of course, I used a few tricks to make it more interesting:

    • Adding the v coordinate (to make foam larger near the shore and thinner on the seaside), just like for the sinus waves
    • A speed parameter texSpeed to make the texture move slowly
    • A bit of world coordinate moving noise to create some “warping” effect

    20190114_finalHandMadeFoam

    tex(xz + noise(xz+noiseSpeed*time)+texSpeed*time)+v; clipped at t

    And, now, I can finally mix both the procedural sinus waves, and my hand drawn foam. After a few tweaks on threshold, speeds, noises, and other parameters, I ended up with this:

    20190114_finalMixing

    The final result mixing procedural and hand drawn foam:
    ratioSinus * [sinus((frequency+noise(xz))*v + speed*time)+v] +
    ratioTex * [tex(xz + noise(xz+noiseSpeed*time)+texSpeed*time)+v];
    clipped
    at t.

    In the end, I also added a few parameters to control the noise amplitudes and scales/frequencies, so each noise(xz…) is in reality noiseAmplitude*noise(noiseScale*xz…). This gives more control on all the deformations happening. I also replaced the simple “+v” with the more versatile affine fonction “+a*v+b“.

    VII – Building in Blender

    So in the end, I still have to make a uv mapping (or more exactly a v mapping). But the good news about this is that I only have to make it ONCE for ALL the game. Indeed, for any new island (or any immersed object), I can copy a base foam mesh already v mapped, and I can focus on modifying only the mesh:

    • If I move vertices, the mapping will still be OK.
    • If I delete an edge line, the neighbour v mapping won’t be affected
    • If I add vertices with a loop cut, the uv mapping for the new vertices will be automatically interpolated from their neighbours, resulting in a good v coordinate.

    This would not have been the case if I had used the u coordinate to make more classical texture mapping, because any  move of vertices along the shore edge would have stretched the texture (and I would have had the seam problem for each new island).

    VIII – Going further

    We could go even further by working on the following points:

    • Layering two or more hand painted foam textures, with different speeds and scales to create a unique pattern everywhere.
    • Randomizing the sinus speed to have local flow variations
    • Adding noise to the threshold or to the affine function part (“+v“/”+a*v+b“) so that some zones would have foam on a very short or very long distance
    • Randomizing the world coordinates to create even more warping effect
    • Put the time offset through a sinus to make waves come and go. Right now they only go away from the shore.

    By the way, I didn’t speak at all about optimization here, and there is surely some work to do about it (especially on noise textures that could fit on fewer channels than a full RGB image).

    Anyways, this was a nice journey to me, and even if the result is not super awesome, I really enjoyed the process of mixing a bit of maths with more arty considerations. I hope this will help somebody out there!

    Thanks for reading!

    Peace!

     

  • Creating a seamless hand painted stone texture

    Creating a seamless hand painted stone texture

    Hello there,

    Finally, I take the time to share another little tutorial. Here is my process to create a seamless hand painted texture for my game.
    I hope you’ll find it interesting!

     

     

    Peace!

  • Grass & Vegetation

    Grass & Vegetation

    Hello everybody,

    Recently I tried to visually upgrade the demo in order to achieve a better look for the game. I put some effort on rendering grass and vegetation, so this post will explain my approach.

    20170810_121404

    A glimpse at the new grass system!

     

    I – The unity grass system

    First of all, I considered using the Unity terrain and grass engine. But this raises 2 problems:

    First, I use very complex terrains in my game, with “flying” islands, holes, caves, bridges and other non convex shapes. Unity uses only “height map” terrains, which can’t easily generate grass on everyside of a flying island for example.

    Second, the Unity grass system is designed to display grass on huge terrains. Thus a lot of grass batching is dynamic, resulting in quite some draw calls, which severely slows down my game.

    That’s why I chose to design my own vegetation system.

     

    II – The new vegetation system

    The idea behind this new vegetation system is to be able to easily create grass fields in a few clicks, and with enough control over the artistic part. I use Blender as a my level design tool (among others), so I must be able to export the grass settings to Unity via the FBX format. I want something not too heavy filewise and quite adaptative to suit all the use cases I will face (vertical vegetation on walls, or moss below flying islands). Here’s what I ended up with:

    In Blender

    Because of the above reasons, I choose to use vertex colors on hand made meshes. This allows me to create custom meshes only where I want to put vegetation. Moreover, I can use the 3 color channels to create 3 different types of vegetation on a single mesh. To paint easily on each channel, I use the “Add” and “Sub” brushes with pure red, green or blue colors.

    Of course, I use a special name for the mesh with specific conventions to tell Unity which kind of vegetation I want.

    I can overlay many meshes on top of each other, so there is virtually no limit to the number of vegetation types I can handle.

    20170816_vertexColorGrass

    Here’s the vertex-painted grass mesh in Blender. For this mesh I use grass in red, moss in green and some kind of falling lianas in blue.

    Of course, it might be difficult to “paint” grass without actually seeing it in Blender (grass will be generated later in Unity). This is the price to pay to have light-weight file exports. But eventually, I got used to it.

    20170816_vertexColorRocks

    If I don’t want grass everywhere, I can only set up a small mesh on the specific area I want to cover. This is very cheap with regard to the export file size.

     

    In Unity

    Then when I import the level in Unity, my level importer scripts generate vegetation with density depending on the vertex color of the custom mesh. Each grass element is generated from a prefab. The prefab is automatically snapped and rotated accordingly on the first underlying viable surface. Of course, defining a “viable” surface is not as simple as that (I have to test the kind/type of surface), but you get the idea.

    20170810_154114

    Sometimes, auto snapping of grass creates weird results (grass on the sign, which is pretty cool, but not intended). So I had to add additionnal specific rules regarding the snapping process to avoid this kind of things, or, at least, explicitly tolerate them.

    I also added a randomizing step, which enabled me to change rotation, or scale or whatever suits me on each prefab, thus creating variation.

    20170810_174518

    A screenshot showing the 3 types of vegetation: grass on the foreground, moss on the vertical walls, and falling lianas below the floating islands.

    20170811_102213

    Another screenshot of the Thief Guild island with grass.

    Then, once all prefabs on all meshes are generated, I merge them by material. I pack everything in meshes with ~65000 vertices which is the limit Unity can handle. Of course, this creates several batched meshes (usually around 50, I guess I could go higher) but this drastically lowers the number of drawcalls.

    III – Pros & Cons

    As usual, this approach has good and bad sides:

    Statically batching all grass meshes comes at the expense of not being able to dynamically show/hide the grass depending on the distance because everything is batched with no particular order or region computation. Thus every grass blade on an island is visible from any point on this island. As the islands in my game are quite small, this seems OK, at least for now. In the future, shall I need to optimize more, I think I could add some octree structure to pack grass by region, and/or use some kind of intelligent shader that would clip very far away geometry.

    But, batching grass with a total random order has an advantage: I can choose to activate only half of the batched vegetation meshes, and this will divide the density by 2 everywhere. As displaying grass is still a GPU intensive task, it is quite useful to be able to dynamically lower the density to make the game run on smaller material configurations.

    Another good thing is that, as grass is generated automatically via prefabs, this vegetation system can actually handle all prefabs in general, not necessarily vegetation; rocks for example. Thus, I should call this a “detail” system.

    20170816_222620

    A few rocks generated with this new detail generation system.

    Another advantage is that I can also manually place the grass prefab if I want. It will still benefit from the batching system. So I can use this “automatic generation system” for wide areas, and I can manually place detail on smaller or very specific areas if I want to.

     

    20170816_232045

    I can still manually place grass tufts if I want to (on rocks here).

    20170816_231738

    A simple cave with lots of lianas…

    IV – Performances

    At the moment, I can display 80 000 vegetation elements at a decent frame rate (~ 30 fps) on a medium configuration. Of course, it depends a lot on the number of polygons of each grass prefab. So each detail prefab must be very carefully modeled.

    And because I already coded specific vegetation shaders, I still use them with this new generative system. So grass still reacts to the wind and to player moves.

    20170810_180233

    So that’s all for today! I hope it wasn’t too technical. This system is still quite new, so I hope to tweak it in the next months to make it more efficient, or more adapted to my problems.

    See you!

    Peace!

     

  • The new Save System

    The new Save System

    Once again, it’s been a long time since the last post. But I’ve been working on many things lately, including (but not limited to):

    • the integration of the new UI of unity for the HUD (= Head Up Display = the information that is displayed in Play Mode), the Link Menu and the World Map. Graphically, this is not very different from what was already there but it should allow much more visual animations and fancy stuff in the future.
    • the possibility to control the UI with the joypad and the keyboard/mouse combo (including the mouse wheel). Not perfect yet, but quite OK.
    • some polish, on Zephyr Island mainly
    • and a new saving system… which is what I’m going to discuss today !

    Beware, this post is quite long and a bit technical!

    I – A new saving system? Why? What’s the point?

    The goal of setting up a new save system is to get rid of the old-school “save points” where the player must save at specific places and times. This breaks the flow of the game, and furthermore, the player might forget to save and then might lose its progression within the game, which could be very annoying.
    Until now, it was this kind of system that was set up, mainly because it was easier to design and I didn’t really have the time to propose something else.

    But, nowadays, in recent videogames, saves are really almost automatic, and the player might not even notice that the game is saving (very often a little icon appears in a corner of the screen to tell you that the game is being saved). This is what I want for my game, but it rises many questions about design, software architecture and real-time performances.

    20170419_214508

    The little gear icon on the lower left corner indicates that the game is being saved.

    II – How should it work?

    Usually, before coding stuff, I try to think about how it should work in different cases (this is more or less a “use-case” approach). Here are a few important points:

    • the player starts a new game. What should happen? Ideally, I would like to ask him for a pseudo/nickname/id, and then save the game using this information. For now, I don’t ask him anything, I just create a new slot (based on day and time) and use it to save the game (because I don’t have time to make something better than this, but it should be corrected in the future)
    • the player is in the game. The game should be regularly saved on the current slot. The thing is, there is not necessarily a current slot. “WHAT?” might you ask. Indeed, a new slot is created for each “new game” launched. But when *I* test the game, I don’t test it from the start EVERY TIME. Generally, I run a level with some modified variables about “where and when” I am in the world and in the story and I test it. This means I don’t have a specific slot associated with my test. Then where should I save? Should I save? Can I save? What if I want to test the save system?
    • the player wants to load a game. I should list all the previously saved games with various info about each slot: what level was it? how many items did the player have? How many quests were finished? Maybe a screenshot to remind the player of the place? Surely the pseudo/id of the player etc…

    Of course, every time I’m saving the game, I don’t want the player to notice any lag in the game. But, sadly, when working with files on a hard drive, things happen quite slowly (in comparison, say, to how many frames a graphic card can handle per seconds). Therefore, I must use threads so that the saved game can be written on the disk “in the background” while the game still runs smoothly (hopefully).

    III – How to make it work?

    1 – the basic class

    Until now, I had a simple class/structure mainly based on .NET dictionaries to save every important aspects of the game:

    • the player info: life, items, ammo, location, state, …
    • the collectibles and quest info: what has been done or asked, what has been collected, how many times, where…
    • the gameplay mechanics info: which door is open, which switch has been connected to what, location of moving platforms, …
    • the enemies info: location, state, …
    • npc and dialog info: what has been said to who, basically
    • world info: current level, day time, played time, …

    The idea was to NOT save the whole state of the game, but rather what is TRULY necessary to reload the game, which should result in light-weight saves, and fastest loading times.

    Of course, all this info must be accessible from anywhere at anytime, that’s why I use some kind of Singleton class to store them (well it’s not that simple, but that’s the basic idea).

    2 – The higher level structure

    So, now that that we know WHAT I should save, let’s see HOW I can save it. To answer all the problems and objectives listed in II, I chose to have:

    • LEVEL 0 saves, that is to say, saved files on the HARD drive
    • LEVEL 1 saves, that are the cloned versions of the HARD drive, but in RAM (ie variables in the code)
    • a unique LEVEL 2 save, which is the save currently modified by all the objects in the game, in RAM of course.

    The idea is to have many layers of saved games, each one communicating ONLY with the layers immediately above or below, depending on their main purpose and on their speed.

    The real-time game engine always works with the LEVEL 2 save. This one is unique. From time to time, and when conditions are OK (the player is not fighting, he’s in a safe zone, he’s not in a “save forbidden zone”, …), I make a full copy into one of the current LEVEL 1 slots. And then, if the game is not already writing on the disk, and conditions are OK (last save has been done more than X minutes ago), I copy the LEVEL 1 save data on a file on the disk (LEVEL 0). The data is saved on the disk via basic .NET binary serializers.

    Of course, to copy data into LEVEL 1 and LEVEL 0 slots, I must know which slot to copy to; By default, there are no current slots. In this case, no copy is done. If the player has started a new game, a new slot is created and it will be considered as the current one. If the player has loaded a game, this slot is now the current one. And if I’m in test mode, I can create a new slot at anytime with a magic hidden key, and from then, this slot will be the current one. This seems to answer all the cases I previously thought of in II.

    A few additional info:

    • The LEVEL 2 save is the one that is constantly read and written from all the objects during the game; so that any object can know if a dialog has been said, if a quest has been completed, or if an item has been unlocked. It’s fast to read and to write on it: it’s a (not that) simple variable in the RAM. It’s the up-to-date information.
    • LEVEL 1 saves are some kind of stencil saves between the hard drive ones (LEVEL 0) and the living one (LEVEL 2). They are a copy of the LEVEL 2 save that I make from time to time. It’s mainly useful because saving on the hard drive is SLOW. This means that I might be saving on the hard drive WHILE the game (that is still running) is modifying the saved data which creates a concurrent access. This is absolutely forbidden if I want to keep the data integrity! If I don’t have this “middle ground” save data, I might totally break the game state in the game and also on the drive… thus… LEVEL 1 saves.
    • LEVEL 0 saves are files on the disk. They are written from or read into the LEVEL 1 save buffer, and it might last many frames.

    Of course, with this system, it’s also possible to save at specific points (when the player quits, finishes a quest, opens a menu, etc..). It’s quite permissive actually.

    3 – What about loading?

    For now, I’ve only talked about the saving process here, because it’s the most complicated one. The loading process is quite straight-forward; it consists in reading all the LEVEL 0 slots on the hard drive and populating the LEVEL 1 slots with the data during the game launch. When the player loads a slot, I copy the LEVEL 1 data to the LEVEL 2 data and load the corresponding level in Unity.

    You might wonder if this is not too heavy in memory, but each save slot should be only a few 10 000 entries of string data. With a quick computation, this results in a few 100 KB in memory for each save. My biggest tests with hard drive data size led me to maximum 2 MB, which is quite OK I think.

    20170419_211708

    The new loading screen. Basic, but functional.

    4 – Performances

    You might have already spotted it, the writing on the hard drive is slow. So copying LEVEL 1 saves to LEVEL 0 is slow. But that’s OK, because I designed it as a threaded process and it doesn’t freeze the game. During this process, I display the little “gears” icon in the lower left corner on the screen to tell the player that the game is being saved. At the beginning of the game you will barely notice it, because it’s really fast (and there’s almost nothing to save). However, Unity is not thread safe, which means I can’t access any Transform or MonoBehavior info. So I had to carefully design saved data to avoid using unity types and functions.

    But another problem is copying data from LEVEL 2 to LEVEL 1: this MUST be a DEEP copy of the data, because otherwise, we could still have the same problem of concurrent access (due to the class type of many C# variables; this is pretty not intuitive to grasp so don’t hesitate to google it if you want to learn more about it). Sadly, deep copies are slow, and these ones can’t be threaded (well at least not very easily) because I copy from the LEVEL 2 data which is “alive”! It starts to get noticeable around 20 000 entries for my dictionaries, which might be OK for the whole game, but I’m not sure yet. I have to do additional tests.

    However, if the future tests reveal that this LEVEL 2 to LEVEL 1 copy is too slow, I might have another workaround in mind, which I won’t detail here because this article is already too long.

    IV – So what now?

    So now, I hope you have a good overview of the saving system in my game. I know it’s not perfect, and I know it will break the game during the near future because it hasn’t been tested enough, but it’s really nice to be able NOT to think about it when you play. The experience is much more immersive.

    A few potential problems are still there:

    • the saves are not clearly identified, so it is difficult to find yours if there are many ones, but I hope I’ll fix this soon (even if this means coding a full virtual keyboard for people playing with a joypad…)
    • I don’t have screenshots of the saved games (whereas I had them in the previous versions) because I changed the save system… Previously, I took a screenshot one frame before opening the save menu which caused a micro lag that was NOT visible because the menu appeared right after it. But now I constantly save the game and a micro freeze is awfully noticeable when you are freely running in the game. This is quite annoying, and the solution is not that easy; I might have to redesign the whole rendering pipeline to render the final image into readable texture so that I can access it at anytime, but even there, there might be some lagging, due to the copying of the image data. Plus the encoding itself might be slow.
    • I would like to add some LEVEL -1 saves, which would be some hard drive backup of the previous save. Why? Because this save system is quite new, and I’m pretty sure some player will meet cases where the system breaks the saves and they will lose their last game. A workaround is to make backup copies regularly, so that they won’t lose the whole game.

    So finally, I have quite an operational new saving system for the upcoming Toulouse Game Show this week end, which was my main objective. By the way, don’t hesitate to come and meet me there if you want!

    I hope this article was not too heavy or technical or boring, but … I doubt it 🙂 Hopefully it might help somebody out there.

    See you 🙂

  • Fallen Gods

    Fallen Gods

    The painting of the week! Yeah, I know it’s been a while since I last posted the painting of the week 😉 I guess it’s not exactly the painting of the week anymore…

    20161023_fallenGods

    20161023_fallenGodsMakingOf

    As usual, the super HD making of is available on my deviant art: http://matou31.deviantart.com/art/Fallen-Gods-Making-of-664251326

    Peace!

  • Leo

    Leo

    Hello there,

    here’s a little fan art / study of Leonardo, from the recent Teenage Mutant Ninja Turtle movies.

    20161004_leo

    20160410_leomakingof

    You can check out the HD version of the making-of on my deviant art account here: http://matou31.deviantart.com/art/Leo-Making-of-647712698

  • My talk at the Blender Conf

    My talk at the Blender Conf

    Hello,

    my talk at the Blender Conf about “Blender in a video game production pipeline” is online:

     

    Here’s the direct link if you don’t see the video above: https://youtu.be/I2vIXR5UizE?list=PLa1F2ddGya_8FBk61qbCdRu-otyPzFfDF

    You can now listen to my awesome French accent 🙂 And don’t hesitate to tell me what you think about it in the comments.

  • Sand Tower

    Sand Tower

    The painting of the day! This time I tried to mix 3D mock up (in Blender) with 2D over painting (in Krita). So here’s the Sand Tower!

    20160831_sandtower

    20160831_sandtowermakingof

  • The Crow Fortress

    The Crow Fortress

    Here’s the painting of the week. With a darker atmosphere than usual.

    20160828_crowfortress

    20160828_crowfortressmakingof

  • City Hunter

    City Hunter

    Hi there! Here’s a little study to practice ink lines. And mangas are very good at that.

    cityHunter7

     

    20160615_cityHunterMakingOf

  • Forest Temple

    Forest Temple

    20160607_forestTemple

     

    The painting of the week…
     

    20160606_forestTempleMakingOf

  • Jungle Falls

    Jungle Falls

    20160531_jungleFalls

    Here’s another painting, to keep practicing. Making-of:

    jungleFallsMakingOf

     

  • Snow Leopard

    Snow Leopard

    Hi there!

    Here’s another animal study and the making-of video. Don’t worry, I still work on the game, and the chapter 4 is now playable at 60%.

    20160518_leopard

  • Harfang

    Harfang

    Here’s a sutdy of an Harfang owl.

    harfangFinal

    HD Making-of: http://matou31.deviantart.com/art/Harfang-Making-of-614397022

  • Leopard Timelapse

    Leopard Timelapse

    Hello,

    Today I share an old painting timelapse. I think I’ll try to share graphical stuff more often. This is just drawing/painting practice and it has nothing to do with my video game, except this is a regular exercice I try to do to improve my art skills. I hope you’ll like it. Maybe you can find something interesting in my workflow!

     

  • Mushroom – Timelapse

    Mushroom – Timelapse

    Hi there!

    It’s been a while since I last made a recorded session of 3D asset creation, so here’s a video of me creating a simple 3D mushroom model for the game, with Blender and Krita.

    I hope you like it!

  • Cloud… Step by Step

    Cloud… Step by Step

    For once, here’s an illustration tutorial! It’s a bit old, but it might be of interest: so here’s Cloud, Final Fantasy 7 main character, with the step-by-step of the painting.

    2013_01_13_Cloud

    2013_01_13_CloudWIP

  • Explosive Plant – Timelapse

    Explosive Plant – Timelapse

    Hello everybody,

    Here’s another timelapse video of me creating some kind of explosive plant for “A Thief Melody”. I used Krita and Blender.

     

  • Wooden crate – Timelapse

    Wooden crate – Timelapse

    Hello there,

    It’s been a a while 🙂 It’s always difficult to keep posting regularly. So, today, here’s a timelapse of me creating a wooden crate for the game. This gives a good idea of how I work to create all the 3D art in my game.

     

  • Some kind of pirate

    Some kind of pirate

    Hello everybody, I’ve been trying to create a first character lately (at least a character with a real appearance, and finest animations). There’s still a lot of work but here it is:

    He’s some kind of big tough guy with a “Mom” tattoo. He doesn’t have a lot of “pirate” accessories (hat,  weapons, bird, …) so one cannot really tell if he’s a pirate or a sailor or just a badass, but this will be added in game. I also worked on various animations (walk, run, fall asleep, …). It’s really difficult to achieve something perfect, so at one point you have to stop even if you’re not fully satisfied.

    For curious people, I posted a tutorial on how I created this guy on deviant art here: http://matou31.deviantart.com/art/Cartoon-pirate-tutorial-373913542

    I worked a lot on this one, especially trying to find a graphical style that suits both my skills and the kind of universe I want to create. I think I worked on this one for a few days. But, if I had to create it from scratch now, knowing precisely what I want to achieve, it wouldn’t be that long. The real difficulty is finding the final look, not actually creating it. By the way, he may evolve a little bit, but I think characters will likely be based on simple colors and cartoonish shapes. It’s much easier to do given the time I have. For those who know, I aim at something like “Zelda Windwaker” graphical style, at least for characters.

    You may notice that the first character I fully work on is not the player. This is because I’m not quite sure yet about the look I want for him. Of course I have many studies, but none is really OK at the moment. And furthermore, the player will always be on a screen, so I think I’ll wait a bit to have better skills in animating/modeling to create the player.

    In addition to this first character, I also worked on a way to create levels in Blender that I can finely import in Unity. At the moment, I can fully model a level in blender and add logical items to it (ennemy, main character, path point) and I can get it in Unity with a little transformation script.

    The level in Blender, with logical entities: red ones are “ennemies”, yellow ones are path points.
     
    I export all this in an FBX file, and, in Unity, I run a script to replace all logical entities, based on naming conventions (not very pro, but truely efficient). Maybe I’ll talk more on this later, because the editor/conversion scripts are still in development.
    The in-game level. Every logical entity has been converted to the real mesh/texture/game object.
    This enables me to quickly create a level prototype in Blender as I’m very familiar with its graphical interface. This way, I can test a level and see if it’s fun, or too easy, or too hard, and check that it can be finished. Or course, at the moment, my levels are graphically very poor, but decoration will come later. Functionnality first!
    Okay, that’s all for today. I’ll try to post a demo by the end of the week with -hopefully- tutorials in it, as I had requests about these.
    See you!
  • Dragon brushes in GIMP

    Dragon brushes in GIMP

    Hello guys,

    Today, I will show you how to create animated brushes in GIMP 2.8, and this post will also be a useful reminder for me :). I will propose Dragon brushes because dragons are cool, and everybody likes them. The philosophy behind using brushes is not to make the whole painting with them, but rather have a good idea of the final render without spending too much time on it. It is also used to add sparse textures.

    First of all, I must link to this video who greatly helped me in designing those brushes. So thanks a lot to M. Remko Troost for his nice video.

     

    I – Download

    You can download the dragon brush pack here.
    It contains:

    • 1 skin brush
    • 2 simple scale brushes
    • 1 horn brush

    Feel free to use them in your work. Credits are appreciated but not mandatory. Here after I explain how you can create (improve? 😉 ) and use these brushes.

    II – Creating an animated brush

    • First of all, create a new grayscale (in the advance parameters) square image if you want a classic “transparent” brush (actually, color brushes are not that useful). Use a white background (= full transparent brush). Don’t make it too big, something like 200x200px is quite good.
    • Start painting some scales in black. Generally lizard/reptile skin is made of geometric patterns (squares, pentagon, N-gons) well intricated together and separated by little creases.
    • Create another layer and paint anoter type of scales. You can use as many layers as you want to create variations.

    The goal is to use those 2 layers randomly in order to create irregularity in the skin.

    III – Saving the brush correctly

    • Save the brush using the GIMP animated brush format: .gih. Save the file in the .gimp-2.8/brushes folder (in your home folder).
      • Use a spacing of 50-75 depending on how much you covered the image surface
      • Number of cells should be your number of layers (2 for me)
      • Dimension is 1 as the brush will only depend on 1 parameter (random only here, no angle track or whatever)
      • Ranks is 2 – Random, which means that random will be used to choose between the first 2 layers
    • Now you can reload the brushes in the brush panel. Be aware that the “reload” button doesn’t seem to work very well. I think it only loads new brushes, not modified ones. So if you want to tweak/modify an existing brush, you have to suppress the file, and then create it again. Be warned that if you already have a lot of brushes, it may be difficult to find the new one in the list!

    IV – Going further using dynamics

    You can now use this brush in GIMP. But GIMP 2.8 provides another option to influence brush behaviour: Dynamics. It can control how speed, orientation, pressure (for graphic tablet users) and much more parameters affect the brush (in rotation, size, opacity…). For example, to add a random rotation, you can use the existing dynamics “Basic Simple” or “Pencil Shader” for example, or create your own.

    Some dynamics are quite useful, especially the ones that follow the direction of the movement to align a brush, for example “Speed Size Opacity”, or even “Track Direction” if you don’t want to use pressure. But if you plan to use them, you have to well design the underlying brush.

    And thus, if you want to create an “oriented” brush, you have to know that the “direction” needs to be horizontal towards the right-hand side when you create the brush. Here is a “horn” brush:

    A horn brush oriented towards the right-hand side

    When used in a drawing in combination with other brushes you can quickly create a basic design:

    A very quick design of a dragon

    Or you can use them in a final render just like the first image of this post.

  • 2D image deformation in Blender

    2D image deformation in Blender

    Hello everybody,

    Today I will introduce a fairly tortuous way to locally deform 2D images using… Blender. Here’s what we’re going to do:

     Notice the deformation of the web center

    OK, But why not in GIMP ?

    I recently wanted to apply a lattice correction on a simple 2D image in GIMP (to correct perspective and bad proportions on a drawing)… but GIMP is seriously missing a good and real-time lattice (or FFD=Free Form Deformation) transformation like the one in photoshop (Warp Tool) for example.

    Of course there is the cage grid tool and the interactive “I-Warp” filter. But, the cage grid tool doesn’t handle well the connections between the selected zone and the rest of the drawing. The I-Warp doesn’t provide a good zoom level and is quite laggy, at least on my PC, and there’s no undo function… So here’s a little work around.

    Be aware that this method is not straight-forward and requires a minimum of setup in blender, but it can handle large-scale smooth deformations in real-time, with various levels of zoom, and undo function. It can save you hours of work on a drawing where you missed a perspective default…

    I – Setting up the image plane and material

    • Launch Blender
    • Suppress the default cube
    • In file -> User preferences  -> Addons -> Import/Export, activate the “Import images as planes” addon
    • Import the image you want to modify, don’t forget to activate the following options: shadeless, use alpha, premultiply
    • In 3D view, in top view, activate the texture render mode. You should see your image on the plane
    Plane with the base image to modify

     II – Setting up the camera

    The goal is to make a render with the same size as your original image

    • Set the rendering resolution to the same size as your image. For example 1600×900 px. Choose RGBA if you want to handle a transparent image.
    • Position the camera right above the plan, let’s say at (0,0,2), facing -Z (rotations = 0)
    • Use an orthographic projection.
    • Select a vertical sensor fit of the camera. Choose an orthographic scale of 2 (this is the Y size of the textured plane created by the import)

    Now the camera field of view should fit exactly your image with the good ratio and the render will generate an image with the same size.

    Camera well-aligned with the plane

    III – Finally deforming the image

    • Select your plane, and in edit mode subdivise it many times. This will create the lattice used to deform the image. Be careful! Do not use too many divisions or it will slow down your computer
    • Turn on proportionnal editing and move vertices of the lattice to locally deform your image! Use the mouse wheel to control the deformation radius. You can benefit from Blender real-time texture rendering, 3D zoom/move and undo options.
    Subdivising the plane

     

    Proportional editing to locally deform the image

    Once you’re done, render and save your modified picture! That’s it!