I wrote a XML Socket server in PHP recently because I wanted to make a multiplayer Flash game in AS3. This server is supposed to be completely generic and doesn’t have any game logic. You should be able to build pretty much any game with this server.
While writing it I realized the new version for Flash Player 9 r115 had some new security issues surrounding Sockets. So I implemented a crossdomain.xml and modified the XML Socket server to serve a crossdomain.xml file if it encounters a security request. The security policy socket server runs on 843 always (it’s the default port flash player looks at).
Along with the PHP Socket server I wrote an XML Socket client in ActionScript 3 (AS3). This set of classes is also completely generic and is completely event driver. Your game client would include this file and pass it parameters through the Events classes in order to communicate with the socket server.
Lastly I created a very simple game / prototype using the AS3 class and PHP server. It is very basic, each player gets a ship, and can move around and shoot at other players. However I implemented all of the funtions: Logging in, Logging off, Synchronising players and movements, creating objects (ie firing a bullet), etc
This code is open source and can be used completely free of charge. Please let me know if you’ve found it useful or used it anywhere.
Lastly if you are a designer or programmer and have an idea for a multiplayer web based game, please contact me.
If you have any issues with the code or if you’d like to ask me some questions, don’t hesitate to email me.
Permalink: PHP XML Socket Server
You must be connected to post a comment.