Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-03-2009, 12:31 AM   #1
The Little Guy
Senior Member
 
Join Date: Apr 2007
Posts: 583
Default [AS3] Multiplayer game help

Im not sure if this is the correct place for this, because this is more of a design question.

I am making my first multi-player game, one that uses two computers and the internet, not two people at one computer type of multi-player game.

So, I assume everyone knows how to play tic-tac-toe (if not: http://en.wikipedia.org/wiki/Tic-Tac-Toe). So my question is what would be a good way to randomly assign one player X and the other one O?

I am not sure if anyone knows how a php flash communication server works, so I'll explain it:
- First a user connects
- The server sends flash the privacy file allowing it to connect
- Flash then reconnects to the server after a successful connection
- Flash waits until the server sends something to it
- The server receives information then sends it to everyone else that is connected

Doing this you could potentially have chat server, game server, etc.

I don't want to have to modify the php to handle the X's and O's I would like that to be done via flash, so the flash would have to check if anyone is playing if some one is playing, then check what player the other player is (X or O) and assign him/her the opposite of that.

If there is no one playing, then randomly assign the current player X or O.

Anyone know how I could tackle this?
The Little Guy is offline   Reply With Quote
Old 07-03-2009, 05:16 AM   #2
abeall
Senior Member
 
Join Date: Feb 2006
Location: Washington, DC
Posts: 2,812
Send a message via AIM to abeall
Default

I don't really follow what you are using on the backend to manage the connection of the players. Are you using a socket server built in PHP? In any case, you have two options as I see it:

1. You need a server app. The server app assigns X and O to two connected players.

2. One of the SWFs becomes a master, and that SWF basically replaces the server app. Keep in mind that this is easily hackable because you are giving authority to the client.
__________________
Aaron Beall | Flash portfolio | Fireworks extensions | Twitter
abeall is offline   Reply With Quote
Old 07-03-2009, 04:59 PM   #3
The Little Guy
Senior Member
 
Join Date: Apr 2007
Posts: 583
Default

Quote:
Originally Posted by abeall View Post
I don't really follow what you are using on the backend to manage the connection of the players. Are you using a socket server built in PHP?
Yes.

So... You reccomend having the server do all work, such as:

- choose who's turn it is
- choose who starts
- choose who won
- choose who lost
- etc.

If I were to do it that way, how would I then be able to make multiple games like this ex: checkers, connect four, mmorpg, etc.?
The Little Guy is offline   Reply With Quote
Old 07-03-2009, 05:46 PM   #4
bluemagica
Senior Member
 
Join Date: Feb 2008
Posts: 387
Default

Just play the game on server and get input and output on client! I don't see whats so hard about that.... everything is just a bunch of calculations, whether its a pong or a MMORPG, so just do that on the server, where the players have no direct way of fiddling with it!

Oh, and what's with the "privacy file", don't you mean a policy file? And what type of server are you using? php based socket server? xml sockets? java server? or what?
__________________
My Site :- http://blog.bluemagica.com

I need a spriter, and a story writer for arcade fighter and a side-view RPG. If you can help, please pm me!
bluemagica is offline   Reply With Quote
Old 07-03-2009, 06:42 PM   #5
The Little Guy
Senior Member
 
Join Date: Apr 2007
Posts: 583
Default

Quote:
Originally Posted by bluemagica View Post
Oh, and what's with the "privacy file", don't you mean a policy file? And what type of server are you using? php based socket server? xml sockets? java server? or what?
Yes, a policy file, sorry.

I am using a PHP Socket server.

So, lets say I wan't to make more than one game, does that mean I will have to make a server for each one?
The Little Guy is offline   Reply With Quote
Old 07-03-2009, 07:07 PM   #6
bluemagica
Senior Member
 
Join Date: Feb 2008
Posts: 387
Default

Well php is fairly object oriented in its basics now, so if you keep your game logic separate from your server logic, you can just extend a core server!
__________________
My Site :- http://blog.bluemagica.com

I need a spriter, and a story writer for arcade fighter and a side-view RPG. If you can help, please pm me!
bluemagica is offline   Reply With Quote
Old 07-03-2009, 07:15 PM   #7
abeall
Senior Member
 
Join Date: Feb 2006
Location: Washington, DC
Posts: 2,812
Send a message via AIM to abeall
Default

Quote:
Originally Posted by The Little Guy View Post
I am using a PHP Socket server.

So, lets say I wan't to make more than one game, does that mean I will have to make a server for each one?
Are you custom developing this PHP socket server? You definitely shouldn't need multiple server instances running to have multiple games going on at once. The server should be able to take connections and manage some type of room/game listing which it can pair up players in, or players can choose a game to join or start a new game, etc. The server can then loop through all active games and update as needed.
__________________
Aaron Beall | Flash portfolio | Fireworks extensions | Twitter
abeall is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:32 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.