Jump to content

Multiplayer interaction


madmenyo

Recommended Posts

Hi,

 

I was wondering how i can make interactions that other users can pick up? How do i pass information to another user? For example:

 

1. Player A clicks on Player B's name in a window and chooses to attack this player.

 

2. Player B gets a message in his screen and chooses yes.

 

3. Server rolls dice on who may start ans passes this to both players.

 

4. First players chooses what he wants to do and clicks finish.

 

5. Other player gets a go to make his move.

 

I am using PHP, AJAX, Javascript and MySql. But i can't find anything on how to approach this. Maybe i'm using the wrong search terms so enlighten me on what functions i should use?

 

With my knowledge i can get this to work with AJAX requests. I would make a fight toggle for the player and ajax keeps queriing the server if that toggle has been set, if so that message would appear that he got challanged. Then for the turns the same, keep doing AJAX requests to see if the finished turn toggle is set.

 

Would this be the way to go? Or are there other sollutions that are more efficient, practical and better?

Link to comment
Share on other sites

AJAX. You will need to use a combination of JavaScript and PHP. There is no way to "push" data to the web browser with common implementations. The JavaScript will need to make a request to the server every n seconds to see if there is any new data to display and then update the user's dislplay accordingly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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