Socket.IO Plugin - Discussion

Discussion and feedback on Construct 2

Post » Fri Oct 03, 2014 11:39 pm

Update: See third page of replies for a much more current discussion

So I know we already have the mutiplayer plugin, however, I'm not interested in it attempting to create a dedicated server using said plugin.

In addition, I already demonstrated a while back that it is more than possible to set up a WebSocket server using a library based off of Node.js (see below). This is great! I love it! But I'm hesitant to use most third party Node.js libraries because of little support overall, and on many GitHub repositories one can see that there is little development going on at the backend. I used SockJS at the time, which is the only option that didn't about kill me to figure out how to create a simple server, and seems to be one of few that the Scirra WebSocket plugin can easily communicate with.

I would like to turn to Socket.IO because of the extensive updates and support it has received by the developers, and currently I have yet to find a way to connect a Scirra game client using the WebSocket plugin to a server running with it besides alternate third-party options.

Hence, my request: the addition of either Socket.IO-specific protocols to the WebSocket plugin, or a Socket.IO-specific plugin by Scirra so that Construct 2 users have two viable (and supported) options for the creation of multiplayer games (e.g. the Multiplayer plugin and Websocket/Socket.IO plugin I have requested).

I would love to hear discussion on this particular topic if anyone has any refuting arguments, alternative suggestions, or support. :)

------------------

SockJS + Websocket plugin:
Image
Sorry for the large image!
Last edited by DatapawWolf on Sun Oct 19, 2014 2:28 am, edited 1 time in total.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,836

Post » Sat Oct 04, 2014 1:19 pm

You don't need a dedicated server or your own signalling server to use the multiplayer object. The connections go peer-to-peer between players and you can use the official signalling server (which runs on a high-end dedicated server with a gigabit connection). So it's not a hoop you have to jump through!

I'm not sure why you need Socket.io, you can use the ws module for node.js and connect directly to that with the C2 WebSocket plugin if you really want an alternative. Socket.io isn't a raw websocket, they implement their own protocol, which is why the C2 Websocket plugin (which is a raw websocket) won't connect to a socket.io server. Also if you go down this route, you definitely need a server, which you cited as a reason not to use the official multiplayer plugin... which doesn't need a server!
Scirra Founder
B
399
S
236
G
89
Posts: 24,529
Reputation: 195,400

Post » Sat Oct 04, 2014 2:21 pm

DatapawWolf wrote:So I know we already have the mutiplayer plugin (and that's all fun and games and it works well, yes) however, I'm not interested in it because getting a dedicated server and running that through the signalling server is not a hoop I would like to jump through.

This could mean either:
1) You think MP plugin needs you to have a server to run your game, which is not, OR
2) You want to keep game logic on the server side, so you need a dedicated server to host the game sessions/instance/area, which require the serverhost to connect to signal server, which you don't like. Is there any reason for this that I should know of? I'm asking because it's quite relevant to my project.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sat Oct 04, 2014 4:59 pm

I probably should have clarified. I want, and need, my own server for the game I am creating, which, @DuckfaceNinja, you are spot on for #2. @Ashley, I am looking to create an authoritative server rather than using the signalling server, for which Socket.IO fits the bill for ease of use and scalability, which handles a lot of basic Node.js functionality under the hood, and include rooms, auto reconnection, and fallbacks (although I'm not sure how those would be implemented). Here is the post for their version 1.0: http://socket.io/blog/introducing-socket-io-1-0/

The game I would like to create is a mixture of turn-based RPG and grid movement, so the authoritative part would ensure no players can hack their way over impassable objects. Rooms would be handy for, say, instanced combat.

Basically, I'm more asking for a Socket.IO because it would be an easier option than Node.js itself.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,836

Post » Sat Oct 04, 2014 5:04 pm

I don't know if you haven't found it or wanted to skip it, but there is a Socket.IO plugin, and here is a tutorial for it (With important links):
https://www.scirra.com/tutorials/571/modded-socketio
- Conti
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
24
S
10
G
7
Posts: 253
Reputation: 4,931

Post » Sat Oct 04, 2014 5:36 pm

