Jump to content

php multiplayer rpg


codenature

Recommended Posts

Hi, I want to make a visual php mysql based multiplayer role playing game, of the Dungeons and Dragons type, I don't know if it would be tile based or what the most advanced interface I could do would be in php. But ideally it would not have to reload the page every time, could I do that with ajax?

 

Please if anyone can give me a link to a really good multiplayer rpg that has a very good interface where you can see the "monsters and players" moving upon user moves. Thank you.

Link to comment
https://forums.phpfreaks.com/topic/262136-php-multiplayer-rpg/
Share on other sites

You should write it in JavaScript, and preferably use a <canvas/> While on the matter, you should also read "JavaScript Patterns" this contains all the JS optimizations you will need to consider while building your game. Look at Command & Conquer Tiberium Alliances for a browser-based game with moving units.

 

You will also need a book/resource with explanations of how you can create a fair multiplayer when dealing with clients. The server is the referee, and clients should only be able to communicate their actions, not their result.

 

Examples of communicating their results:

attack.php?name=some-client&hp=0

reward-player.php?id=1&coins=9999999

 

Examples of communicating their actions:

attack.php?name=some-clients&spell=some-spell

 

Returns: {"results":{"player":"some-clients",'hp":80}} to update the user's screen.

 

This puts the server in control of what damage is done instead of the clients. The server should also validate each request, as you should with any normal application you build. You can further expand on this by creating admin specific requests:

admin-kill.php?player-id=1&reason=annoying

 

Obviously in admin-kill.php you should check whether the client is in fact an admin. Also any security measures you take with a normal application should also be present here, like for example preventing the obvious CSRF attacks.

Link to comment
https://forums.phpfreaks.com/topic/262136-php-multiplayer-rpg/#findComment-1343433
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.