Category Archives: Games

My thoughts on Flash and its recent events

Update : Unity3D has set up an exporter to target Flash which works very well! Without doubt they are working on an exporter for HTML5 too. This technology seems to be promising, I’ve added it on my to learn list!

I wouldn’t come back on the Adobe announcements, everyone know what’s happened and it has already been discussed everywhere. I just would like to share my student point of view about the future.

Continue reading My thoughts on Flash and its recent events

Finally using SWC for art in the Citrus Engine

Two days ago, I introduced a way to target iOS with the Citrus Engine using the metadata tag Embed. Forget that way, it is really painful.

Instead of using Embed everywhere and probably rewrite method for the CE’s ObjectMaker, we will use a SWC file. Refering to Wikipedia, an Adobe SWC file is a package of precompiled Flash symbols and ActionScript code that allows a Flash or Flex developer to distribute classes and assets, or to avoid recompiling symbols and code that will not change. SWC files can be generated by the Flash authoring tool, and by Flex. They are sometimes referred to as class libraries and cannot be directly executed by the Flash Player.

So in this file, there will be our level with all its graphics, animations, sounds… We will not have anymore external datas. Moreover our level in the flash IDE will not contain only rectangle shape like previously, but our graphics and animations :
Screenshot of the level
It’s more user friendly isn’t it ? My hero is always a rectangle shape because I’ve not the orignal fla right now.

So to do that just import your graphics and animations into your fla’s library. I recommend to create a movie clip named Level and put it on the stage, name it and add a simple trace code into it to inform what is your current level. We will add all our layers and objects in!
Then put the graphics inside your original Background movie clip for example. Next, inside the movie clip’s properties check export for ActionScript3 and set as class Background. Finally add this code into the movie clip :

var className = "com.citrusengine.objects.CitrusSprite";
var params = {
	view: Background
}

Before, we had a background.jpg now we have a class!

For animation it’s the same, but be careful : if you use it in code after it may have a problem of duplicate name, so in my case with the “Roseau” animation, my view is set up as RoseauAnimation. My library :
library screenshot

Now that your level is set up export it as SWC, then import it in your project. And finally to create your level in the Citrus Engine :

package {
 
	import com.citrusengine.core.CitrusEngine;
 
	import LevelA1_fla.Level_1;
 
	public class Main extends CitrusEngine {
 
		public function Main() {
 
			super();
 
			state = new GameState(new Level_1());
		}
	}
}

Et voilΓ ! You can download my zip. There is still the problem with hero deplacement coming from the new version, anyway if you start a new project from scratch with this one, all will work fine!

Now you just have to import sounds/videos in your SWC too…
Be careful if you use a SWC and target the Web, because the swf becomes heavy and if there isn’t an external preloader, people may leave before played your game!

Finally if you want to have great performance on your mobile game, you should take a look on CE blitting method. And you may use Embed metadata tags to add your assets to your game state. I recommend to add them directly in your class, don’t use the level editor. Programming is not always easy πŸ˜‰

Rugby game, AS3 – CE – haXe versions

Two weeks ago at school we made a simple rugby game with graphics provided.
I take this opportunity to compare how I develop the game if I use different framewok :

– in AS3 with linked list and object pooling (refers to this previous tutorial). Obviously it is a little game, and we don’t need complex optimization, but that was a good implementation exercice. Moreover I’ve updated my class πŸ˜‰

– with the Citrus Engine, managing Box2D. It was not easy to handle physics to have the same result that the basic AS3 version, and actually it is not the same (there is some inertia), but I really like how Box2d handle collision. We can manage before collision, the beginning and the ending. It is really more precise than a hitTestObject. Moreover we can separate art from physic body, and so change easily the “collision box”.

– last night, with lbineau we made a programming evening around haXe (and some beers πŸ™‚ ). The idea was really simple : make the same game, using existing AS3 classes with haXe. I have already given a chance to haXe previously and saw how powerful it is. This time, I see how easy it is to use previous AS3 code. I didn’t rewrite my Opponent and Player class! And I used the fla to link graphics without any trouble! However I’m a bit disappointed : I used most of the time original AS3 objects instead of haXe primary objects. What I need right now is FDT5 with its full haXe support! Can’t wait for it… Oh! If you’re interesting by haXe, you should take a look on NME, it seems to be amazing.

The zip with the three versions.

Introduction to Embed art in the Citrus Engine