I still don't understand why you can't use the multiplayer object for that. You can implement an authoritative server with it - in fact, that's how all the games work - the host peer acts as an authoritative server. That could also be running in a browser tab on a dedicated server if you like, or just be assigned to the first peer who happens to join the room. The signalling server is nothing to do with that, it's basically a glorified IP address relay so peers can find out how to connect to each other.
Scirra Founder
B
399
S
236
G
89
Posts: 24,529
Reputation: 195,400

Post » Sat Oct 04, 2014 5:59 pm

Warning: Long Post
DatapawWolf wrote:I am looking to create an authoritative server rather than using the signalling server.

I think you misunderstood signalling functionality, AFAIK signalling server only serve to:
  1. Create Game
  2. Create Instance
  3. Create Room
  4. Assign/associate peerID and peerAlias
  5. Assign Host
  6. Connect Peer to host

It doesn't handle game logic at all. You can actually create authoritative server using C2, it will be flimsy but it is definitely doable, what you'll be needing is:
Note: MP beginners do not read this or read at your own risk.
  1. Client made from C2. This is obvious.
  2. Lobbyhost, area host, or generally call it serverHost, this can be made from C2 as well to handle the logic. I know this is doable because I'm actually doing it.
    Below is the actual screenshot of client.
    Image
    Below is the actual screenshot of duelhost.
    Image
    If you're going into the path of server side logic, this might be the thing that you have to tackle, which is creating a totally more than 2 different project, this is extremely difficult but doable, only your patience will tell how far you can go.
  3. VPS or dedicated hosting server to run browser. This browser will run your exported C2. For scalability, you can open up multiple tabs for the same project, but log it into separate instance (game instance top level) and separate room (area instance). Furthermore, if you ran out of computing ability on one server, you can just host the serverhost in another computer!
  4. Access to remote desktop to your server to actually run your browser, or if you know how to run the browser using php or any sorts of vodoo, you probably don't need the remote desktop access.

On side note, you're trying to make an RPG, so will it involve collision check? If you do, I think that would be the most difficult to do if you intend to do that using the way you wanted in the first post. The advantage of doing server logic in C2 is, you already have collision covered, I believe that cut a lot of developing time, the project can be minimal, without any visual, just collision mask to represent you players/objects.

In terms of reliability, I would admit that, doing so probably gives you a flimsy server, but this is not tested fully and unproven. I think what is doable with C2 now is actually acceptable for small scale MORPG unless you're building a full-blown massive scale MMORPG, which I think you're probably need what you wanted in your first post.

If you know Real of the Mad God, something like that is totally doable with C2, I tried it, seen it happen, yes it is possible.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sat Oct 04, 2014 6:05 pm

Ashley wrote:That could also be running in a browser tab on a dedicated server if you like.
How reliable is that?
Ashley wrote:or just be assigned to the first peer who happens to join the room.
Then there is no authority, correct?

@DuckfaceNinja, I know all that, but it sounds like more of a pain than anything else.
On side note, you're trying to make an RPG, so will it involve collision check? If you do, I think that would be the most difficult to do if you intend to do that using the way you wanted in the first post.
Not really, no. Like I said, grid-based, which means requesting a tile in one of four directions, using a 3D arrays that contain information about the map. Really all it needs to know is the placement of objects, and whether or not there it can go to that square.
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,836

Post » Sat Oct 04, 2014 6:29 pm

DatapawWolf wrote:Not really, no. Like I said, grid-based, which means requesting a tile in one of four directions, using a 3D arrays that contain information about the map. Really all it needs to know is the placement of objects, and whether or not there it can go to that square.

This is actually fairly easy to do (compared to my current project), and I think you don't even need sprite object at all, just crazy array management here and there, I still believe C2 is the faster way to do it, none of the both I think superior to another.
I think the only limitation is C2 is not capable of more than 3D array, which in my project I need 4D to be short, but this is managable just by duplicating my 3D array events.
DatapawWolf wrote:How reliable is that?

Nobody have anything to test it yet, so there's no telling how reliable it is. I tested a few situation such as spam send message and client input, so far I think it is reliable on small scale, let say 20 concurrent users for single server tab. But this will differ based on complexity of your logic as well.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sat Oct 04, 2014 6:55 pm

And what about database communication? Is that even possible through the browser?
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,836

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests