All posts by Aymeric

About Aymeric

Freelance Interactive & Game Developer.

Starting with haXe

I heard a lot about haXe recently, so I made ​​the leap. This is a short introduction with demo to the haXe language.

haXe is a multiplatform language. You can use it to target Flash, JavaScript, C++, Php, and soon C# and Java. What does it mean ? You write your program in haXe and you chose on which platform you will export it. It is compiled on its target platform : .swf .php .js …

“The idea behind haXe is to let the developer choose the best platform for a given job. In general, this is not easy to do, because every new platform comes with its own programming language. What haXe provides you with is:
– a standardized language with many good features
– a standard library (including Date, Xml, Math…) that works the same on all platforms
– platform-specific libraries : the full APIs for a given platform are accessible from haXe”

In this short tutorial, I will target on two platforms .swf and binaries file (cpp) with the same code!

Continue reading Starting with haXe

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

CitrusEngine flash extension

Hey there,

While improving my skills on the Flash Platform, I started to learn Flex and on an other way JSFL (using for Flash IDE extension).
So I mix them together, and I offer to the CE community my first Flash extension.

You can find it here : https://github.com/alamboley/CitrusEnginePanels
It requires Flash CS5.

On a project, you have always recurrent tasks. Using the CE for your game, you will create a hero and using the right labels for example. Adding a platform, baddy, cloud in the flash IDE to create a level required to create Movie Clip and specify their classname, their filepath (swf, png…) and some others options.

So what can you do with this extension ? In what way it will improve your productivity ?
I made it to be really simple to use, fast and efficient. Things that you can do with it :
– generate the correct labels for your hero, baddy, missile… such as idle, walk, jump… on a label layers !
– add to your level CE objects (hero, platform, coin, cloud…) on a specific layers with the same name and color, with some options (filepath, classname if not the original one), specific options too (oneWay for platform, parallax…).

Notice that you need to create only one time your object and duplicate them on your stage to add many. If you want to create a similar object too, just duplicate it in the library.

All of the CE objects are not in this extension, I will add them later. Before that, I would like to have your opinion about the plugin : how to improve it ? more options ?
I think that somes options for instance the endX and endY should not be included in the moving platform level fla, and be controlled by code…

Any idea is welcome 🙂

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 🙂

Greedy algorithm

According to Wikipedia, a greedy algorithm is any algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding the global optimum. In general, greedy algorithms are used for optimization problems.

An example of a Greedy algorithm is a charging machine. Assume that it give you your change with € currency, you will have coin of : 200, 100, 50, 20, 10, 5, 2, 1. Your change will be really easy to calculate with a greedy algorithm :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var moneySystem:Array = [200, 100, 50, 20, 10, 5, 2, 1];
var giveBack:uint = 263;
var solution:Array = [];
 
trace(greedyMethod(moneySystem, giveBack, solution));
 
function greedyMethod($moneySystem:Array, $giveBack:uint, $solution:Array):Array {
 
	if ($giveBack == 0) {
		return $solution;
	}
 
	while ($giveBack >= $moneySystem[0]) {
		$giveBack -= $moneySystem[0];
		$solution.push($moneySystem[0]);
	}
 
	$moneySystem.shift();
 
	return greedyMethod($moneySystem, $giveBack, $solution);
}

For 263, the algorithm will output : 200,50,10,2,1. It is the best solution. Thanks to the € currency, greedy algorithm will always give the best results.
However if we have an other money with only 4, 3, 1 coins and the change is 6 the greedy algorithm outputs 4, 1, 1 instead of 3, 3. That’s a fail !

Another typical example is the knapsack problem : given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.
According that our values are sorted in decreasing order we have :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var objects:Array = [["A", 12, 10], ["B", 10, 7], ["C", 8, 5], ["D", 7, 4], 
		 ["E", 7, 4],  ["F", 6, 4], ["G", 5, 2], ["H", 4, 2],
		 ["I", 4, 1], ["J", 3, 2], ["K", 3, 2], ["L", 3, 1],
		 ["M", 2, 2], ["N", 1, 1]];
var totalWeight:uint = 25;
 
trace(knapSack(totalWeight, objects));
 
function knapSack($totalWeight:uint, $objects:Array):Array {
 
	var currentWeight:uint = 0;
	var subSet:Array = [];
 
	for (var counter:uint;counter< $objects.length; ++counter) {
 
		if (currentWeight + $objects[counter][2] <= $totalWeight) {
			currentWeight += $objects[counter][2];
			subSet.push($objects[counter]);
		}
	}
 
    return subSet;
}

The output is [A,12,10],[B,10,7],[C,8,5],[G,5,2],[I,4,1]. It’s ok, but we aren’t sure that it is the best result. The problem with a greedy algorith : it will always try to select the first parameter even if it is not the better.
For instance, our max weight is 40, our objects are [“A”, 30, 39], [“B”, 12, 10], [“C”, 12, 10], [“D”, 12, 10], [“E”, 12, 10],[“F”, 4, 1]. The greedy algorithm choose A and F for a value of 34 whereas B, C, D, E is obviously the best value : 48. That’s an other example where it fails.

So to conclude greedy algorithms depends of datas if they are balanced or not. More data are balanced, more it will be powerful. For a perfect result, you can use dynamic programming method. It is more complex and requires more resources. So it’s up to us to find the best solution for our problem.

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

Create a breakout game with the Citrus Engine

Today this is a new tutorial on the great Citrus Engine framework. Before starting my school project, I wanted to try using box2D inside the Citrus Engine, so I will show you how create a breakout game !

Click here to play the game, don’t forget to click in the swf to enable keyboard.

Continue reading Create a breakout game with the Citrus Engine