Unity 4.3, the salvation?

Hey folks.

Unity 3d, the more I play with this software, the more I love it. And today, I have really more reasons to.

I was visiting the Unity forums, reading stuff here and there, when I found a topic about Unite 2013, describing the arrival of a new 2D workflow integrated into the upcoming Unity 4.3 version, and… Oh my… I yelled all over the house in an extreme pulse of joy.

See for yourself :

In summary :
– full integrated support for sprites,
– support for multiple sprites from the same image
– support for layering the sprites with filter selection
– direct use of sprite’s textures with a single material by the new SpriteRenderer
– new animation system with really recall me the animation workflow from Adobe After Effect

This new 2D workflow will avoid me to think for a solid custom rendering system or to spend money in an existing 2D workflow from the Asset Store.

In two words : F*** Yeah!

Thank you Unity3d.

Advertisements

‘Time’ is on our side!

Hey folks.

We want Excellence to be a shoot’em up with a great ambiance, full of events and animations. For this, we need to have a way to synchronize all those events together. I remembered how I loved to play with some movie editing and FX tool, like Adobe Premiere and Adobe After Effect.

From this, I took time to write a script to have a timeline, on wich one I could easily control the evolution of my events and other parameters. This is the base of how the stages will be built, and will surely evolve to be even better. :]

timeline

How does it works? The spawns are simple gameObject that “awake” all their children at the right time. Pretty simple but damn useful. The “curves” are some parameters, generated from a simple Timeline Element script, attached to the object we want to animate with. The values of the curves are then retrieved within the object scripts. Each curve are editable individually, can be foldout and their key frames are movable by a simple click.

The magic come from the way the camera is updated in real-time when changing the cursors position on the timeline. It will be a great tool to work with!

Keep looking for other cool things in the future. :]

You like sprites? You will love them animated.

Hey folks.

A lot of time passed since the last news, many things happened on my side but today I can share some stuff with you.

During that time, we swapped back to our custom C++ engine, then again to Unity. The hardest for a programmer with Unity is to switch from a programming language where we can do anything we want anytime we need, to a scripting language where we do it faster but with constraints.

Well, at last, we’ll stay on Unity. After many tutorials, questions on Unity website and a bit of motivation, this tool gives me many more satisfaction I didn’t have before. And for some proof, here is one of the basic tool I could develop as an extension to the editor : the animated sprites.

In all the sprite editor I saw on the web and the Unity’s Asset Store, each have their own way to sort the base frames to create the final animated sprite. The great majority just put the frame one after another, using some strange Drag and Drop mechanism, or even less. It do the work, but it appears hard to work efficiently on complex animated sprites. That’s why I though it would be better to do our own animated sprite system.

In summary, I needed :
– A complete animated sprite system, covering all the need we have about animation.
– An time based system (instead of frame per frame), allowing to play the animation any speed we want, backward of forward.
– Including tools to rapidly implement basic tilesheets.
– Pre-generating the meshes used as sprite to avoid them generated on run-time, performance-wise.
– Accepting multiple animations for one animated sprite, allowing us to swap animation when needed.
– Allowing easy interaction with C# scripts.

And after a couple of days of research and intense scripting, here we go :
animationEditor

Pretty complicated stuff huh? Well, not that hard.
The Sprite Animation script inherit from ScriptableObject, allowing us to save them in the project window (4). I added a MenuItem to create them as a standard asset. The animation doesn’t have an inspector like other assets. Instead, I wanted it to be in an editor window to have the needed space. We can open the editor with the Open button (5) in the inspector of the current animation or open it with the Excellence menu in the menu bar.

Once the sprite is created, we assign it our sprite sheet, saved as a material in the material field in frame (1). Then we create and move the frames in the Timeline (7) and edit each with the Frame Edit (2). A preview of the sprite sheet and the current edited frame appear in the Frame View (6). Once the frames are created, we sort them with the Timeline’s curve (7). I need the system to be close to the timeline of 3D Studio MAX, working frame per frame on the Editor but being able to play the animation any speed we need later. For a classic sprite sheet like the one on the screen, it is not that useful as the curve will be a simple line going from top-left to bottom-right, but if I want to use this system later for, per example, a fighting game, it will allow me to place some pauses in the animation or repeat the same frame multiple time (like Chun-Li repeated kick. :D ), etc.
Once the animation is ready, we click the Compile button (1) to generate the meshes.

Then, we need to use the newly created animation, and for that we need the Animated Sprite.

animatedSpriteEditor

In an empty GameObject, we add the Animated Sprite script. It automatically add the Mesh Renderer and Mesh Filter. Of course, we need those two components to render our sprite in the game, but also in the editor scene. Then you have to add at least one Animator. The animator tells how the animation will be “read”. We can add as much animator as we need, but only one is read at the time. Standard animator (1) simply read the animation from the first to last frame within a given duration, with a loop option. Linked animator (2) allow to link the animation to a variable. In the game, it is useful to rotate our enemies, like Pods and Buggies, giving the angles they are facing to. Targeted animator (3) gives a frame we want to display, and a cursor parse the animation back or forth until the desired frame is reached. It is the system used to display the player ship, as it will roll at its own speed with going left and right.

At last, to allow a good interaction with the scripts, the Animated Sprite object got some function to get and set the parameters at will. Those parameters are the same displayed in the inspector, marked as “not saved”.

