0 Favourites

Socket.IO Plugin - Discussion

  • 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:

    Sorry for the large image!

  • 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!

  • 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.

  • 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.

  • 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
  • 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.

  • Warning: Long Post

    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:

    • Create Game
    • Create Instance
    • Create Room
    • Assign/associate peerID and peerAlias
    • Assign Host
    • 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.

    • Client made from C2. This is obvious.
    • 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.
      Below is the actual screenshot of duelhost.
      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.
    • 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!
    • 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.

  • That could also be running in a browser tab on a dedicated server if you like.

    ow reliable is that?

    or just be assigned to the first peer who happens to join the room.

    hen there is no authority, correct?

    DuckfaceNinja, I know all that, but it sounds like more of a pain than anything else. [quote:2diu7sdr]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.

    ot 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

    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.

  • And what about database communication? Is that even possible through the browser?

  • And what about database communication? Is that even possible through the browser?

    The serverhost can cover this by AJAX call to PHP. Btw, this is actually a solid way (i think) to prevent cheating/hacking by having the host to do the communication to DB.

    Honestly, I haven't covered this yet because I have no knowledge in it, still a PHP beginner, not yet sql. If only we're capable of communicating to DB using C2, with node,js plugin or something, then we can actually achieve this purely by C2.

    I'm not sure requesting DB plugin for C2 will have any attention because it is niche and possibly only see small usage, and possibly cause beginners to use it unwarily and cause their DB to be hack. But I still wish it will be made though, regardless official or 3rd party plugin. Some discussion.

  • DuckfaceNinja well, bringing Node.js or any other server-sided code back into the mix kind of defeats the whole purpose of having this within C2. :p

    Ah well, I dunno. I'd still love to see the option to use the WebSocket plugin with Socket.IO, however, if it's definitely not going to be an option, I might as well look into creating a custom server with Node.js.

  • > That could also be running in a browser tab on a dedicated server if you like.

    > ow reliable is that?

    Very reliable. The ghost shooter multiplayer demo has been running for weeks as host on the multiplayer server without problems.

    [quote:2vbem7ou]

    or just be assigned to the first peer who happens to join the room.

    hen there is no authority, correct?

    No, there is authority. The host peer is always authoritative on the game state. It's just the multiplayer engine makes the first peer to join the room the host.

  • >

    > > That could also be running in a browser tab on a dedicated server if you like.

    > > ow reliable is that?

    >

    Very reliable. The ghost shooter multiplayer demo has been running for weeks as host on the multiplayer server without problems.

    ait, what do you mean by that? You mean you've been running a host using the shooter demo?

    or just be assigned to the first peer who happens to join the room.

    hen there is no authority, correct?

    No, there is authority. The host peer is always authoritative on the game state. It's just the multiplayer engine makes the first peer to join the room the host.ut if the first peer becomes a host, who checks that peer? Or am I thinking about this incorrectly?

  • DatapawWolf

    Multiplayer is awesome. However doing MP requires an entire different way of thinking. And your having troubles adapting to the different thought process. This is going to make MP difficult. As a personal experience. I worked on a MP game with a co-worker. I did the entire networking side including writing the server in NodeJS and the client in C# Unity. All the other guy had to do is use 3 functions and understand network messaging. He understood the messages very quickly. But it's been 2 weeks and the networking thinking is still causing him troubles. Smart guy though. We have managed to get through enough.

    Anyways stop thinking of Peer as being a player. Break that chain now. Peer != Player. Peed is any computer connected. So First Peer is the Host. Who says it's a player peer? Your assuming that a player is going to be a first peer and thus authoritative host. This is an incorrect form of thinking.

    You can create a first room peer and run it on your dedicated hardware server. Thus your now controlling the authoritative information. This peer

    A. Does not have a playable character or if it does it's out of bounds.

    B. This peer NEVER logs out as it's run on your computer as the authoritive host.

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