开发者

Architecture for a farmville/yoville/cafe world type game?

开发者 https://www.devze.com 2022-12-16 13:22 出处:网络
I\'m thinking of building a game along the lines of Farmville - items, events, time management system etc. Options I am thinking of:

I'm thinking of building a game along the lines of Farmville - items, events, time management system etc. Options I am thinking of:

1) Flash UI frontend th开发者_如何学Cat uses AMFPHP to get all data for the view from a PHP powered backend. 2) Actionscript to power the whole game

Any input is appreciated. My concern with Actionscript is scaling, my concern with PHP is having to build an update system that would need a lot of back and forth xmlhttprequests which might get complicated.

If there's a better way to build something like this, I'm all ears :)


Don't clone/copy Farmville, there are hundreds doing the same thing.

But to your question:

  • Frontend: Flash
  • Server: AMFPHP
  • Backend/CMS: PHP

seems like a good idea.

Actionscript on the frontend side will definitely scale, it has be done a thousand times. PHP as server and backend part should be no problem, too.

Why you would need xmlhttprequests if you have a NetConnection for Remoting the AMF I don't know.


In this interview "Luke Rajlich" from Farmville mentions using AMF and doesn't mention using XML sockets.

"How do you talk to the backend? Is it Request-response, XHR, long-polling, Flash XML sockets, or "COMET"?

We use a standard HTTP request/response protocol called AMF. The AMF transactions happen asynchronously from the client and if the server sees something it doesn't think the client should be sending, it returns to the client an "Out of Sync" message which tells the client it is in an invalid state and the client reloads itself."

http://highscalability.com/blog/2010/3/10/how-farmville-scales-the-follow-up.html

Since they don't seem to use sockets, I assume they don't use a socket server like smartfoxserver or electro server? Do you think they build their own server, they said they use PHP in the followup interview to the interview linked to above, do you know of any software that will work as a server with all of these AMF connections and PHP--is that what AMFPHP is? (I couldn't find many clear descriptions of AMFPHP online.)

Also, do you know of any good socket servers which work with PHP, it seems like you need to know Java to use smartfox server or electro server, is that correct?

Also, if Farmville uses AMF, would mean they don't use sockets, and would that mean they use polling for changes?


My personal advice:

  • Backend: Haxe targeting flash9
  • Frontend: Haxe targeting PHP or neko

Use Haxe remoting for communication, SPOD for database with templo for HTML, or try haXigniter ... I'd personally advise to compile to neko for speed and footprint, but that's up to you ...

write all in one beautiful language ... reduce communication to transparent calls, and database actions to transparent object manipulation.


Me and some friends built argblargs on that exact stack. It's worked great for us, I can't vouch for the scaling into thousands of users, but I don't really think you should worry about that this soon.


Could Farmville be using AMF, perhaps AMFPHP, with a PHP socket server? I'm confused as to whether you would use one or the other, AMF and sockets, are they mutually exclusive? From what I read here, you can use AMF with sockets, is this correct?

"flash.net.Socket is a simpler or, rather, more raw API that allows you to create your own persistent connection but leaves the protocol and communication format up entirely up to you. With the ability of flash.utils.ByteArray to serialize ActionScript objects using AMF you could also use AMF if you wanted to on your Socket so long as the endpoint understands this format."

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg44653.html

However, reading other information such as here they seem to emphasize that AMF and sockets are for different purposes.

Thanks! I'm just trying to figure out all the different possible variations.

0

精彩评论

暂无评论...
验证码 换一张
取 消