-
I am creating a two player game (2 different computers). When a player moves, mc's change frames, and the other player must see the change. I am thinking of using php and/or mysql.
Can php do it alone, or do I need a database?
Also, does anyone know of a tutorial or example of this?
gamist
-
Hiya!
Neither PHP or the loadVariables Actionscript command were designed to facilitate this kind of multiplayer action. Thus, you'll find that implementing anything other than a slow turn-based game (like checkers or tic-tac-toe) this way.
If you decide to go down this route then you will need some way of storing the information from one player so that the other player (or, more precicely, their Flash movie) can read them later. A database like MySQL would be the most efficient way of storing such data, although a simple text file would also work!
If you're after something a bit more quick paced then you'll need to be thinking about taking adtantage of the XMLSocket object within Flash 5. This allows you to create (and maintain) a link with a process running on your server that will allow you to communicate between different users on your site.
If you need further information on the XMLSocket object check out the Actionscript dictionary that came with Flash 5. There's also a chapter dealing with XML and the XMLSocket object, as well as using PHP and MySQL with Flash, in Flash 5 Dynamic Content Studio.
I hope this helps!
Regards,
Steve
-
...and welcome to FlashKit! Enjoy your stay!
Regards,
Steve
-
thanks Steve
I already own the book, so I will check out the xml chapter. I hope the xml chapter is as clear and as helpful as the php and mysql chapters were.
It's good to know that the php and mysql will work if I need them. This is a "one turn at a time" game, but I don't want it to be slow. I'm sure it depends, but how slow are you talking?
Although, it may be good to have a database to store old games. Anywho, I'll see what xmlsocket is all about. Thanks for your quick reply.
gamist
-
Hiya!
You're welcome! I'm glad you find my chapters useful. Feel free to give me constructive critisism on them - it was my first authoring gig and I'm looking to improve for upcoming books! Also, if you need any PHP/MySQL help with your current project then just ask - I'm usually around these parts daily !
As for the speed issue, it depends on how lenient your hosts are likely to be. You could call the PHP script every 2/3 seconds to see if the other player has made a move but you're talking a heck of a lot calls that the server has to respond to just to say "no move has been made yet". On the flip-side, you could call the script every 15 seconds, cutting down on your server load but increasing the maximum time it can take for a move to "appear".
I hope this helps! Let me know how you get on!
Regards,
Steve
-
__OSX powered__
director multiuser server
For Multiuser games, the multiuser server that comes with director is exellent for that task.
The only drawback is that it is few servers out there actually supporting it...
NuCleuZ
and yeah: anyone know if it's possible to use the director server with flash? (that would be greaat!!)
-
xml or director info?
Steve,
I read the bulk of the xml chapter. There seems to be a lot to it. I am going to research the topic more. It seems to be better than the php idea. Do you know of any other good sources for xml, and what I want to do?
Nucleuz,
Do you know of any examples I could check out? Thanks.
-gamist
-
Hiya!
Check out the XML forum here at FK for lots of info/ideas on XMLSocket programming. If you do a search you'll even find a few XMLSocket server programs to download!
Regards,
Steve
-
__OSX powered__
-
One comment I want to add, we need to make XML a more viable solution, and this would mean including proxy and SOCKS support for our client connections. As is right now flash XML gaming is a no-no for some systems' admins, until we can write a better client that supports a firewall, php/mysql is the way to go... kinda slow, but it works, as it uses port 80 only.
KappaMax
-
Has anyone had any success making XMLSocket connections via SOCKS? Is it possible or is it a limit of Flash?
I can't even seem to get it to work by creating a custom proxy on the firewall (calls to port X are routed to custom external ULR port Y).
Rob
Rob Davis
rob@solarismedia.co.uk
-
Hi,
I am just playing with a port forwarded via a ssh session - this way the client sees the service on localhost
Maybe this would be an option too
Musicman
-
Hi Musicman
Can you explain what you're doing there in a bit more detail.
I'm wanting to make it so that people behind firewalls using my Flash app can still talk to my server by XMLSocket.
Rob
Rob Davis
rob@solarismedia.co.uk
-
Hi,
surely this is a different arena, but here it goes:
I open a ssh connection to some other server (obviously I have a shell account there, and can create servers). When opening the port, I specify that local port x should be forwarded to port y on server z at the remote side. Now a local app believes it is talking to port x on the local machine, and I do not have to drill any holes into the remote firewall - I am just using ssh.
I am using this technique in two different scenarios
a) reading my mail from outside, where I connect the local mail reader via this channel to the machine that stores my mails
b) maintaining a remote site through a web frontend running on an internal machine only
Now, which outgoing connections would a typical firewall setup allow other than http - ssh might be a good choice; you would just give those users a login that cannot do much other than checking whether the socket server is running. Dont try to use protocols like ftp or mail - some firewalls might detect that the data does not match ftp protocol
Musicman
-
My hosting providers seem doubtful about that solution unfortunately
Are there any other ways of doing it? Either from the client or server end?
Maybe at worst I can provide people behind firewalls with a good FAQ.
Is there any way to implement Flash XML socket over SOCKS?
Rob
Rob Davis
rob@solarismedia.co.uk
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|