简体   繁体   中英

AS3:Multiplayer Game by using AS3 with PHP?

I try to search on the Google about "Online multiplayer game" by using AS3 with PHP,because I'm going to develop Flash game that all the user can login and create his/her own character that they can walk around and Chat in the living room.

My Plan is

MySql sent User_Information to PHP then sent data to Flash (AS3) for display the information

(I try to use PHP because now I'm using PHP sever and I don't want to change it, Sorry for that )

MSQL > PHP > FLASH

I did some result from Google but I got AS3 with C#

https://playerio.com/documentation/tutorials/building-flash-multiplayer-games-tutorial/

and AS3 with JAVA

http://techylib.com/en/view/hihatclover/free_ebook_actionscript_3.0_for_multiplayer_game_and_virtual

so there are any way that I can use AS3 with PHP then MYSQL

I use AMFPHP ( http://www.silexlabs.org/amfphp/ ) to talk to a remote server. It's free and super easy to install. Check out the documentation here ( http://www.silexlabs.org/amfphp/documentation/ )

There exist other MMO technologies for flash that scale much better than AMFPHP.

When building an MMO, consider how the backend will handle failure. Some level of failure from a really busy service is inevitable. The question is how many users are affected by a failure.

Scalability issues differ if the server side is a 'stateless' REST based protocol, or you are building a server that keeps state within server memory.

If you really put a load on AMFPHP, the AMF Serializer will drag the server's performance exponentially. It is simply not a linearly scalable algorithm to convert from Java to AMF serverside.

I've found that SmartFox Server ( http://www.smartfoxserver.com/ ) is a good alternative (written in java) for multiplayer games. Its also extensible, using java. It works using Sockets, and the AMF serialization is done Client Side with the provided SmartFox ActionScript Library.

From a "quality of service" perspective, it would be intelligent to run multiple SmartFox processes on the server (running on different ports) and have each process only manage a few users. This way if a SmartFox process dies, the whole server ins't affected, only the few users being managed by that process.

A safe limit is < 15 users per process . In theory if your goal is to support 10000 simultaneous users on a server, you would have 667 SmartFox processes running on 667 different ports.

Of course this depends on the server side setup/logic, but in the simplest case, real-time MMO data from a client is simply replicated by SmartFox and broadcast to all the players connected to that process instance.

Remember, if you require further server logic, you can extend the SmartFox server with Java. But remember, the more you extend the Server, the more work is being done, and the less connections you can ultimately support (per server).

I am working on a similar kind of game and I am using php to communicate with mysql as well.

The tutorial I am using is:

http://active.tutsplus.com/tutorials/actionscript/create-a-flash-login-system-using-php-and-mysql-part-1/

As for the playerio, I am also a bit confused.

您可以在Flash Builder中对Actionscript 3进行编程,它提供了更高级的工具来使用PHP服务,Flash Builder还能使用Zend Framework生成基本的CRUD来使用这些服务,这是PHP程序员的基本教程: http:// /corlan.org/flex-related/flex-for-php-developers/也可以在此处查看http://www.adobe.com/es/products/flash-builder-php.html

There is a couple of multi player gaming servers are available.. my favorite one is SmartFoxServer 2x http://smartfoxserver.com/

however, you can develop a multiplayer game by using php and Flash as3 for that you have to create a PHP socket server program to handle Actionscript request. This can be achieved after you done creating PHP socket Server and you have to create socket connection from flash and connect to php socket server.

Kindly see this link for creating socket program in php : http://www.christophh.net/2012/07/24/php-socket-programming/

kindly refer this link for creating actionscript socket programming http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cfb.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM