Game Dev

First try

Well, it’s time to do some real testing now !!

I tried few things in one little level… I’d better warn you it’s not awesome, but I did it without adding a single line of code ! I just used state machines to check inputs, trigger actions, enable gravity and so on. And I think this is the cool part cause anybody could do that (even without programming skills I mean).

I did the whole thing quickly so I didn’t pay attention to gameplay (running speed is too fast, dash move is a bit weird, gravity is too high etc.), but I could tune it easily.

I found some nice sprites of Zero (you know, the character from Megaman / Rockman !). This version is from “SNK Vs Capcom”. I used it as a placeholder for the player.

In this video, you will see (there are some things I mentioned in previous posts but never showed by the way) :
– “Ghosts” for movements
– Layers : several layers with different speed.. It’s maybe too fast, but you’ll get the idea.
– Animations
– Collisions (red polygons show the collison maps. By  the way I noticed I used rectangles only, but it could be other convex or even concave polygons)
– Events (once the player reached the zone, it triggers dialog box and shader distortion)
– Shader (the distortion I added last week) -> I coded this shader before even starting my engine actually (I’ve been waiting a whole year !!)

I still have some things to do to improve collisions and I think I should add a tool to create collision maps directly in the level editor… Right now when you create a new static object you can draw a colmap for it (then it’s used for every instances of the same object). I should be able to draw something for the whole ground too. It’ll be useful and will spare some collision calculation.

I didn’t use sound nor Fx (I could… while running, jumping, and so on). It’s lame. Next time, for sure.

Here comes the Level Event Manager I did for this level :

1. I’m playing FX in loop on the event zone (the one at the end of the level ! Check the pic. on the left) while the player is not detected;
2. Once the player is there, I launch the distortion shader (I added it to a shaders bank I created and its rank is 0);
3. I change the state of the player (I created a state in which there’s no action nor move allowed);
4. I start the dialog !

I hope it looks easy, cause since I’m used to it, I love it !

Now, let’s check one of the player’s state machine ! I took the “State_Run” cause it’s not the easiest nor the most difficult to understand ! The “State_Jump” is the worst actually.

The yellow branch is the “Entering condition” for the states who allowed the “State_Run” as a next possible state (actually, only the “State_Idle” does), don’t forget !

1. In green you see the next possible states (double click to enable/disable !). It means, while running you’ve got gravity (“Gravity” is not a real state, I just use the entering condition branch to trigger an impulse every frame), you can kneel, jump, or dash.
2. Playing the Run action from the player’s Action Bank.

Looks like everything is working well. I encountered some bugs here and there but nothing hard to fix so far. I’ll try to use the same level and add things one by one till I’m able to try every single part of my editor. I still have : lights, fx, sound… And things I didn’t even mentioned like rain effect, projectiles and material system (to trigger a specific fx/sound on different objects collision). There’s still some work before starting a real game, but it’s getting closer and closer. Yeah !

Game Dev

FX with Mercury

Here comes the other part of the previous video :

It shows how do I do to trigger FX based on Mercury (FX engine) with my state machines.

Mercury provides a stand alone application to create FX, then you just have to import the XML and images in your project, add some code, and then you get a nice particles engine. In the end, I already have two external engines added in mine : Krypton and Mercury.

I did  a loop for the example, but I could emit particles just once too. I just noticed a glitch in the video (at 2:28), don’t know why…

Well, I think I’m ready to start something nice. I’ll do some real demos when I’m back (July, the 3rd) to validate the whole thing and then, I’ll start this damn game ! Cool. 🙂

Mercury :

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).

Game Dev

WIP : State Machine

I did some testing on animations and collisions and it works just fiiiiine. I should make some videos but I’m quite bored (takes time too).
To check the collision I added a bounding volume to my objects. It’s just a polygon (I convert every concave polygons into several convex one to make the whole calculation easier).

You can draw the collision polygon in the editor, of course (green polygon on the picture). I’m still using place holders. Nothing is done for a real game yet.

Right now, I’m doing one more experiment before my next steps (FX and sounds) : It’s a kind of state-machine editor. I was a bit bored when I was working on different states just to test some actions (idle, move, jump…) so I figured out it could be awesome to make the edition of my state-machines possible through the editor. I guess I’ll need at least three more weeks to complete it/test it/debug it. I designed it on some sheets and it should be useful (and worst case is if there’s a thing I can’t specify in the editor. I will just have to hard code it). The purpose is to handle graphically most of the trivial conditions and events. For example :
– In the state “idle” : “play idle animation” ;
– If “A” is pressed, then “goto state jump” ;
– and so on.

I’m starting to feel confortable using winforms and drawing functions 😀

If it works, I should be able to use it to handle events in levels too (like “if players is … then trigger …”) or even to make state-machines for AI (“if player is in range” then “shoot” etc). Well, I still need time and motivation ! If I can’t make it for april (wooorst case), I’ll skip.