Game Dev



I’ve been working on several things these days. But the most boring one is REFACTORING… Since I keep on adding stuffs here and there, I can’t help noticing some codes don’t do the job anymore.
Right now I’m refactoring my Action serialization due to the bones ┬áI added. Before, the actions were saved in the object itself. Now, I can save it separatly based on bones IDs. It’ll make my animations usable for different objects (if their bone IDs match). This is something I can’t really put on my planning. Will I be able to finish this engine one day ? Of course. Don’t ask when, though. ­čÖé

I started to integrate an other engine for FX : Mercury. Yeah, after working with Krypton I realized it’s better to rely on some external tools if I wish to complete my project in this life.

Here comes a little video about how Krypton lights can be added/edited in my engine. I tried to show other simple stuffs since it’s my first video. But I’ll try to do some more videos to show collisions, animations, state machines and so on when I’m done with animation refactoring and FX integration.

Sorry for the low quality… I added some rotating objects at the end of the video but I just noticed when I “Run” the scene it looks like a glitch due to the low FPS of the video and the default rotating speed I put (quite fast). I picked the worst compression ever to be able to host it on Youtube quickly, I’ll be careful next time. By the way, 4:05 is the best part of the video.

Game Dev

WIP 2 : State Machine

Hey there,

Did I say I’ll comment my engine status monday ? Today is monday, huh ?

Actually it’s hard to work with a real planning, since I’m working on my project only during my spare time. But still, I’m doing my best.

I’ve been working on my “state ┬ámachine” editor during the whole month. ┬áSince it’s not something I wanted to create at the beginning (I mean when I started the engine), I delayed the whole remaining work… ­čśŽ
And it took so much time… But still, I hope it was worth it.

My State Machine Editor is based on some architecture I was used to seeing while working in the game industry. The difference are : it’s graphic, and you can update it after compilation time. Instead of explaining the whole thing, I’ll put some examples :

First, every object┬á“script” (such as characters, interactive objects etc.) may have one or several Action Bank(s). Here is an example of a player’s Action Bank :

The Action Bank defines what animation the script can use. Then, we create the state machine to trigger one or another…

Here is a simple state. The one called “State_Idle”. It just plays a looping animation (rank=0 in Action Bank). The first list box contains the list of the states (with their id). The second list box contains the list of “next possible states” (green states are the one you can trigger from the current state). Then, in this example you can’t go from “State_Idle” to “State_Dash”, but you can go to “State_Walk”, “State_Jump”, “State_Run”.

As you noticed there are two distinct branches in a same state. The yellow branch is the one I call “PreState” or “StateEnter”. This is the condition to enter in the state. The idle example could have “If no input is pressed etc.” in its yellow branch.
For each state in green (in the second list box) we execute the “PreState” (every frame).

The blue branch is what I call “StateUpdate”. That’s what is done if the state is the current one. Here is another example :

Since the “State_Walk” is one of the possible next state of ┬á“State_Idle”, we will execute the “PreState” (yellow branch) every frame. Pressing Left or Right will push the “State_Walk” (means it’ll be the current state), then, its “StateUpdate” (blue branch) will be the one executed. The method “PopState()” changes the current state to the default one (the first in the top list box : State_Idle). By the way I did a mistake here… In the list of “Next possible states” of the State_Walk, the ┬áState_Jump isn’t green, which means while walking you can’t jump.
Using only these two states, the player can move forward and backward. WAAAOOUH !! That’s awesome ! I know for sure it is. But since every “block” is a simple method invocation and conditions are fields/properties or function results comparisons, I can actually trigger every methods on the class holding the state machine (depends on the object) using different conditions, which means I can do tones of things, from AI movements to events management. In addition, you may have noticed in the previous example a state called “Gravity”. Actually it just contains a “PreState” :

Then, every state in which the “Gravity” is enabled will allow this “PreState” to be executed every frame.

I tried it to make a character move and jump. It’s working fine. But I didn’t do the serialization part yet… lol. So, yeah, every time I start my engine, I need to recreate the State Machine. Yeah, it’s easier and cleaner than coding it, but if it’s not saved it’s kind of useless… Need some tiiiime.

I’m also adding a light engine to my project. At first I thought I could make it on my own, but it’s a pain in the ass, man (I managed to get shadows on convex polygons, but if I want something cool and porwerfull, I’ll need looots of time)… Krypton is an awesome Light Engine. I tried it and started to integrate it in my engine as an external tool. Now I can create “Light objects”. I just need to make my colision maps compatible with Krypton and then, I should enjoy the lightning. Piece of a cake.

Once I’m done with the serialization and Krypton integration, I’ll work on a little demo showing different things (with no fx nor sound).