OK,
Hi guys, new here...
I've been working on a flash game and decided to make it multi-player, what is the best way to retrieve the X and Y of each player and update them in real time..
At the moment I am using MySQL which sends the data to a PHP file and then flash retrieves that info.
Not sure if there is a better alternative, maybe XML or something lol
Would love to hear your opinions, thanks.. =)
Best way to update players and retrieve them?
Re: Best way to update players and retrieve them?
MySQL should work fine. I don't know much about actionscript, if there's a library that works with websockets I'd look into node.js rather than PHP. Otherwise just use a PHP script that polls the database server.
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: Best way to update players and retrieve them?
I did mess about with node.js and the new websockets for html5 etc but I couldn't figure them out and kept returning errors =/Chris wrote:MySQL should work fine. I don't know much about actionscript, if there's a library that works with websockets I'd look into node.js rather than PHP. Otherwise just use a PHP script that polls the database server.
Maybe I will give it another try, do you know any good tutorials for websockets or node.js?
Re: Best way to update players and retrieve them?
Well, if you aren't going down the flash actionscript route I'd recommend looking into Coffeescript as it's looking to be the PHP of today in 10 years.
For node.js, http://nodejs.org/
For node.js, http://nodejs.org/
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: Best way to update players and retrieve them?
cool.. thanks I'll check it out.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Best way to update players and retrieve them?
Websockets are for Javascript and HTML5, not for Flash, since Websockets use a different protocol than most other socket platforms. For Flash, you would want to use a socket server that supports "binary sockets" (which websockets are not). Some popular commercial options are Smart Fox Server and Electroserver. Both allow for a lowish number of users to be connected for free, mostly for testing purposes, but they allow you to develop with them before paying a cent. There are also several open source Flash-targeted socket servers, such as Red5.
Here is a pretty good list of a ton of open source Flash/ActionScript projects. If you scroll down a bit you will see the server section. I looked up Red5 on the list, and it just seems to be a message board now, but there are many other open source options on that list.
Here is a pretty good list of a ton of open source Flash/ActionScript projects. If you scroll down a bit you will see the server section. I looked up Red5 on the list, and it just seems to be a message board now, but there are many other open source options on that list.
The indelible lord of tl;dr
Re: Best way to update players and retrieve them?
Cool, I've been messing with actionscript 2 XMLSockets (client) and PHP Sockets (server), I figured out how to connect users and send back there X and Y positions. It's kind of buggy and trying to fix. I'll show you guys the sample when or if I can get it working properly.Jackolantern wrote:Websockets are for Javascript and HTML5, not for Flash, since Websockets use a different protocol than most other socket platforms. For Flash, you would want to use a socket server that supports "binary sockets" (which websockets are not). Some popular commercial options are Smart Fox Server and Electroserver. Both allow for a lowish number of users to be connected for free, mostly for testing purposes, but they allow you to develop with them before paying a cent. There are also several open source Flash-targeted socket servers, such as Red5.
Here is a pretty good list of a ton of open source Flash/ActionScript projects. If you scroll down a bit you will see the server section. I looked up Red5 on the list, and it just seems to be a message board now, but there are many other open source options on that list.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Best way to update players and retrieve them?
Honestly, for Flash I would use a commercial socket server. It is just a shame to not take advantage of binary sockets since they blow away every other networking option in Flash as far as speed and efficiency, but writing a custom server to use them is quite complex.
The indelible lord of tl;dr
Re: Best way to update players and retrieve them?
I guess lol, but the prices for the commercial ones are out of my price range..Jackolantern wrote:Honestly, for Flash I would use a commercial socket server. It is just a shame to not take advantage of binary sockets since they blow away every other networking option in Flash as far as speed and efficiency, but writing a custom server to use them is quite complex.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Best way to update players and retrieve them?
Check out some of the open source ones then! A stable, scalable socket server is a really complex thing, and any head start is better than no head start!
The indelible lord of tl;dr