PDA

View Full Version : Online Multiplayer Flash Games



Perditus
September 2nd, 2010, 12:07 AM
There are quite a few flash games out there that support online multiplayer modes, off the top of my head Platform Racing 2, Exit Path, and Achievement Unlocked 2. But, the issue I've noticed with these is their ping, it usually takes awhile to connect to the server and to get updates on status and positions of other players, but does is this problem with the servers, the game's programming, or with flash itself? Would it be reasonable to attempt to make a fast paced game that requires real-time online capabilities? Or would it be better to take an alternative root by using an actual game engine, although flash would be preferable.

darnpunk
September 2nd, 2010, 11:59 PM
It involves every single node in the flow. Ping can depend on server, how you program the game client and also network connection. I've seen multiplayer real time games done in Flash. You can try compensating lag by predicting. There is a technique somewhere that I've read up before on setting up some kind of system to find out how users play the game. You then use these information to compensate the lag by prediction.

I remember it was something close to that. You can try do a search on it. Anyway, multiplayer games involve a lot of other effort especially on security (client cheating server etc). So you may want to try look that up as well.

Good luck!

Broadsmile
September 4th, 2010, 04:13 AM
There are quite a few flash games out there that support online multiplayer modes, off the top of my head Platform Racing 2, Exit Path, and Achievement Unlocked 2. But, the issue I've noticed with these is their ping, it usually takes awhile to connect to the server and to get updates on status and positions of other players, but does is this problem with the servers, the game's programming, or with flash itself? Would it be reasonable to attempt to make a fast paced game that requires real-time online capabilities? Or would it be better to take an alternative root by using an actual game engine, although flash would be preferable.

My benchmark shows a result of 50 ms lag with a local server on flash actionscript 3. I don't recommend anyone asking (not experienced) trying to make a real-time online game in flash. Sorry.

Gathan
September 13th, 2010, 11:50 PM
The delay is a combination of network lag, the time it takes the data to get from your pc to the servers pc.
Then once it gets a message, it has to go through the processing phase, do login verification if thats part of its job, then get a message together to send back.
The more logic you add to the server, the longer the phases are going to be, not necessarily the initial process phase for a incoming message but rather the processing it has to do after that, which might involve making sure the data coming in is correct, that the player isn't trying to cheat, etc.
This of course all eats up on the cpu cyles the server has available, and with hundred and thousands of connections this can equate to quite alot of time spent on just doing checks and that doesn't even involve the processing of incoming messages or sending new messages out.
The reason it seems that its taking so long is because of all of the above that is probably happening, of course if the server has a good network foundation to handle all of the incoming and outgoing data it helps, the server itself though is limited to what resources it has available, having a faster server would surely help the situation. That though could lead to server thats to expensive to run.
So you gotta do a cost/benefit analyze when doing any part of the server side logic, most importantly as with what has been stated in regards to cheating.
That being said, its quite possible to make a fast paced multiplayer game in flash.
Remember to take into account all of the variables that are present, don't just update the position of a player each time the client servers a new packet containing the coordinates.
I would instead use the old data you have previously and predict possible future positions, this of course can be wrong as the player changes their mind about the direction they are going. Most of the time the results of prediction can be quite good, and gives the illusion of continuous player updates. There is of course noway to complete prevent players from jumping around a bit, you can further optimize the algorithms to help minimize its visual appearance on the game, but its always going to be there.