views:

700

answers:

6

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 that 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 :)

+2  A: 

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.

Jan P.
A: 

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.

grapefrukt
While you are waiting for someone to give you 'ads' why not place a google add there?
AntonioCS
that's just an old placeholder, i disabled the ads because they were ugly and forgot about it. i'm only just maintaining the site out of nostalgia now, so I can't be arsed to actually realign the layout.
grapefrukt
+1  A: 

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

have fun ... ;)

greetz

back2dos

back2dos
A: 

Hi, can you help explain the division of functionality between the Flash and the PHP? I know PHP can be used on the back end to handle certain logic to help prevent cheating...but what exactly is handled? I assume user movements are mostly handled by the Flash client, and validated by the server logic...but then some interactions are handled by the PHP? Can you give some examples? Thanks!

justin
A: 

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?

justin
A: 

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/[email protected]/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.

justin