January 6th, 2005
This month we take an in-depth look to one of the most promising Flash games of 2004: "The Curse of Sylvaniah".
The game is technically superb and it demonstrates that it is possible to achieve fast action/arcade games in Flash. Also it is supported by the great graphics of LuxRegina, who already appeared in our SpotLights.

In the following interview we've tried to unveil some of the "secrets" of the game with its developer, Mattias Stridsman, aka Strille.

Q: Can you talk a little about your beginnings with Flash and your past works/experiments?

I first heard of Flash in 1998. I liked it quite a bit. It was like nothing I had come across before. I downloaded a trial version of Flash 3 and created some menus for my personal homepage (which I've saved for nostalgic reasons more than anything else). That was the first thing I produced in Flash and I've used it on and off ever since :-). In the beginning I mostly did small experimental things, game concepts and game engines rather than finished polished games. An example of that would be the dungeon demo made in Flash 4. It was probably my first "game engine". It was a re-creation of the dungeons in Phantasy Star (released in 1988 on the Sega Master System). I loved Phantasy Star when I played it at the age of 11 - it was one of the first games with role-playing elements that I encountered. In my re-creation it's just a maze you can walk around in, but you could quite easily make a real game out of it.

A couple of years later, in 2002, I came back to the first person "dungeon" view concept again. I guess I have a soft spot for those. This time I decided to test raycasting in Flash 5, which is a step away from the fixed animations in the Phantasy Star dungeons towards real-time rendered graphics. I like to push Flash to the limit. As expected, Flash wasn't quite up to the task, and it ran a bit slowly. Today Flash is a lot faster, and it is possible to create a smooth raycasting engine (check out André Michelle's excellent raycasting demo written in ActionScript 2.0). About a year later a similar technique attracted much attention in the Flash community. It was the "MarioKart" technique that PercyPea implemented in Flash. I later made a demo based on his example.

Recently I have more interest in making finished games rather than just prototypes. But Flash is still mainly a hobby and creating complete games can take a lot of time.

Q: Did you already develop games with other languages?

I started programming in AMOS Pro on the Amiga about 10 years ago. I mostly created visual experiments and small games. A couple of years later, when I finally had to face the fact that the Amiga was dying I got a PC. I did not continue to make games like I had on the Amiga. Well, I did a very trivial space shooter in C and that's about it. I think that the Amiga was very creative-friendly, and the Amiga demo scene is a proof of that among other things.

Then I encountered Flash! It was the perfect outlet to be creative again, much in the same way as AMOS had been on the Amiga. In a way, Flash reminds me of AMOS quite a bit. It's very easy to get started. AMOS also had great graphics support for its time. It was trivial to create a few sprites and move them on the screen. You even had a sprite "library" not unlike Flash. You could produce small games and interesting effects in just a couple of hours. But it was slow compared to other programming languages - another thing they have in common.

Q: Before "The Curse of Sylvaniah" you released a great Sonic engine which run very fast. Can you tell us about the engine's features?

Sure. The game world consists of graphical objects, known as super tiles. A super tile can be placed with pixel precision in the game world, and they can overlap each other. What is a super tile? It's just a movie clip that consists of one or more tiles (movie clips). The tiles can be of any size and be placed with pixel precision inside the super tile, they can also overlap each other if necessary. A super tile always belongs to a "layer" in the game world, and you can have as many layers as you want. The usual layers would probably be: background, player, sprites, enemies and front layers.

A super tile can have a sequence of coordinates associated with it which define collision lines used for collision detection. This makes it possible to create slopes and curved surfaces. The player's collision shape is a circle, which means you perform a circle-line collision detection which is relatively painless to calculate. A super tile also has a lot of properties associated with it like friction, if it should be visible or not, if collision detection should be on or off, its colour transformation etc.

There's also a simple event model. You can define an event list to run when the player overlaps a super tile or touches a collision line. An event list is basically a list of functions and corresponding arguments which is called in sequence when the event occurs. There are quite a few event functions you can call. The event lists are defined in an xml file where you specify the event list name, its functions and their arguments. For example, the rings you can collect in the sonic demo is just a normal super tile containing one animated tile. It has an event list defined to run when the player overlaps the super tile. The event list consists of three event functions; one removes the super tile from the map (it can be added again just as easily), one plays a sound, and the third places a movie clip (the stars showing for a couple of seconds when collecting them). Another example is the conveyor belt. When the player hits the conveyor belt's collision line, an event list is executed that moves the player.