public class MyObject : MonoBehaviour
{
public AnimatedSprite sprite;

void Start()
{
// We retrieve the animated sprite attached to the game object
sprite = GetComponent (typeof(AnimatedSprite)) as AnimatedSprite;
}

void Update()
{
// For a Standard animator, we can know if the animation is finished (in condition the animator don't loop)
bool isDone = sprite.GetBool("Done");

// For a Linked animator, we can give it the desired frame as an alpha value or an angle.
// The next 3 lines will set the frame to the middle of the animation.
sprite.SetFloat("Alpha", 0.5f);
sprite.SetFloat("Degree", 180f);
sprite.SetFloat ("Radian", Mathf.PI);

// For the Targeted Animator, we can set the target frame and get the initial frame.
sprite.SetFloat ("Target", 0f); // Target the first frame of the animation
sprite.SetFloat ("Target", 1f); // Target the last frame of the animation
sprite.SetFloat ("Target", sprite.GetFloat ("InitialTarget")); // Target the initial frame.

// A call to setFloat with an unknown parameter name will simply be ignored. It avoid to have multiple if statement to known wich type of animator we are dealing with when passing a parameter.

// We can reset the sprite to retrieve the initial state. Each animator have its own way to be reset.
sprite.ResetAnimators();

// And at last, we can select the desired animator by setting its index.
sprite.currentAnimatorIndex = 1;
}
}

Annnnd that’s it! We now have a powerful tool to create cool animated sprites rendered in the editor scene view! If you are curious about the system, feel free to post a comment. :]

Until next time!

Software architecture

Hi folks.

I found some time to write a post, so here it is!

There is no better way to begin than start by the beginning : how did I organize the project and what library did I used?

SFML

Well, It isn’t a surprise if I tell you I’m using SFML as the base for the software. What is SFML and why did I used it?

I partially answered in the Project Page. SFML is a multimedia library that allow a fine and easy use of 2D features and primitives through OpenGL. It allow to draw 2D stuff with the benefice of hardware acceleration. But it is not all it can do. SFML give also access to nice shaders effect, True Type Fonts, windowing, input management, sound and network features.
The main point of SFML is that it is Simple (first ‘S’ for SFML). It is designed to be used by beginners as by more advanced programmers, and it really suits me.

Excellence Engine

SFML is the base. It allow to have access to low-level features. But I need something more efficient and complicated to create a good quality game. No existing engine proposed enough 2D features for my needs, so I need to create my own engine. I started Excellence Engine (or ExEngine) as a supplemental layer, a level above SFML. I gave it many useful things, as features to manage my game screens, game resources (images, sounds, …), my graphical assets (animations, shaders, rendering), display operation (resolution, aspect ratio) efficiently, in addition with math and physics functions, GUI support and debug tools. Well, the engine is still in “Work in progress” state, as I continue to add stuff I’ll need later in the game development. I’ll write some specific posts about ExEngine later.

Excellence Editor

The benefits of writing ExEngine is to prepare the future of the game following Excellence, having smaller compilation time and smaller bug fixes to download, but also to easily do a kind of bridge between the game and its editor; because it is nearly impossible to create a good game without a proper level editor.

Excellence Editor (or ExEd) will allow me to manage my resources, my objects and my level with some standardized stuff thanks to the ExEngine. I mean, nearly all classes of ExEngine will have their proper editor in ExEd. I use Qt 4.7 for the editor GUI. I could have used another GUI library as wxWidget, but I’m particularly interested by the Graphics View module de Qt to create good-looking editors, and most of all, a fast and intuitive level editor.

At last, here is a little drawing of the global architecture of the Excellence project :

Excellence software architecture

Excellence software architecture

Where is Unity? Where is the 3D?

Hi folks!

Some of you maybe noticed the description of the last footage video on our YouTube channel or the post of the SFML forums :

The footage provide you some example of what the project is on SFML, before I take a great turn and went on Unity3D, for the pleasure of your eyes and fingers.

So, you will ask me : where is the 3D? How far did you go on Unity?

Well, the answer is simple : I didn’t go far enough to have some playable demo. :)

Here is the feedback.

Unity is a great software. Its GUI is really well done, intuitive and all. The project structure, resource management, scene setup are really well done and I would recommend it as a great video game making software for intermediate game makers.

Why didn’t I continued on it if it is so well easy to handle?

First, because I’ve been thinking for more than a year about how a game should work, how to organize my project, how my classes should be, and despite the easiness of a full-fledged game making software, I wanted to go with what I did. I wanted to proceed further in my game engine, make it more optimized, better thought, more well done and of course, I wanted to go through the entire course to do a video game.

Second, Unity have its own way to think and I have my own way to think. All in unity is about GameObject. If I want some manager, supervisor or other invisible object, it has to be a GameObject. Unity use C# or javascript as script language, and I don’t really want to begin learning theses languages as I want to specialize myself in C++. It mean a lot of time used to change my way of thinking and to learn new languages.

Third, despite the ships and background are rendered from a 3D software, I love the 2D! Having the game in 2D give it a particular feel that can’t be found in 3D games, plus the facility to work in 2D space instead of 3D space. Having a full 3D background and a layered 2D background is really different after all.

Well, I hope you understand what I mean, if you don’t, I’ll make sure you will. ;)

As a result, I returned to my old game engine, reworking it and proudly naming it “Excellence Engine”, or also “ExEngine” or “ExE”. In some way, you can tell I’m programming a 2D shooting game engine. I surely will speak about it in further articles, including the game/stage editor.