Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 21515
  • Last Modified:

Flash Multiplayer Game

Hi. How do I create a multiplayer game in Flash? I can use and understand actionscript but I dont have experience of MySQL, or PHP, or ASP. As I have allotted 250 points to the answer to this question - i would like the answer to include code aswell please. Thanks :D
  • 2
3 Solutions
Creating any kind of game is not as easy as it sounds, let alone a multilayer game. There are several things you can do to create a multiplayer game. The 1st one would be through the use of PHP, MySQL, etc. These kinds are rather slow and would be recommended for games like chess, tictactoe, checkers, etc. The 2nd type would be through the use of sockets. Socket will allow you to create a more real time interaction between players and can allow you to create games that require faster reaction times. In creating a game, you should ask yourself the following:

1.) What kind of game are you making?
2.) Is it feasible in flash and what technique should be used?
3.) Do you have enough experience in using flash to create a game?
4.) Do you have the time to create such a game?
5.) Do you think you'll be interested all the way in making such a game?

Don't overlook any of these questions because game development of any kind is very difficult and time consuming.

Finally, there is no single code that can help you create a good multiplayer game. If you're really willing to make a game then my suggestion is to do some experiments in flash on how to use PHP, MySQL and the XMLSockets to accomplish things. Once you get a good feel on how to use them, you would have completed the 1st step to creating multiplayer games in flash.

What kind of game would you like?

Something slow? like chess, checkers, ...
Or a real-time game, (mini shooter, ...)

And, yes, what exactly is your question?
The question: how do I create a multiplayer game?.
Where exactly are you stuck?
have you ever written a single player game?
What is your level of expertise with Flash?

I'd recommend some smaller projects, maybe a small single player game, or checkers, Battleships, ...before writing a full multiplayer game.

However, if you're gonna go trough with this, I wouldn't use php and mysql. Those are good or keeping highscores, ... But they're too slow for most of the things you want to do (definitely if you want something like a shooter game you need a direct connection between your clients to do that).
You can use a direct connection, trough XML Sockets, like trigger-happy already said.

Developing a game will consume lots ADN lots of time, lots of frustration and points where you'll be stuck, or bored and want to give up. Definitely if you haven't exactly coded much yet.
However, I do not know your level of expertise, so... good luck.
If you have more questions, feel free to ask, but ask more 'specific' questions.

We can't write some sample code for something as big as you want.
Here's a quick tutorial on the use of XML Sockets.

It makes you able to write a simple chatbox.
Now, as you see, the server code is NOT Flash.
You'll need C++, PHP, Java, ... to do you serverside coding.
I'd recommend Java.

Anyway, to get you started.
You have to send messages from the client to the server, which then can send that message to other clients.
So, let's say character 1: Mario moves forward. He will have to send a message to the server, that he moved forward.
The server will tell all your other clients that Mario moves forward. When your clients receive this specific message, you have to let Mario move.

I never did this in Flash, but it's pretty much the same for Java, where I have written small multiplayer games.

Some more advice: don't start off expecting to write the best game ever.
Start with small minigames. Later, you can use the code, and everything you've learned to create better and bigger games.
I've done multi-user flash apps with both Java and C++ server... PHP might be a bit too slow for anything being done in real time. AquaServer is an open source java server designed for use with flash clients that configures pretty easily right out of the "box". I'm not sure if this has been fixed or not, but there was some issues with non-threadsafe operations during client logon.

Of course, the easiest solution, if you're already comfortable in ActionScript, would be to look into Adobe Breeze. I don't know what it costs, so that might be a deal-breaker right there for you, but it's designed specifically for multi-user applications (games falls nicely into that category). After viewing the developer version (they released a version that allows you to simulate a multi-user session by running multiple flash instances running on the same box, to make it more available to programmers), I'd estimate it cuts out 95% of the coding drudgery and lets you work with the high-level concept of the game rather than the details of implementation.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now