I think that's the basic features.

click thumbnails to
enlarge them.

Q: What are the differences between a regular tile based engine?

The main difference is that in a normal tile based engine the screen consists of a grid of (normally) square tiles (movie clips) and you often just change the frame number to update the appearance of the tiles. By having one column and one row of tiles more than what is visible at the same time and moving the movie clip containing the tiles you can also get a smooth motion. It's a neat technique that is fast and easy. The level data is very straight-forward, it mainly consists of a two dimensional array where you store the tiles (often just a tile number which corresponds to the frame number in the tile movie clip).

The technique I use is a more object oriented approach (not in the sense of object oriented programming, but how the world is defined). Updating the view is a bit more complex than in a normal tile based engine because the super tiles can be placed anywhere and have any size, they are not confined to a grid pattern like in a normal tile based game. This requires that you create new super tiles at run-time when needed, and remove those no longer visible. You also need to have a data structure that allows you to check which super tiles are visible at any given time without too much computation. Also, collision detection is a bit more tricky because you don't have the grid pattern to rely on. I have written a tutorial which explains the method of placing and scrolling the super tiles more in detail.

Q: What are the pros and cons of using such approach?

I think the pros outweighs the cons for games with huge levels and where the level is not completely covered in tiles. Sylvaniah, Sonic, Super Mario and pretty much any other jump'n run game are good examples. But this is not something that will replace the traditional method, they both have their uses. Role-Playing games like Luxregina's Two Kingdoms which is a top view game where the world is completely covered in tiles is a good example where good old tile based is more suitable.


- Faster scrolling for certain games
- You are not limited to placing tiles in a grid pattern, which gives you more flexibility (and the ability to have the tiles overlapping each other.)
- The tiles can have any size
- It's very easy to create interactive elements like swinging ropes, falling objects etc.


- Creating a level editor is nowhere near as easy compared to a traditional tile based level editor. But by using Flash itself to design the levels this is not a huge problem.

Q: Did you develop the engine using a strict OOP design?

No, it was written in Flash MX and OOP was not really introduced until MX 2004. I will probably start to use ActionScript 2.0 in the future though.

Q: During August 2004 you have presented the great "Curse of Sylvaniah" preview. Can you tell us how did it all start?

I had talked to Luxregina about possible collaboration. I had just realeased the Sonic engine demo and I can't remember if it was me or him that suggested that we make a game out of it. We both fondly remember the arcade/platform game Ghouls'n Ghosts, so that was an influence, at least visually, and we started from there.

Q: What features can we expect in the final version?

We haven't really talked about that in detail. There will be more of the same I guess - more weapons, enemies and environments. I remember Lux talked about having a level where you have to swim under water for sections of it. I would also like to add new interactive elements to make the game play more interesting and exciting. By interactive elements I mean things like a bridge collapsing when walking on it, a lever you have to pull to open something or push an object into position and use it as a stepping stone to be able to reach a new area. There are some examples of that in the demo, most notably the ropes. If you've played Half Life 2 you know what I mean, that game is full of small things like that, and many of them utilizes the physics engine. I would also like to add more physics to the game, but don't expect Half Life 2 physics. :-)

Q: Do you have a release date?

No, back in august we hoped we could have it finished before the end of the year, but we haven't really worked on it that much since. It's just a spare time project, which means other things have come in the way. I hope we will finish it though.

Q: Can you name some of the games or other sources that inspired you for "The Curse of Sylvaniah"?

As I mentioned before, Ghouls'n Ghosts was a big inspiration visually. There's also a bit of Sonic in there as well, both in the level design and in the player's movement. Another game or rather game genre that has had an impact is the first person shooter. Most notably the weapon aim using the mouse and the weapon selection system with categories works very similar to games like Half Life.

Q: We'd like to know how did you proceed in the creation of bitmap graphics. Did you start from sketches on paper? What steps did you follow?