Update : using metadata tag Embed is not the easiest path if you want to target iOS, take a look on this post using SWC.

Today this is a quick post based on an older one : Create objects and art in the citrus engine.

If you want to target iOS platform for your game, you must know that you can’t load swf at runtime. Indeed all your data must be “packaging” in one file an .ipa. So you are not able to load external data. To pass over that restriction, you need to use the metadata tag Embed properties. This is a blog post for Embedding Ressources with AS3.

So, what we will do today is to adapt the previous post to be able to target iOS. I don’t have enough time to do it entirely, so this will only be an introduction, sorry.

Let’s start now : on your level.fla add AS code to embed some assets :

[Embed(source="../../assets/grass.png")]
var GrassPic:Class;
Grass.picture = GrassPic;
 
[Embed(source="../../assets/elements.png")]
var BackgroundElementPic:Class;
BackgroundElement.picture = BackgroundElementPic;
 
[Embed(source="../../assets/background.png")]
var BackgroundPic:Class;
Background.picture = BackgroundPic;
 
[Embed(source="../../assets/objects/Roseau.swf")]
var RoseauAnim:Class;
Roseau.animation = RoseauAnim;

Here we are using the dynamic property of MovieClip, more information about it : Adobe doc. Don’t forget to name your stage MovieClip!
Then into your background MovieClip add this code :

var className = "com.citrusengine.objects.CitrusSprite";
var params = {
	view: this.picture
}

Don’t forget the this or it will not work! Now, your asset is embed πŸ˜‰
It is really easy to embed graphics, but what about SWF ? How can we handle animation on this ?

Go back into our two older methods : roseauTouche & roseauFin. And change the code for :

private function _roseauTouche(cEvt:ContactEvent):void {
 
	if (cEvt.other.GetBody().GetUserData() is Hero) {
 
		 ((MovieClip(SpriteArt(view.getArt(cEvt.fixture.GetBody().GetUserData())).content).getChildAt(0) as DisplayObjectContainer).getChildAt(0) as MovieClip).gotoAndPlay("white");
	}
}
 
private function _roseauFin(cEvt:ContactEvent):void {
 
	if (cEvt.other.GetBody().GetUserData() is Hero) {
 
		var roseauMC:MovieClip = MovieClip(SpriteArt(view.getArt(cEvt.fixture.GetBody().GetUserData())).content);
		var loader:Loader = roseauMC.getChildAt(0) as Loader;
		var mc:MovieClip = (loader as DisplayObjectContainer).getChildAt(0) as MovieClip;
		mc.gotoAndPlay("black");
	}
}

Dammit!! It is the same code for this two functions, the first is just more condensed. I will not explain more, because I’m always surprised of those lines… πŸ˜€ However you can find informations here and there.

My zip. There is some problem with hero movement (jump and move to travel) due to the update on the last CE’s version. I don’t know where it comes from, but you can use it without problem. I made some test from scratch and it works πŸ˜‰

I know that there is lot of works to do from there, but that’s a good start. You need to put your level into an asset in your state finally, and see what happen. You would write a new function to ObjectMaker to enable that, probably.

I wouldn’t dig into it more, because I’m not sure it is the best way… It is a bit complex if you want to manage animation. The updateAnimation method of PhysicsObject class doesn’t work this way. And moreover there is an other method to embed data :
“Remember you can specify a MovieClip linkage ID as your view property rather than a path to a SWF/PNG. If you’re using Flash Develop, FDT or Flash Builder, you can embed your MovieClip graphics that you made in the Flash IDE using SWCs”.

Anyway that was a cool introduction to embed assets, isn’t it ?

Doubly linked list and object pooling

After holidays, it’s time to get back to work πŸ™‚
I was really busy last month, so this is some news on what I did and what is going on :

– I’ve made some experiments with the Citrus Engine on the Hero adding some functionality. But what appears is the Hero class becomes more and more complex… So I asked its creator if he knows a system/model which has a modular way to add features to the hero. And he gives me some information about the Entity/Component model. Woah, it is awesome! It’s really a new way of thinking about programming. No more OOP. This is 3 useful links/resources if you are interested : Gamasutra the Entity Component Model, Entity Systems are the future of MMOG development, Entity Systems. This links are very interesting, but there isn’t any implementation. You can find implementations with the PushButton Engine (flash), Artemis (java). However it is really complex, so I was not able to create a Component/Entity System for the CE due to my lack of experience… but if its creator has time, he will do!

