Turn-based multiplayer architechture

0 favourites
  • 5 posts
From the Asset Store
Empire Game has everything you need to create immersive, historical-turn-based games!
  • Hiya,

    I have created a turn-based game with hotseat multiplayer option. It got me thinking, how would you go on creating a network multiplayer architecture for turn based game?

    My immediate thought was creating a 'turn file' which includes all moves player has done that turn. It would be sent to host (central server or whatever). When all 'turn files' from all players have arrived turn would execute and new turn would become available to all players.

    How feasible would this kind of solution be for construct 2? I browsed a bit and found that AJAX plugin can do POSTs, would this be the preferred delivery method or is there something more fitting that I've missed?

    Or is there perhaps easier/ more efficient way of creating turn-based network multiplayer?

    Looking forward to hearing everyone's thoughts! :)

  • ... I browsed a bit and found that AJAX plugin can do POSTs, would this be the preferred delivery method or is there something more fitting that I've missed? ...

    Socket.io. Do a Forum search for 'multiplayer' and you'll turn up a number of threads and at least two implementations of a socket.io plugin.

  • > ... I browsed a bit and found that AJAX plugin can do POSTs, would this be the preferred delivery method or is there something more fitting that I've missed? ...

    Socket.io. Do a Forum search for 'multiplayer' and you'll turn up a number of threads and at least two implementations of a socket.io plugin.

    That is really nice, thank you for that!

    I'm wondering this: as I understand sockets are mostly meant for real-time communication, in case of turn-based games are they the best solution? There is really no need for real-time communication as ideally everyone uses their client (whatever that might be) locally and sends in the turn file for the server to process.

    Of course I can fire up the socket connection at the 'send' phase, just wondering if sockets are best fit for turn-based games as I am not that familiar with web technologies.

    That plugin looks to be pretty much what I need though :)

  • ... I'm wondering this: as I understand sockets are mostly meant for real-time communication, in case of turn-based games are they the best solution? ...t's true that sockets are the best current technology for RTC and that AJAX can be used effectively for turn-based games.

    However, as David Walsh says in a useful introduction to the WebSocket API and Socket.IO, "AJAX technologies require a request to be made by the client, whereas WebSocket servers and clients can push each other messages. XHR is also limited by domain; the WebSocket API allows cross-domain messaging with no fuss. AJAX technology was a clever usage of a feature not designed to be used the way it is today."

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • owever, as David Walsh says in a davidwalsh.name/websocket, "AJAX technologies require a request to be made by the client, whereas WebSocket servers and clients can push each other messages. XHR is also limited by domain; the WebSocket API allows cross-domain messaging with no fuss. AJAX technology was a clever usage of a feature not designed to be used the way it is today."

    Great quote and great read overall!

    Websockets it is for the project then, as there doesn't seem to be any tradeoff there :)

    Thank you for your answers!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)