Luxregina did the graphics, so I can't really comment on that. Whatever the process were, I'm very happy with the result. They look not only good but also retro and true to the games of old at the same time.

Q: What bitmap software was mainly used?

Again, I'm not sure, since it was Luxregina's department. I think he does a lot of his work in Photoshop though.

Q: How did you manage tilesets? Did you keep everything in the library or did you externalize them?

The game uses external tileset files. I mentioned earlier that every super tile belongs to a layer. Each layer can use its own tileset file, which makes it very flexible. You could have one tileset with trees, another containing ruins and a tileset with ground tiles. This makes it very easy to reuse tiles over several levels. Because the tiles are imported into the Flash library when creating maps, and you can use several tilesets in the same level, a tile much have a unique name not used by any other tile in any other tileset file. But that's just a concern you need to think about when creating a new tileset file, and we've solved it by simply start all tile names in a tileset with a lower case letter unique for that particular tileset.

Q: What about levels? How do you create and manage them?

I started to write an editor for the engine, but it became more and more complex and it started to look a bit like the Flash IDE. This made me stop and realize that I don't actually have to make an editor, we can just use Flash itself! The benefit is that you can use all the tools in Flash like align, copy, paste, multiple selection, layers etc. to design the level. A level starts with a level template. A template is just a .fla file that contains some default layers including a reference to an ActionScript file. You then import some tilesets and start to place the tiles and group them into super tiles (make them into a movie clip). A super tile may not be placed in the root directly; it must be placed in a layer movie clip, and you can only have tiles from the same tileset in one layer. You can apply any colour transformation to a super tile or a layer movie clip. There are two special components - a layer property component and a super tile property component. A layer property component lets you define a tileset for the layer. You can drop a super tile property component into a super tile and set the properties. That way event lists can be associated with the super tile, friction can be defined etc.

When you export the movie, an ActionScript function is executed. It loops through all the movie clips in the root (the layer movie clips), and for every layer it extracts data describing the super tiles; their position, depth, which tiles they consists of, the color transformation etc. The data is stored as an xml structure, which is then displayed in the output window. You then save the xml as a map file and you are ready to go. In an early version of the engine I sent the new map data to the game engine directly using local connection as well. If the game was running when the map was exported, the map in the game was updated and you did not constantly have to save the xml in the output window to a file and restart the game just to be able to test the level you were working on. The only time I've found local connection useful :-)

It's not completely painless to design the levels in Flash though. It can be a bit of a hazzle to work with really large levels because you need to zoom in and scroll a lot, and when you have thousands of tiles in the level it can take some time to generate the map data - up to a minute sometimes.

Q: How did you solve the annoying problem of bitmap distortion in Flash? Have you found a good solution?

That's a really embarrassing bug - it's been there God knows how long. I set the width and height of the tiles to 0.05 less than they are supposed to be. But this is really annoying because it means that every time you place a tile on the screen you need to set the width and height properties just to solve the bitmap shifting bug, which slows things down ever so slightly. Another solution is to place the bitmap with the lower right corner on coordinate 0,0 in the tile movie clip.

Q: What version of Actionscript was used for the engine? And which one do you use/prefer?

It was written using ActionScript 1. I have only begun to use ActionScript 2.0 recently. In a way I prefer 2.0 because it's closer to "real" programming languages like Java and C#, which is always a plus. But there are some annoying things with it as well. I'm not fond of the variable type declaration in 2.0, it feels backwards:

 var myString:String; 

I know it's just a personal preference to have the data type before the variable name, so it is not a critique. I know there are other languages with this syntax as well.

Q: Do you use an external AS editor? If yes which one do you use/reccomend?

I like SciTE as a general text editor, and I've briefly tested SciTE|Flash which seems like a good editor. But for some reason I still use the internal editor. I manage the code on different layers, and test the movie very often, that's probably why I still write it in the internal editor.

Q: What are the system requirements for "The Curse of Sylvaniah"?

My computer :-) Seriously. I was mainly concerned that it should play reasonably well on my own computer. After all, what fun is there in developing a game you can't fully play? Also, I happen to have a computer that is average at best (1GHz AMD), so it seemed like a good benchmark. I would probably recommend a slightly faster computer than that for it to run really smoothly with all the options turned on.

