PDA

View Full Version : Multiplayer With PHP



dangerskew
November 26th, 2004, 10:59 PM
I'm going to make a multiplayer game, and I was wondering what the code is to make flash on different computers to exchange variables. The way I'm going to have it is instead of giving PHP a whole bunch of numbers about differen't people's positions, I'm just going to make it send 1 array from each person. This array will have two things in it: The name of the person who sent it, and a number representing any keys on their keyboard they hit. I know it will run slow, but it seems simpler then an XML Socket. Can anyone explain how I would do this?

ghjr
November 27th, 2004, 09:20 AM
Hmmm... I thought you would need a socket server to broadcast variables to all the different clients (computers) connected. Maybe I didn't understand the question.

Cheers!

dangerskew
November 27th, 2004, 10:19 AM
It works for a high score table.

ghjr
November 27th, 2004, 11:18 AM
So you want to input this array of movements into a database of somesort, then the other players retreive it from that? Other than that the only way I could see the array being broadcasted to other players would be through a server type setup, but then again I don't mess around with this that much (just starting out my own small multiplayer game).

Or you just want to display a high score table?

Cheers!

RvGaTe
November 27th, 2004, 12:11 PM
This is possible with php...

php can open ports and CAN be event based if you know how to.. but this is a bit TO advanced (the kirupachat works on a socket server created with php)

also, you need to be able to execute scripts on your linux server (executing them with SSH)

the best thing to start with would be >this< (http://www.devarticles.com/c/a/Flash/XML-Sockets-in-Flash/) page, it gives you information about how socket servers work, and it gives you an example on a simple Perl socket server.

take a look, it helped me much to create cool applications :)

dangerskew
November 27th, 2004, 01:13 PM
Would it be possible for there to be a tutorial that explains it under the assumption that you have absolutely no idea what you're doing?

ghjr
November 27th, 2004, 09:01 PM
gotoAndPlay has great flash tutorials that talk about servers, here's one of them to start:
http://www.gotoandplay.it/_articles/2003/12/xmlSocket.php

They even have a free java socket server for you to download:
http://www.gotoandplay.it/_articles/multiplayerCentral/

Cheers!

alzor
November 29th, 2004, 11:16 AM
ok so I am working on a first person engine, It's coming along well... most people said it wasnt very likely a fully working fps engine could be done in flash and especially not one that looks decent, I proved that wrong. now I heard the same about making a real time multiplayer game... so I wont ask how possible it is to add a real time server based multiplayer type of deal to my engine, but I will ask do you think it's possible at all? Im very unclear on whether realtime multiplayer games are possible in flash.since we're on this subject?

ghjr
November 29th, 2004, 12:42 PM
Hmmm... yea it is possible. Like I said, gotoAndPlay has a java based socket server that you can use together with your multiplayer application or game.

http://www.gotoandplay.it/_articles/multiplayerCentral/

I'm not sure that a large multiplayer game would run smoothly over flash though (with tons of players on at all times). It's size/player cap would probably have to be limited to some extent (just guessing here).

Cheers!

Dr Warm
November 29th, 2004, 08:18 PM
There are many other sort of plugin servers for flash apart from the one at gotoAndPlay, like elecktroservers (i think they're called) and you can buy one from macromedia. The one at gotoAndPlay is limited (or was anyway) to 50 players online at one time, but i'm sure they all have some limits!

alzor
November 30th, 2004, 01:25 PM
electro server looks sweet

Ben H
December 3rd, 2004, 02:43 PM
FLASH COMM SERVER!

I would use Flash Comm, it is so easy to do things with!