CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2010
    Posts
    14

    Multiplayer interaction

    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.

    - in short, if 1 user does something how can another user immediately see that?

    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?

  2. #2
    Join Date
    May 2010
    Posts
    14

    Re: Multiplayer interaction

    I have been reading some stuff about comet and long polling. So actually the method i discribe above seems to be long polling. And some people say comet is really good at it.

    Anyone have experience with comet? And how much support for it is there on todays hosting providers? And above all? I can't seam to find anywhere how it works exactly but it looks like it's using the same method as a simple timeout loop that loads a php with a query in it.

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Multiplayer interaction

    You could use AZURE Services, SQL, or Storage @ Microsoft.com
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: Multiplayer interaction

    If you're going to use JavaScript and PHP, then you'll have to do constant querying. The query will have to send attacks to the server and also check to see if it's being attacked.

    Either way, there will be a slight lag if you're not using a direct connection...which client-side/server-side web apps are not capable of doing. You could try Flash or Java.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured