Multiplayer Games

0 favourites
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • Multiplayer games, any chance with C2?

  • Of course. You can make any 2d multiplayer game in C2.

  • LucasTorres

    Please provide more details. Local MP, Online MP, Turn based, realtime, reasonable time. What kind of multiplayer. The method and solutions can vary depending on what your looking for.

    For all them, the answer is yes, but the amount of work will vary greatly.

  • LucasTorres

    Have a look at my two multiplayer plugins. In both, C2 is used as a front end to take input from each player and to display the current game state. In the first (MultiPlayer), you need to program the game logic server-side; in the second (PhotonClient), no server-side programming is needed, and most of the game logic is handled by your C2 code:

    1) MultiPlayer (NodeJS server - you need some server-side JavaScript experience if you want to adapt my server code).

    2) PhotonClient (Photon Cloud server - no server-side programming needed here, but it does mean that you have fewer options for management of your game).

  • LucasTorres

    Please provide more details. Local MP, Online MP, Turn based, realtime, reasonable time. What kind of multiplayer. The method and solutions can vary depending on what your looking for.

    For all them, the answer is yes, but the amount of work will vary greatly.

    online, for example, DDTank

  • Hello,

    please scroll down if you would like to have a service where you can just upload your zip file from construct and then have it run as a multiplayer server.

    I have spent some time thinking about this and there is a way to use construct to develop a multi-player server without coding anything else.

    If you want it to scale to hundreds and even thousands of simultaneous sessions, then even that is possible, but it would not be the cheapest of solutions when it comes to cost-of-ownership.

    But for a few simultaneous sessions with about 8 users it roughly comes down to this:

    • Get a server (I can also explain how P2P would be possible but that is a bit more involved. Also, a server is easier to use if you want to prevent cheating).
    • Either install a specific server that listens for websockets and that can forward specific messages to specific clients (I have made a PoC for myself in Go) or use something like

      gist.github.com/bradleywright/1021082 in a plugin or CallJS call.

    For the server you have a layout that connects to the websocket and listens for any incoming message as forwarded by the proxy.

    Each client (game/enduser) connects to the websocket and announces itself using a GUID (or login/password or somesuch)

    The server 'layout' then 'routes' this client to a 'room' or 'session' (i.e. giving it a GUID as session id).

    The client now uses that session to message the other clients, all through the session 'layout' in the server.

    This involves having at least 2 processes at the server side: the 'entry' or 'router' part and the 'session' or 'room' part.

    If you want as much control over the game as possible then have the clients only send the inputs ('key down', 'mouse clicked at x,y') and have the server 'play' the game using constructs events, collisions etc. and send the x,y, effects, instances created/destroyed back to the client.

    You would use the node-webkit combo to run the 'room'/'game' at the server side.

    The overhead is then, of course, a new process per session.

    For a headless server (i.e. one in a datacenter with no graphics/output) you would use something like xvfb.

    What I am wondering is if there is an interest in having this as a service.

    Basically, you would upload the generated zip file and then your server runs.

    The service would take care of the scaling (which can be handled quite nicely actually, if you code some extra things in there).

    A development setup would be possible by having your own layout connect to the dev websocket so you can see your code running.

    But, as I am a nice guy with quite some room in my datacenter but I am not wealthy enough to just run something large without having some remuneration going towards the cost of running something like that, I am wondering *if* and if yes *how much* would you be willing to pay for a service like that and in what form (i.e. per session played, fixed amount per month for a maximum of X sessions, etc...)

    Basically, if I have the idea that such an endeavour could cover running costs then I would be willing to get my team cracking and build a 'Construct 2 Server Service'.

    Let me know what you think.

    With kind regards,

                       Adrianus Warmenhoven

  • awarmenhoven

    What your talking about is cluster based networking. yes that was my plan :D. there is interest of course. If you want to do it. Please go ahead. This would save Velotjet and me great time for some one else to handle it :)

    I was starting to do the PoC Here. But then I was faced with 2 problems.

    1. Photon doesn't have Channels or Routes. They only have from what I can tell are isolated lobbies. So i couldn't sit cluster server to be the game logic for mutliple rooms :(

    2. I would have needed to install Visual Studio Express. We all have our bias for coding langauges. I won't work with .NET unless I'm paid. I'm not being paid. I won't touch it. :D

    instead if no one set's up a C2 cluster network. I plan to use NodeJS Tycho or ActionHero. Which both can be configured for cluster networking :)

    My question is. Would people pay a descent amount of money on Kickstart for a team to get this going. Or pay an X amount for a plugin. I would love to quit my job :D

    LucasTorres

    Yes, You could do DDtank like game. However, that game looks like it will have a lot of server based code. So it's going to be a lot of work and at this moment. Your going to need to learn a programming language... unlsess of course some one get's a cluster network going :)

    I don't know. This wave of "is there online multiplayer" questions has a different feel to it.

  • LucasTorres

    Yes, You could do DDtank like game. However, that game looks like it will have a lot of server based code. So it's going to be a lot of work and at this moment. Your going to need to learn a programming language... unlsess of course some one get's a cluster network going :)

    I don't know. This wave of "is there online multiplayer" questions has a different feel to it.

    I work with Web Development Web.I know PHP.

    is enough?

    Sorry for language mistakes, I'm Brazilian and beginner in English

  • ... If you want as much control over the game as possible then have the clients only send the inputs ('key down', 'mouse clicked at x,y') and have the server 'play' the game using constructs events, collisions etc. and send the x,y, effects, instances created/destroyed back to the client. ...

    That's exactly how my MultiPlayer behavior/NodeJS server functions. A demo is currently running on the Nodejitsu cloud platform (which uses automated clustering).

  • >

    > LucasTorres

    > Yes, You could do DDtank like game. However, that game looks like it will have a lot of server based code. So it's going to be a lot of work and at this moment. Your going to need to learn a programming language... unlsess of course some one get's a cluster network going :)

    >

    > I don't know. This wave of "is there online multiplayer" questions has a different feel to it.

    >

    I work with Web Development Web.I know PHP.

    is enough?

    Sorry for language mistakes, I'm Brazilian and beginner in English

    I'm not bothered by your English. I speak and write English as my native and only tongue, yet I am very poor at writing :D

    no, PHP will not be enough for anykind of real time game play. Not only does PHP over TCP, PHP also script handling isn't as fast. PHP is meant to serve up core data and web pages.

    However, you can use PHP for all the inventory and character management. but you will need at least Websockets for gameplay. You can use Velotjet plugin for that :)

  • Ok, let me see what we can whip up in the coming time.

    It would be a bit more complicated than only a websocket rerouting messages.

    We would add message-queues and a few commands so the controller can tell the server software (native binaries, no interpreted languages like .Net, Java or PHP) to handle some cases autonomously for performance.

    Also there would need to be some provision for spawning new processes and commands for booting/blocking users.

    I think a 'server' plugin and a 'client' plugin would make things easier for the developers in that you then can have events like 'on new client connect', 'on new session created' etc...

    The client plugin then can have events like 'on joining new session' etc...

    The biggest fun will be to make it scalable and performant. But then again, that *is* what I do for a living :)

    if you want to have a banter on this; let me know. I am going ahead with this, but maybe we can find a good modus operandi so you can still quit your current daytime job, or at least make a nice extra from it :)

    With kind regards,

                      Adrianus

  • Update:

    Well, I modified the websocket plugin a bit and fired up the server. It works pretty smoothly with queues and other parallelism-stuff in place so it can be scaled across multiple servers.

    Now to make multiplayer easier to build, I think the plugin should have a few more actions, conditions and expressions specifically geared towards mp. So I want to recode it to a specific multiplayer plugin.

    In the text below, the GUID's are client-specific(!). This means the server will translate them for each user transparently, but they will be different for each client. The reason for this is that a client can not subscribe to channels that are not available to him and guessing will not do him any good.

    Things that I came up with on the top of my head are:

    Actions (client):

    • "Connect", param is API key, param is hostname/url: To connect to the server and to differentiate which game should be matched up with which controller/session manager (the API key is different for each type but consistent amongst all clients)
    • "Set Nickname": just a label that can be shared with other players instead of the GUID
    • "Subscribe Channel", param is channel GUID (will get to that in expressions): subscribes to messages from a specific channel. A channel is nothing more than an identifier to a specific stream of messages. Like a forum-thread, a mailinglist or an IRC channel. You should be able to use more than one channel if games have 'friend chat' or 'allied chat vs foe chat'. But also you can use channels to prioritize message handling (doing all the movement messages as fast as possible, doing the chat messages just once in a while).
    • "Unsubscribe Channel", param is channel GUID: obviously you may want to quit a game or turn off the chatter from others.
    • "Send Chat", param is channel GUID, param is message: I think it is best to have different message-types, so the server (and your controlling C2 code) can differentiate and process accordingly. Basically the server could ignore everything but game-specific messages and have all other types be rerouted blindly.
    • "Send Command", param is channel GUID, param is message: this message type is for things like store/save/pause/taunt/give/take etc. type of messages. They are ingame but not necessary realtime
    • "Send Realtime", param is channel GUID, param is message. These messages should be processed with the highest priority.

    Maybe things like "Send Object", param is channel GUID, param is instance should be added so you can pick an instance and send the whole coordinates, velocity, behaviour params etc. directly to the server... have to think about it.

    Actions (server):

    • "Connect", param is API key, param is hostname/url: To connect to the server and to differentiate which game should be matched up with which controller/session manager.

    It is important to understand that there need to be two server projects: 1 is the controller that basically handles all the boring lobby/matchup etc. code. The other gets started every time a new session starts and this is the one that handles the game and the players.

    • Create Session, param is GUID: This tells the server to fire up a new controller and hand the GUID to it.
    • Create Channel, param is name, param is type: You should be able to create global channels (i.e. for a lobby or for messages across sessions, moderator chat etc.) and session channels. Session channels will be created per session (duh) and global channels only once.
    • Allow Channel, param is channel name(!), param is client GUID, param is R,W or RW: You should be able to mute clients or maybe you want the input on 1 channel and have the output on a different one so you can make life easier when copy/pasting event sheets.
    • Forbid Channel, param is channel name, param is client GUID: Almost the inverse of the above, but not quite.
    • Set Messagetype Policy, param is channel name, param is messagetype, param is policy (passthrough, block, handle): If the policy is passthrough then the messages will never arrive at your server Construct 2 code but be rebroadcasted to every client in the channel. Handy for chat or if you want clients to handle messages. Block is if you don't want events to happen for your server code.
    • Disconnect Client, param is client GUID: closes the connection to the client.

    Conditions (client):

    • "On Chat message", "On Command message", "On Realtime message": Conditions are true if 1 or more messages for these have arrived. Probably should handle the messages in a for each loop except for the realtime (as a backlog may cause more delay, so realtime messages that are not processed before the next one arrives maybe should be dropped... have to think about this as well)
    • "On Subscribe success", "On Subscribe fail": When a subscribe to a channel succeeds or fails.
    • "On Send error": if a message sending has failed.

    Conditions (server):

    • "On client connect": whenever a new client arrives (maybe needs a client object....need to think about this)
    • "On client disconnect": If a client connection drops or the client just quits the game. Your code should then decide whether the game can continue (if it is a MMORPG type) or if it should quit (if it is a 2-player card game).
    • "On Chat message", "On Command message", "On Realtime message": Conditions are true if 1 or more messages for these have arrived. Probably should handle the messages in a for each loop except for the realtime (as a backlog may cause more delay, so realtime messages that are not processed before the next one arrives maybe should be dropped... have to think about this as well)
    • "On Send error": if a message sending has failed.
    • "On Session Ended": If a session has finished.

    This is just a scrapbook list of things that, in my opinion should be available and which make it possible to handle a Construct cluster as a service.

    Let me know if you can think of others or better ones. I will think about the expressions as well.

    With kind regards,

                     Adrianus Warmenhoven

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • awarmenhoven

    What I do for a living is hold people down for nurses to restrain or look mean at drunks :D. Has nothing to do with computers :D

    I'm keen on the idea of team project to get C2 a networking framework. I'll PM you with my email address. or maybe we can start a new thread in the game design area :)

  • singular Send Object would be better.

    client.SendObject(channel, object)

    of course if you have anything that would says differentiating Chat/Command/Realtime would be better. I'll read anything in that design. But off the bat, I can't think how dividing the message structure would be better.

    It would seem that the difference is best handled by the server with channel and session. I don't see a big difference between Chat and Command especially with Channel type.

    Also if Realtime priortizizes a queue based on a threaded design. I don't think it will matter that much. if it's in a single thread design where the realtime queue needs to be empty before handling Chat/Command. Then Chat/Command could suffer at higher loads. At least that what sounds like it could happen :D

    Also a way to get SessionList by game key/name... so on etc.

    client.GetSessionList(apikey)

    Finally. Are you planning to build the routing/server infrastructure from scratch. Or use an already existing server base. Personally i think it wuld be better to build on top of an existing core engine to reduce work :P

    I think we should stop de-railing the guys thread :D

  • my email addy is not hidden it is to be found at warmenhoven.co/contact (I do this in the form of a link as that page has a spamtrap and so my email address is not out in the open).

    Now, as for your comment on derailing; let's use email after this.

    And as for your comment on frameworks: I rather not use existing code as that tends to give bloat, lag and bugs. But the main core of messaging, scaling, clustering and all that large scale stuff is almost boilerplate for me as I have an extensive library.

    I just finished up making it so that I can have any number of clients, any number of controllers and any number of physical servers, so that is taken care of :)

    We should rather talk about the object/communication/plugin/usability design and I think we can have good banters on that :)

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