DickDynamite: behind the scenes
[ June 21, 2003 ] by Marco Lapi, a.k.a Lapo
This article is an overview on the features and the techniques employed in the making of "Dick Dynamite". Lapo also discusses the difficulties and the limits found working with Flash MX. Some of the complex topics touched in this article will be investigated in future articles.

DickDynamite was born from some experiments using Flash MX at the beginning of spring 2002.

My friend Bax and me just sat down in front of my PC, right after downloading the FlashMX trial, that was out by a bunch of days.

The idea was to create a basic game prototype, based on the Pacman type arcades.
My very first attempt at doing a Pacman/Bomberman clone was many years ago, I was 16 and had already spent 1 year studying Z80 assembler on a Philips MSX 2 (why the hell did I sell it !!).
Those days things were much more complicated: I had a very basic text editor and compiling was all done via command-line, but the worst part was debugging ! I rememer writing the code, compiling it, then running the executable and in 3 seconds the machine would crash, and then restart without one single error message !

It could take a whole day to understand what the hell was going on!

Anyway, back in these days, we started out by creating a very simple 20x20 tiled map and two very ugly sprites, just to see how to make them move correctly in the map and detecting collisions.
As you can see from the picture (Pic 1) the very first prototype was pretty ugly.

Pic 1: this was one of the very early
prototypes of the game.

I thought that the best approach was to create a bi-dimensional array containing all of the tile data.
Doing so was very efficient as we could subdivide the map in 400 squares (20x20) and then query the tile array to see if I could move the sprite in a certain direction.
(A specific article is going to be published very soon on how this is done)

When this part of the code worked we started thinking at a more flexible way of managing maps.
At that point we had just one map defined within the movieclip itself just buy adding manually all the tiles, this could have looked like:

map[1]  = "X                  X";
map[2]  = "XXXX     XXXX    XXX";
map[3]  = "XX XX  XX   XXX   XX";
map[4]  = "XX XX  XX   XXX   XX";

etc ........



To create a better way of managing the levels we started thinking about using XML:
what about creating an XML document that holds all of the information about the levelmap ? We could not only define the way the map looked but also the position of bonuses,sprites etc...

After some experiments we came up with an XML document that could describe all the elements in the map.

The result code was something like this:

<?xml version="1.0" encoding="iso-8859-1"?>
	<gigio posx="1" posy="1"/>
		<mapline>Q      Q   ccccc   Q</mapline>
		<mapline>Q Q  Q   QQcQQQcQQcQ</mapline>
		<mapline>Q  Q  Q  0         Q</mapline>
		<mapline>QQ cQ cQ QQQ QQQ QQQ</mapline>
		<mapline>Qc Q  Q         1 cQ</mapline>
		<mapline>QcQ  Q   QQcQQQ QQcQ</mapline>
		<mapline>Q    0 Q     1    cQ</mapline>
		<mapline>Q Q  Q   QQQcQQQcQQQ</mapline>
		<mapline>Q  Q  Q  1         Q</mapline>
		<mapline>QQ cQ cQ QQcQQQcQQ Q</mapline>
		<mapline>Q  Q  Q     cccc  cQ</mapline>
		<mapline>Q Q  Q   QQQcQQQ QQQ</mapline>
		<mapline>Q      Q          cQ</mapline>
		<mapline>Q Q  Q  Q  Q  Q  QcQ</mapline>
		<mapline>Q$ Q0 Qc Qc Qc Q0 QQ</mapline>
		<mapline>QQ  Q  Q  Q  Q  Q cQ</mapline>
		<mapline>Q Q               QQ</mapline>
		<mapline>QQc QccQccQccQccQ6cQ</mapline>
		<enemy typ="3" speed="18" posx="16" posy="17"/>
		<enemy typ="3" speed="14" posx="3" posy="18"/>
		<enemy typ="3" speed="16" posx="18" posy="1"/>

The map is contained in the <map></map> tags, and each <mapline></mapline> is one row of the map.
Each character represents one tile in the map, so the maze is still recognizable and it is even possible to edit the map
with just a text editor.

(continues on page 2)

Name: Marco Lapi, a.k.a Lapo
Location: Fossano, Italy
Age: 34
Flash experience: started out with Flash 4 back in 1999
Job: web designer/developer
Website: http://www.gotoandplay.it/
| Homepage | News | Games | Articles | Multiplayer Central | Reviews | Spotlight | Forums | Info | Links | Contact us | Advertise | Credits |

| www.smartfoxserver.com | www.gotoandplay.biz | www.openspace-engine.com |

gotoAndPlay() v 3.0.0 -- (c)2003-2008 gotoAndPlay() Team -- P.IVA 03121770048