locked
2 player turn based game logic in c# for snake and ladder

    Question

  • Hello programmers,

    I am developing a snake and ladder game in xaml and C#.(windows 8.1 app)

    my question is:

    1) I am unable to think about the solution for player turn, I have build the game logic for single player and its working fine. please provide some solutions or the concept.

    2) I have build the same game logic with two different ways, one with nested if else and the next with array which one would be good for performance.

    and I also want to know about windows Azure for online score and multi player game service.


    • Edited by Pharaoh() Sunday, February 8, 2015 2:08 PM
    Sunday, February 8, 2015 12:38 PM

All replies

  • Hi,

    I am not very familiar with the multiplayer Game development. For multiplayer games, you'll need to set up a matchmaking server and have the clients connect to it. It can then pair them off and facilitate communications. If the clients have publicly available network addresses then it can introduce them and they can talk directly to each other.There isn't anything built in for this so you'll need to either build your own or find a third party implementation. If you are using Unity3d then check out http://docs.unity3d.com/Documentation/Components/net-MasterServer.html

    Also, you can use Xbox services, and I find an article below:

    https://msdn.microsoft.com/en-us/library/bb975801.aspx

    For windows Azure problem, you should go to windows Azure forum.

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Monday, February 9, 2015 7:48 AM
  • thanks for your reply, but my first two question are more important please reply.
    • Edited by Pharaoh() Tuesday, February 10, 2015 10:07 AM
    Tuesday, February 10, 2015 10:07 AM
  • Hi,

    Nested if else and the next with array which one would be good for performance that's depend on different scenario.

    In general, nested if else may slow performance.

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Wednesday, February 11, 2015 7:01 AM
  • Hi Pharaoh,

    Your questions are highly specific to your project and not something that can be answered without knowing details about how your project is structured. This sounds like a homework assignment which you should discuss with your teacher if you need help.

    There are many ways you can handle player turns. Which is best will depend on your specific project and how your general game logic works. Without knowing more about how your existing game logic works we can't make rational suggestions for how to add a second player. A variable pointing to the current player may work, a new state in your state machine, or something else.

    Likewise, the question of a nested if/else or an array isn't meaningful out of context. These aren't comparable structures, so without knowing more about your app's flow and data structures we cannot know what you mean by them. Neither of these will have a significant affect on performance. At this point you are much better trying to write clear code.

    --Rob

    Wednesday, February 11, 2015 7:42 AM
    Owner