March 7th, 2004
2iceMP is a powerful tool for developing multiplayer/multiuser flash applications that is going to be released under LGPL license very soon, in March 2004.
Here follows a long interview with its author, Nilsen Filc where he talks about the many features of his software and future plans for his interesting project.


- Can you briefly describe what the 2iceMP project is about ?

Sure ! 2iceMP is an acronym for "2ice Multiuser Platform".
The project is made to provide anyone a communication framework, composed of both a modular communicationserver written in Perl, and a Flash API.

The framework is focused on tcp workflows: Chat system, multiplayer games... A direct online link with other people. For example, 2iceMP features a chat interface API, with games integrated,
such as a tetris game where players can play against each other.

The Flash API uses the xmlsocket() ability of Flash to communicate with the Perl server in tcp protocol, enabling all sort of multiuser usages.

- Tell us a bit about the early days of your project, when did you start?

The project started in July 2001: I was looking for a way to do inter-communication online.
So for some time I worked on simple Flash clients which "talked" through HTTP with the help of PHP scripts and a database...
But I soon felt the limitations of such a system: no real time interaction allowed.
Hopefully, I discovered Flash 5's xmlsocket() ability at that time.

Then, I saw Habbohotel (Shockwave client) in late December 2001: I thought this was pretty interesting.
It gave me Envy, so I started coding. I was concerned with Flash's lack of processing power, but I was confident. In a week the first core of the server was written, with a Flash avatar client based on HabboHotel's gfx. It worked fine.

(You still can see it online -> www.ventoline.com/virtual).

I began to believe that Flash could do the job with a genuine TCP server.
I then really started coding the server.

- How many people were involved in this project?

Not many Deq, a Perl coder, helped me out with the early version of the server.
Smanux, a Java coder, started at the same time, in early 2002, a similar server project - Jetrix written in Java - but aimed for the Delphi "tetrinet" game client (online tetris).
We started to program side by side, sharing ideas about features to implement in our servers
and even compared them from time to time Java and Perl ...