– I was in holidays at Praha (Czech Republic), amazing city/country! And beer is really cheap πŸ™‚

– I’m currently reading the book of Jesse Schell, The Art of Game Design it’s a masterpiece! Really, really interesting, lots of awesome advices. Approved & Recommended!

– I’m working/designing my next portfolio. It will be nice… πŸ˜‰

– On Thursday 15 September, I go back to the Gobelins school! And I will make a point with Tiffany about Kinessia. We are thinking to create the game for mobile. I hope we will have enough time (there are already lots of project at school…), so stay tuned!

– Mobile, tablet and game design/programming is interesting me more and even more. This is two good links on mobile game programming : Starting with AIR for Android and iOS – building one app for both platforms, and Building mobile games in Adobe AIR – optimization techniques.

– And finally I’m also waiting FDT5 to invest more time in haXe and WebGL!

I think it’s enough for the news at the moment! Now it’s time to speak about the topic, this week I wanted to make some algorithms, doubly linked list and object pooling are a good exercice. Previously I made an oral in my school to introduce recurisivity and data structures (pdf link in french). Doubly linked list and object pooling are techniques optimizations used in game development and especially on mobile devices.

Continue reading Doubly linked list and object pooling

Create a ladder for the Citrus Engine

Hi, today a quick post about how to create a ladder for the Citrus Engine.
It is a preview version, Michael Kerr requested me for his flash game scripting class !

I’m working with Eric to add it into the original package !!

So here is the result : the ladder in action

Continue reading Create a ladder for the Citrus Engine

Teleporter, treadmill and cannon

After my game school project (Kinessia), I’m still doing some experiments with the Citrus Engine.

On its latest update, there was some new objects :
– a powerful particle system.
– new objects : missile, reward and reward box.

In this tutorial, I wil explain how to create new specific object which extends a Citrus Engine object.
At the end, we will have : a teleporter, a treadmill and a cannon that fires missile !
An ugly example.

Continue reading Teleporter, treadmill and cannon

Kinessia, game school project

Hey,

I’m happy to share with you my game school project made at the french Gobelins school, in Annecy.
It is now online : http://kinessia.aymericlamboley.fr/.

I worked with a graphic designer, Tiffany Francony, which made an amazing job !

For the exam we had high honours and the best rating !!

It is made with the Citrus Engine. The original version used a smartphone as a controller for the game, and all the HUD was displayed on this. I used a Java server to make the synchronization.

This is a simple web version, I can’t pay a Java server. The concept is more raw than the original one, there was a video at the beginning to explain the story, and our approach was on the website. But, that was all in french, so I cut off.

All the source code is available on GitHub.

A short video :

I hope you will enjoy the prototype πŸ™‚

Synch a phone with a website using the Union Platform

For my school game project, I use an iPhone to move my hero thanks to the accelerometer. It can move to left/right, jump… and manage informations in a menu. To make the synchronization, I use the Union Platform.

There are several ways to realize a synchronization between a smartphone and a website using servers like : Flash Media Server, SmartFox Server, BlazeDS… I didn’t really try FMS because I use a mac and it can not runs on it. At first I wanted to put my game online using SmartFox, so I needed a Java server… but it’s really expensive ! However there was an alternative with the Google App Engine. We can have a free access to Java and Python server hosting by Google ! It seemed to be great, but SmartFox can’t be deploy on it whereas BlazeDS and GraniteDS can ! These 2 servers use the flex technology… it was a big problem to deal with because I use an old iPhone 2G. Even if today you can easily export flash with as3 for iPhone with Flash IDE or the new Flash Builder 4.5, exporting flex for iPhone is not easy : indeed, we need to use some Ant Tasks… and if your .ipa is well exported, it will not run on iPhone 2G. In fact with the new Air 2.6 you can’t export to old iPhone.

So these months have been really frustrating, until a friend informed me of the release of a new server : the Union Platform. It has been released by Colin Moock who wrote Essential ActionScript 3.0 book.

Continue reading Synch a phone with a website using the Union Platform

Create objects and Art in the Citrus Engine

Update : if you want a version with a SWC for targeting iOS, please refers to this post.

Hey ! I started to make my school game project this week. I advance quickly, it should be fine for the end of june !

For this third tutorial on the Citrus Engine, I explain better how you can use the Flash IDE as Level Editor, and I show two classes that I’ve created for my game. Here is what you will have.

Continue reading Create objects and Art in the Citrus Engine