Is Amfphp a fine way to do real time multiplayer games?

128 Views Asked by At

I did guess that I could do a multiplayer game with a loop using Amfphp. Into this loop the Amfphp would do requests on DB, and, so this, the players could see another players by db data.

Do you think this could do tense to the server? IS there some way to make it fast?

2

There are 2 best solutions below

0
Ariel Sommeria-Klein On BEST ANSWER

Maintainer of Amfphp here. Amfphp is mainly here to help with communication. It does not aim to solve the underlying problem that PHP has with one client talking to another. Your approach with a loop can work for prototyping but won't scale.

If you must use PHP, look at using a socket server. If you can, use another server side language that is better suited to pushing data around from client to client.

1
BotMaster On

It depends and testing will be required anyway.

Basically AMF will send a smaller data packet in most cases but AMF first need to serialize the data and then when received it need to be deserialized and that needs to be added to the overall time. Depending on data complexity the whole AMF process might win you a few milliseconds or might lose you some. Only testing can tell. If you stick to generic data types you might be ok, if you go with complex data types that might cost too much.