Best way to update players and retrieve them?

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
Echo
Posts: 16
Joined: Wed Sep 28, 2011 5:01 pm

Best way to update players and retrieve them?

Post by Echo »

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.. =)
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: Best way to update players and retrieve them?

Post by Chris »

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.
Echo
Posts: 16
Joined: Wed Sep 28, 2011 5:01 pm

Re: Best way to update players and retrieve them?

Post by Echo »

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.
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 =/

Maybe I will give it another try, do you know any good tutorials for websockets or node.js?
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: Best way to update players and retrieve them?

Post by Chris »

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/
Fighting for peace is declaring war on war. If you want peace be peaceful.
Echo
Posts: 16
Joined: Wed Sep 28, 2011 5:01 pm

Re: Best way to update players and retrieve them?

Post by Echo »

cool.. thanks I'll check it out.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Best way to update players and retrieve them?

Post by Jackolantern »

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.
The indelible lord of tl;dr
Echo
Posts: 16
Joined: Wed Sep 28, 2011 5:01 pm

Re: Best way to update players and retrieve them?

Post by Echo »

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.
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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Best way to update players and retrieve them?

Post by Jackolantern »

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
Echo
Posts: 16
Joined: Wed Sep 28, 2011 5:01 pm

Re: Best way to update players and retrieve them?

Post by Echo »

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.
I guess lol, but the prices for the commercial ones are out of my price range..
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Best way to update players and retrieve them?

Post by Jackolantern »

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
Post Reply

Return to “Advanced Help and Support”