Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2007

    Unanswered: can you help me ?

    I'm coding chess game online with PHP & MySQL . and i have a problem ,that is I don't know create code to 2 player connect to server at the same time and play 1 chess gangboard.

    can you create code solve it for me ?


  2. #2
    Join Date
    Mar 2007
    Hmm good question, you'll need to maintain the state of the game inside the database with the relevant participants because http is a stateless protocol so it doesn't know if the person who is requesting the page is the same person or a new person... And you're definitely going to be needing to use sessions to store some info.
    There's no way in hell anyone here is going to spend the time creating the code for you. That's for you to work out
    In this instance Ajax will probably be your friend. Although how you go about graphically moving chess pieces is another matter.

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    agree you are probably looking at AJAX to manage the game, if so there are some useful libraries out there that will do what you want. I think Nicholas Zakas has something called zDragDrop, but there are probably other libraries out there that may be of use.

    but I take my hat off to you starting out to learning PHP & MySQL to produce an online chess game, especially when there are already Ajax based free games on portals such as Yahoo
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Apr 2006
    Denver, Co. USA
    As has already been posted, to share the state of a game between the players, you need to store that information in a database.

    Each player simply browses to your web page and his login details allows him access to any game(s) he has in progress, or he can start a new game, or join a new game that someone else has started. I assume that you want to allow multiple games and any player can be in more than one game at a time. Simply query the database to retrieve the state of the game that the player has selected from his available games.

    can you create code solve it for me ?
    No, programming forums exist to help programmers with their programming problems, not to write code for them. If you need ideas for some small part of your project or you have a specific problem or error, a forum can help you. It is beyond the scope of what a forum can do for you if you expect someone to design, make a detailed list of requirements, or write code for you. As the programmer creating this or even if you are doing this as a learning exercise, it is your job to do these things.

Posting Permissions

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