I spent time alone working on the project, until I met people who helped me improve the features of the client/server, especially when a dedicated version of 2iceMP for a community web site (http://www.igotnostyleatall.com) was done.
They wanted everything, right now ! I'd like to thank them all for the faith they gave to the project (Lund, Ajn, if you read this).

Today, Pascal, a Unix administrator, is caring about the Unix boxes 2iceMP was developped on and is running on. He encouraged me to stabilize the server and helped me improving the security matters.

- Tell us about the release of your 2iceMP and its open source licence

2iceMP is going to be released in open source around mid March 2004.
It will be free software under the LGPL license (Lesser General Public License).
When we speak of free software, we are referring to freedom of use, not price.
I encourage developers to get it, see what it can do - anyone is free to use 2iceMP.

The first open source release will probably be blundled with some multiplayer games examples.
There are progressive releases of add-ons modules planned:
Games such as Othello; applications like the shared white board;
And for those who want to go further, there is already an AStar(A*) add-on released.
A hint about what 2iceMP is aiming at.

As 2iceMP is modular, it is easy to implement new commands - and therefore add new games or enhance
existing ones.

Also, 2iceMP has local adaptations. English, French, Spanish, German, Dutch, Finnish and Swedish so far.

- Will you release a set of Flash API together with the server ?

Yes. The chat interface, which evolved much. And games.
At the moment, it is all in one piece - the full interface featuring the chat, connect4, othello, tetris, the
shared whiteboard; it is around 120kb. I will split the interface and games and applications apart.

I think that the Flash API's internal scheme is to be assimilated fast. It's no wizardry !

click thumbnails to
enlarge them.















click thumbnails to
enlarge them.

- Many of the multiuser server known by Flash developers are coded in Java, why did you choose Perl ?
What are the pros and cons ?


Well... not an easy question. I guess I wanted a solid open source language. I had worked with Perl before, and knew it would suit the job.
As an "old" language, Perl has plenty features, a good security. And it keeps evolving.

For the pros: it is open source (Java isn't yet); it needs few ressources to run; syntax is short; and finally
in terms of power processing, I think Perl is more to be compared to C than Java.
As for the cons...No multithreading until Perl 5.6 : this caused me some headaches.
But I used the fork parent/child process method (as Apache 1.x does) to bypass that.

Also, no true environment tool to code with. I mostly used a notepad to program.
Perl is a classical "find that very comma missing among thousands lines of code".
And, syntax can sometimes be cryptic ... maybe to put among the cons, as only one single line in Perl can be achieved in like 5 lines in an other programmation language.

But I don't want to discourage anyone ! ActionScript syntax is near the Perl syntax.
In the end, at least Flash developers will have a range of languages to work with, if they need a multiuser
server.
I like that idea.


- A lot of people seem concerned about stress testing and performance. Can you give us some
performance numbers about your server ?

Early tests were made in 2002, with the avatar chat room client and the very first version of the 2iceMP server.The computer it was running on was a Linux box, 800 mhz, with 256 MB of ram. It never bypassed 2% of cpu and 2% of the ram, even though our tests concerned only 65 people connected to the server.
The Flash 5 client reached its limit quickly: 30 characters moving together on a single screen at most on a 733mhz terminal for a decent speed.

Today, the demo 2iceMP server is running on a 1ghz Linux box, with 1GB of ram. Again, cpu and ram usage is very low (around 3%) even with 100 people.

The limit of such a server depends mostly on the hardware. The first barrier you might reach is the login buffer overflow: how many users at the very same time will the server let in ? It is a common question. One would probably make a dedicated "login server" if he aims to welcome more than 1000 connections at the same time.

In terms of transmission speed, the server runs very quick. I'm used to get great pings, even with many users playing online. Perfect for games.

A good thing is that Flash is pretty much faster than it was before. For example, it can display much more characters on a single screen now.

- Does 2iceMP support database interaction ? If so, which databases are supported ?

Yes, 2iceMP supports databases. I choosed the DBI module (available for C, Perl) which connects to many
databases systems, like Oracle, PostgreSQL, MySQL.
In fact, 2iceMP used flat files at first... Perl is very powerfull at processing huge flat files.

But even if it is, it doesn't give the flexibility of an SQL language, and it occured general performance - a
direct link with your previous question - would be greatly enhanced with a database server handling all the datas, such as login/passwords of users, save of their games scores, their statistics...

By letting the SQL server handle all data, the 2iceMP server is saved time for handling its sockets and
sending messages to users.

A typical example: what if you had to do a Scrabble online game, enabling 4 players per room to play together, and that you had 50 rooms ?
You wont be able to process those huge flat files containing the English Official Scrabble words reference
(something like 250.000 words for English) just to verify if this or that word exist. The SQL server does the job very much better than Perl.

Today, the French and English Scrabble database (700.000 words) are inside the 2iceMP SQL database.
Within a single command in 2iceMP you can check if a word exists, and it goes fast.

The database system truly opens gates. Therefore I would recommend a database to fully use the potential of 2iceMP MySQL commands are implemented today in 2iceMP. I think I would switch to Postgre in a near future.

- About socket communications in Flash there's an interesting debate about the way data that is sent
through the socket. XML seems to be a very popular choice although someone says it can lead to bandwidth waste. What solution did you implement ?

I was indeed tempted by XML for server protocol.
But I share the idea that it is a bandwidth waste, as well as a parsing time waste for Flash, even if small data is sent/received/processed.

On one hand you may have a normalized protocol, but where informations are drawn among encapsulation (<player><command><direction>WEST</direction><command></player>),
and on the other hand, a not so normalized protocol - it all depends upon your organization - (playerDir=WEST) but where informations represent more "weight" than encapsulation.
So 2iceMP has its own protocol, which is not XML.

Funny thing to state "xmlsocket server" when there is practically no xml around.

- What about security ? Did you implement particular solutions to avoid message flooding and other hacking attempts?

2iceMP has an internal clock which counts the messages sending rates/second (setable), to prevent flooding.

Security is a large domain.... a consequent part of 2iceMP is dedicated to it:
for example, there is an authentification scheme for a connection that the client must respect.
Nothing too complicated, but it is a first barrier to prevent flooders (until they get the scheme, and they
will get it sonner or later).

Then, to enhance security, the server can be configured in three access modes: free for anyone to access, oronly registered users allowed in, or only a given list of people or ips.

They are other security related built-in features, such as the limit of connections per ip, the receive buffer
limited to xxxx bytes, automatic alerts when something is wrong.

Also, the users are "secured" inside the server. I insisted on the level difference you can attribute to users: there can be normal users, operators, administrators... very similar to the IRC, if you are familiar with it (+v, @).
Operators can kick out of the server naughty people, the administrator(s) can ban ips; around 20 power
commands are available for managing users.

Moreover, there is a bad words filter, even some (ro)bots who simulate an online activity on the server: they can have a schedule and perform different tasks at given times. This feature is likely to be extended.

- Did you create tools for the server administration ?

Several administration services are implemented in 2iceMP:
a log reporting on flat files or on database, a statistics reporting via database or even sent by email (sent by the bots),or complete statistics can be seen while loggued in or off the server.
You can send mails to any registered users, manage their accounts...

The current status of the server can be displayed directly on your web site ;
the LGPL release will include some PHP scripts to parse or gather data from server, in order to display them on a web site without being connected or use Flash, for example.

- Do you have some demo flash applications that interact with the 2iceMP server ?

Of course ! A shared white board exists, where people can draw together.
There is the avatar chat room, where avatars move around... We even tested in early times a Bomberman clone. Several modules are under way...
Maybe in a near future a chess game, a bust a move clone, or a scrabble game.

- What are the main difficulties in creating a multiplayer game ?

Having a good modular server .
My first multiplayer game attempt with 2iceMP was Bomberman. It was not a success.
Flash slowed down very quickly, data sending/receiving rate was too high, the game was laggy, 3 players could not play decently !
I learned at that time that I would spend much time optimizing the server code and the Flash code. And think long about what and how to transmit data on a multiplayer game before starting anything.

The first difficulty is to realize what are the abilities of Flash <i>and</i> the server when they are combined together.

All sorts of multiplayer games are not possible yet ; I won't say that a multiplayer Doom game is not possible technically, but I would think twice before starting such a project: the data sending frequency rate might become high, very high for Flash as we have it now.

What I mean is that at the moment, turn based multiplayer games are a reality handled without any problem by Flash. Board games, such as othello, connect4, chess, battle ships, or card games, such as poker, suit the job well.

They require one action at a time by a player, then another by another player, step by step.
Tactics Arena is a very good example of a beautiful and thus typical turn based game.

Increasingly, a multiplayer tetris becomes more complicated: it is a good "limit" example of what you wouldcall a turn based game,as the players seem to play at the same time.
The game speed can be fast, very fast - players receive blocks, arrange their fields, make "lines",
send to opponents lines with a missing square in it, in order to "push" the opponent to make a mistake ; theywatch the opponent field raise up until victory .... I think you get the picture: much data is transmitted, and Flash is not very good at processing many different things on a single stage.

But tetris remains a turn based game, where you can draw latency sequences, even if they are very small.

It was interesting to do a fast multiplayer tetris in 2iceMP.
I spent a lot of time on the code optimization, especially in Flash, for slow computers to compete in equal weapons with faster computers.

This brings us to the second difficulty: there are many ways to achieve one goal, especially with Flash.
I would recommend to take time writing down all the needed commands by a Flash multiplayer game. The vital commands only.

I'll take the tetris game as an example, a rough view of what is being done by both Flash and the 2iceMP server:

- Step 1: Tetris game request from player A to Player B
- Step 2: Is the Player B already in game ?
- Step 3: Start of the game.
- Step 4: Flash chooses the pieces (not server).
- Step 5: A player downstacks a piece, his field is sent to the opponent for letting him see his progression.
- Step 6: A player makes 2 lines, sends the opponent a line with a missing block.
- Step 7: Field of opponent has changed due to the line sent, receive the new field of the opponent.
- Step 8: Display event messages, such as "Player A sent two lines".
- Step 9: Repeat until someone looses.
- Step 10: End game and display scores / statistics

Step 4, the server could be sending the same blocks to players. But it is not vital for the game.
Steps 5, 7, 8, it is not vital to see the opponent field, but where is the gaming value when you are not informed about what's going on ?

Of course, the fields sending of the opponent is quite "heavy" to transmit, and will slow down the game.
What to choose ? Smile when you see your opponent crawling, as he begs for mercy (it's a puzzle game), and it will require more work and "tricks" in order to maintain a correct general speed. No smile, and then it is simplier.

A tricky question, this is what you encounter when creating a multiplayer game.

- Since every game has different internal logic, is your server extensible to accomodate
different game logics ?

Indeed. Simple games as board games require few "commands" to run, therefore are easily managed by the server at the same time.
You can see that tetris, connect4, othello, the shared white board coexist.
We could make room for a scrabble game, with special rooms designed for it, or 30 more different board games, the server being enough extensible to care about them all at the same time.

Say you would like to do a MMORPG with Flash - the very next step to cross (I think about LuxRegina in his interview last month on your site, Two Kingdoms RPG): then I think you must focus the framework exclusively on it.

The more sophisticated the game logic becomes, the more you need to focus your framework. But who knows ? Even in a MMORPG, you lead your avatar into taverns to drink virtual beers. And what's that in the left corner ? A virtual multiplayer pacman arcade machine from 1981 ?

- What limitations do you currently see using Flash as a client for multiuser applications/games ?

The major limitation using Flash for multiuser applications or games is that speed execution difference
terminals would get - for turn based games, as a golf game, playing on a 500mhz commputer or a 3ghz computer won't make a difference.

But on a race game, for example, the user who has a 500mhz computer will have more difficulties to compete versus the user who runs on a 3ghz machine, as he will not get the same framerate.

You need some time until you tweak your code for it to be played fast enough by the Flash plug-in on a wide range of computers. Unfortunately Flash requires much cpu power, especially with the OOP.

Hopefully, the computers general park on the Internet is improving fast, and 1ghz computers getting common: it is enough to run most of Flash multiuser applications.

Your imagination, and the time you wish to spend on a game or application are now the real limitations I could see if you wish to use Flash for multiuser apps and games.

- What features would you expect from the next version of Flash ? Any wishlist ?

Yes. Database direct communication would be good (getting rid of third party scripts to talk to a database), as well as speed execution improvements !

The Flash plug-in is light (around 150k), I know that it is part of its distribution/implementation success, but if it was 50k more and could lead to 25% additional execution speed...
No 3d handling yet is maybe agood thing, for us to "push" Flash.

- Can you unveil some of your future projects related to 2iceMP ? Future enhancements ? Game related projects ?

The open source release is important for 2iceMP's future, and that is what I am currently working on.
A Bust a move clone as well as a Scrabble game for 4 players are planned, but they need time.

A MMORPG framework try might be under the works, also.
An Astar (A*) algorithm is integrated server side since last month on 2iceMP and it works well, with a 2d isometric Flash client. I'd like to thank Noir, Jtadore, Pack, Deq, Lund, Ajn and Dieter for their time on it.

I hope more people will push the online possibilities of Flash: I therefore encourage everyone. Flash more, flash merrier !

 

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