Q: Can you tell us about particular "tricks" or optimizations you've done to the engine to squeeze bettere performance?

There's probably not one vector line in the whole game - we're only using bitmaps. This speeds things up a lot, and you can set quality to low without any difference in image quality. Also, making the screen relatively small really helps a lot. Other than that I just try to write the algorithms as efficient as I can, and use local variables whenever possible.

Q: The Flash player speed has increased significantly with version 7. Do you think its performance is enough for games?

Yes and No. It's enough for many puzzle games. It's just barely enough for action games if you plan the game carefully, know exactly what you are doing and spend a lot of time on optimizing. And that's the problem. You really have to know what you're doing if you want to make games where a lot of things happen on the screen. I think many beginners are discouraged because of this. They have neat ideas and implement it in a basic way, more focused on getting it to work rather than worrying about optimizations. And the game runs at 4 frames per second. And the advice they usually get from people is the drop the vector graphics and use bitmaps instead.

Q: Can you unveil some of your future projects?

I don't really have a lot planned. Finishing Sylvaniah would be one. Another project I'm working on is a Pinball game. It's an attempt to create something similar to the old Pinball games by Digital Illusions.

As I've mentioned earlier, I was a sucker for the good old "dungeon crawler " games. They may have been a bit of an acquired taste, but I loved Dungeon Master, Black Crypt and Eye of the Beholder (If you are unfamiliar with them they can best be described as role-playing games from a first person view taking place in... you guessed it: dungeons and similar environments).

You would think that a game where you walk in huge mazes for the entire time would become repetitive and monotonous quickly. But even though the environment may have looked a bit monotonous they really absorbed you (and when the stone walls finally did change texture you got really excited!). They had an exploration aspect to them combined with fighting, finding new items, equipping the party members and solving puzzles. I especially remember Black Crypt having great puzzles.

It would be fun to create a similar game in Flash. Either pre-rendered graphics like in the games mentioned above or by using raycasting if the new version of the Flash Player is significantly faster (it looks like it may be, but I'm not counting on anything). A game with puzzles, lots of items, enemies and ridiculously huge mazes and levels, but with enough leads to prevent players from getting too frustrated. Maybe add a multiplayer element to it, i.e. you can meet other players in the maze, fight and/or trade with them, leave helping/misleading messages on the walls etc. It's still a single player game with an objective (which could be as easy as finding your way out) but you share the game world with other players. Oh no! It starts to sound like a MMORPG, and I hate that acronym! If I had written one line of code evey time I heard someone talk about doing one in Flash I would have my own working MMORPG by now :-). It's not something I'm actually planning to do, just something I'm thinking about from time to time.

Q: And now for the last, inevitable question: what would you expect from the next version of Flash ? Any wishlist?

Faster rendering of graphics. I really wish the next version is faster in this regard. Just moving bitmaps around and especially the vector rendering. That's the main thing. There are a lot of small things that would be nice, but aren't totally necessary for me. Improved rendering has started to become very important because now the main focus is always to make the damn thing run smoothly, and it's not the ActionScript that's causing the slow downs most of the time.

Here's a list of a couple of things I would like to have added to the Flash format/Flash Player but I would trade all of these for significantly improved rendering speed (in descending importance):

- Load a .swf into a movie clip and be able to dynamically duplicate that movie clip!
- Dynamically load .png images and progressive .jpegs
- Gradient masks
- Event when the mouse leaves the Flash movie
- Fix the shifting bitmap bug. It's so old that I will probably miss it for a while when it's finally gone. But it's got to go
- Create bitmaps dynamically (just a setPixel() method would be great for starters)
- Extract frequency bands from a sound at run-time (to make equalizers and effects triggered by the sound)
- Fps property (a lot of people use a fps counter, would be nice with this as a property)

When it comes to The Flash IDE itself, I would really like a better internal ActionScript editor closer to Visual Studio's excellent code hinting, collapsable functions and search and replace.

back to SpotLight index

Have you played one of the best web games ever ?
Did you create the latest kick-ass flash game and would you like to seen it reviewed in these pages ?
Suggest us some high quality games to feature in our SpotLight!

Game suggestions HERE
| 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