Flash Games in Flex Part 2 – World Builder

Posted on September 21, 2009 by Tony Fendall.
Categories: AIR, Adobe, Flex, Gaming.

Since my last post I have continued working on little ‘cat herding’ game as a way of learning about how a simple 2D game engine works.  It quickly became apparent to me however that I was going to need a tool to help me define levels for the game as manually typing out the level definition (several large int arrays) was becoming very tedious.

A ‘World Builder’ application is quite a different puzzle to building a game, because the world builder not only needs to be able to render the level to the screen, but it also needs to be able to update the level in a fast and elegant way.  These constraints are directly contradictory when you are trying to decide on the data structure to represent your world, and it took me several different attempts to get it right.  What I eventually settled on can be seen above, and you can download the source here.  Read on for an explanation of how it works.

Note: All of the tile assets used in this demo (and my previous one) have been borrowed from the application RPG Maker XP. It’s an awesome piece of software!

(more…)

Let’s Go Walk About- Flash Games in Flex

Posted on September 18, 2009 by Tony Fendall.
Categories: AIR, Adobe, Flex, Gaming.

 

 

Recently at work I haven’t been doing much actual Flex development.  Instead I have been spending my time working on a data mining/business intelligence system which is an intricate combination of some complex SQL, Ruby scripts and some software called Pentaho.  Long story short I was starting to miss the feeling of getting my hands dirty in Flex code, so a few days I go I started messing around with building my own rudimentary game engine from the group up.

Above you can see what I have built so far in about 3 hours total coding time spread over the last four days.  The age old adage “never re-invent the wheel, unless you want to learn something” has proven true here once again also.  There is quite a lot of trickery to get even this small number of objects to draw themselves onto the screen in a fast, efficient way.

I’ll probably release the source code pretty soon. It’s still a bit in a state of flux so I’m not ready to let other people read it just yet :)

If I continue to have a bit of free time up my sleeve in the next few weeks I hope to port this project to AIR and have a go at trying to construct the map and characters from a definition in a text file.  At present the layout is defined in a 2D int array, so the conversion will hopefully be fairly simple.  If that works out then I’ll probably try and remember some of the AI techniques I learnt back in university… Should be fun :)