The Multiplayer Dev. Cycle "?"

This forum is currently in read-only mode.
From the Asset Store
Perfect for your zombie game! Animated from motion capture data Left, Right, Top Down!
  • I'm new to Construct and I really like what I see here. My dilemma is that I'd like to try and use it to create a turn-based persistent multiplayer game. I can wrap my head around the design just fine, until I get to the networking portion.

    My question to whomever is listening is this. What's the BEST way to dev. a game which you fully intend to become multiplayer (down the road)? My thoughts are right now to Construct it in a "hot-seat" format and then worry about the networking down the line. (perhaps when there's a plugin)

    But, is this the best approach to take? Will I run into a lot of snags? I just would really like to get started on it at least... then if I'm satisfied with the design I'll incorporate maybe podsixnet, MySQL, html, etc.

    I guess what I'm asking is, is it necessary to work the game as net-able from the ground-up given Construct's abilities?

  • I would recommend using functions to control any multiplayer aspect of the game. Later when its time to incorporate python, or a plugin, or even local multiplayer, you could change the way you achieved multiplay, without having to worry about it affecting anything else.

    For example:

    you could make either a construct function or a python function, whichever you're most comfortable with:

    GetPlayerInputX, this function would take in a value for the player number, and output a value for how much the x axis of the control for player is being applied

    the inner workings of the GetPlayerInputX could change, or expand whenever you needed them to, without affecting any other code. You could make getplayerinputx gather information from xbox360 controllers, using the player number to choose which controller, and returning the Left Analog X Axis. Down the line when a plugin comes out, player number might refer to an index in a list of ip addresses, and the function would output information from a particular packet. You could even have an AI control the X Axis. The idea is that you can change this function, and the rest of the game that needs to GetPlayerInputX, doesn't need to care about how it does it.

    It would be best to also have a SetPlayerInputX in this example. This concept of protecting code from changes to other pieces of code is called Information Hiding, or Encapsulation. It's an Object-Oriented Design Principle. Try googling those terms if it's something you're interested in learning more about.

    One more thing. I have zero experience with online multiplayer code. However, from what I understand, optimization is a more important issue when dealing with online code, so it's possible you may have to alter other parts of your cap to call a function like GetPlayerInputX less often than you will be able to for offline play. But you should need a lot less alterations to your code if you use functions.

  • Thanks for the suggestion.

    I'm leaning towards treating the entire game as one "Player" in and of itself and simply giving round/phase permissions based on turns and circumstance to whomever is logged into the game, no matter which format. In essence during the "movement" phase of someone's turn the game would lockout everyone but said Player and that player would only be able to do what's allowed during that phase. The only input to "Get" or be listened to is the final state of the game object relevant to that phase.

    When it goes networked it just sends/parses data from whatever (chat channel,etc.) and builds elements of the gamespace after every action. I SHOULD only have to inject 1 line of code per action in this case.... I think

    I'm still fuzzy on it but it's becoming clearer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi there.

    I am trying to do the exact same thing as you and also have the same dilemma.

    I decided to go first with a multiplayer framework and then build my game on that.

    I did not know anything about network programming so far so I plan to work with this as my backbone:

    [it is a python external python library network game tutorial]

    It is client-server based, the problem I am facing now is, what to do on the server side and what to leave to the client. Synchronization will be difficult here as I want events based on sprite collisions and other graphic dependencies.

    I also plan to use Lucid's 'S' plugin. Hope the plugin works with the python net library used in the tut. Be sure to check the plugin out

    Edit: Hehe, just saw your post in the tut thread so you already know about it :] Sorry then for spamming.

  • No such thing as spam here.

    My whole thing was just to try and come up with a way to not have much work making a non-networked game networked. Most of the code is obviously client-side, the server really only transmits short and simple chat strings periodically.

    That python library obviously has much more capability than a simple chat engine, but I dont really have enough knowledge to play with much more than chat. I'd LOVE to make a TBS game that had real-time animations (like when you pick up a piece to move it, everyone sees), but it's beyond me.

    Gotta start simple. Maybe I'll just do a proof of concept tutorial before I dive headfirst into my idea. And ideally, there would be a simple event-action plugin.

    Sounds like you're looking for something more "realtime" though yes? If turn-based, your sprite collisions and other graphic dependencies dont have anything to do with the server really.... that's all done client-side. All the server needs to know (done with tags) is stuff like:

    a) the player moved

    b) the player shot his gun

    c) the player dropped his bag

    ... and so on. What happens BECAUSE of this stuff (like collisions) is the client's responsibility.

    Btw, what's the 'S' plugin???

  • You can find the 'S' plugin by Lucid here:

    It is a plugin to...in short words make C-like structures possible in Construct. But there is more to it than those simple words say really The tuts done by Lucid are awesome.

    What I want to do is to use Construct Real-time collision detection for events so yes, make as much as possible in real time. But I want to have 'turns' as a kind of measurement for all the stuff that goes on in the game. The ideal model would be to have a game like old UFO geoscope that you can speed up/slow down/pause*, but I am afraid that sync between players can be to much of a problem. If the geoscope does not work out I plan to have a real time simulation of my game environment on the server that pauses each 'turn'[set of ticks] to get player orders.

    * I am afraid that when one player hits the pause button or 'slow game' button then the other players would receive the message few game ticks later. The longer the game runs the delays start to add up to a measurable value, then players wont see the same game any more but still send triggers based on they private game visage

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