Turn-based multiplayer architechture

Get help using Construct 2

Post » Mon Nov 26, 2012 6:37 am

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! :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Mon Nov 26, 2012 7:29 am

[QUOTE=vee41]... 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? ...[/QUOTE]
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.
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Mon Nov 26, 2012 10:18 am

[QUOTE=Velojet] [QUOTE=vee41]... 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? ...[/QUOTE]
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.[/QUOTE]

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 :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,202

Post » Mon Nov 26, 2012 7:18 pm

[QUOTE=vee41] ... 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? ...[/QUOTE]It'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."
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Mon Nov 26, 2012 8:40 pm

[QUOTE]However, as David Walsh says in a http://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."[/QUOTE]

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!vee412012-11-26 20:43:51
B
24
S
8
G
7
Posts: 756
Reputation: 7,202


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Artpunk, Magistross and 31 guests