Is multiplayer "ghosting" possible?

  • Alright so I heard of Construct 2 through their reddit post on /r/gamedev and it really appealed to me as one man team who is artistically inclined but rather bad at code. On their post I asked about multiplayer and they informed me that turn-based multiplayer was possible but real-time was not, due to engine limitations.

    Knowing the multiplayer limitations but not exactly sure the full limits of them, my question is as follows: Is it possible for one player to issue a challenge to another, carry out that action, then when player two is ready to accept that challenge, compete with player one in real time in that regard? So basically, player one would be competing against time while player two would be competing against player one. Is Construct capable of doing this or can I only have both players compete against time and compare after both are finished?

    Thanks for taking the time to read this,

    Plague

  • I suppose it could be possible, if you develop an algorithm to turn a sequence of moves into a long string, and convert it back on another computer.

    Also, if you don't know good server coding, you probable need to forget multiplayer gaming for the moment!

    (Keep in mind this is all based off what I have heard. I could be entirely wrong.)

    Make sure you browse the plugins section as you will need third party plugins to facilitate multiplayer.

  • Plague

    Construct 2 doesn't currently offer the functionality you need. And as squiddster indicates, it's the server-side coding that's critical. The challenges/actions of your players have to be communicated by the server component of the game. Real time is certainly possible if you've got a capable server.

    There are multiplayer plugins currently under development to handle the client/Construct side of the game. You can read about them in other threads - Here's one thread that will give you more info.

  • Really appreciate the responses! I will research all I can about the multiplayer plugins to investigate how far I can push turn-based combat.

    If it helps paint a picture, I plan on releasing to smart phone devices.

  • Plague, what kind of game do you think?

    I'm thinking about something using ajax: posting/getting every player action to/from server, so comparing previous values could perform the other player's action.

  • Try Construct 3

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

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

    Yes I believe something to that effect would work nicely. I plan on having two systems, a turn-based 'combat' back and forth (when Player 2 plays, Player 1's play is played back in a short sequence, similar to the "With Friends" games). The part that I am not sure if it is possible is essentially the second competition system. In which, player one competes against time and player two competes against a replay of player 1 (like when you try to beat your "ghost" in old racing games).

    To simplify things, the latter is basically a racing system and, since real time racing seems difficult to pull off, I wanted to try and figure out how to sequence them to give the illusion of real-time, with the benefit of doing it when the player wants, which is essential for someone using a mobile app.

  • Plaque

    AJAX will be ok for your turn-based system, but for your real-time competing, the only way to go is WebSockets. Both the C2 plugins currently under development use the socket.io implementation of WebSockets.

  • Velojet

    Sorry if I was confusing, I don't want to do any realtime stuff. I believe turn-based systems are superior for tactics as well as convenience on mobile devices. I understand that realtime processing is pretty difficult to do, especially for someone like me who is very much a newbie with code. I proposed a pseudo-realtime model in which player 1's action is repeated to player 2 so player 2 is not confused as to what exactly happened. To take it a step further, I wanted to see if it was possible for player 2 to take their turn over player 1's turn (for things like racing). Similar to how in say, Mario Kart, you could do time trials against yourself, which would appear as a ghost.

  • Plague : one way of doing the ghosting would be to record the key presses (up or down) that a player does and record the time (relative to the start of the turn, current_time - beginning_time) when that event happened. You could store that info into a string by appending to the string every time that event happens, and separate the info with commas to separate events and a ! for separating the time from the event type. At the end of the turn, your string would eb something like:

    L!D!3.10,L!U!7,L!D!14,L!U25...

    Where L is a code for the Left key, D is key down, U is key is up and the numbers are the seconds since the start of the turn. Now for smarthphone, I am not sure what events you will use to move the player, but you can use the same idea. When the turn ends, you can send the string via AJAX to your custom server (you or somebody will have to write the server-side code) and when the other player (player2) can chooses to refresh his screen to receive any new data, your C2 code will need to do another Ajax request to ask for any new data.

    Your server side code will need to return the string sent by the other player. Once the string arrives at player2 via Ajax, you can devise something to split the string into arrays and then call each of the events at the time associated with them by using the compare "Compare Time" condition to compare the relative time with the time registered in the string for the 1st event.

    The above is a very high level overview of what you could do, it will take you some time to tune up by trial and error and may or not work for you.

  • juantar

    Thank you for the descriptive explanation! I will be sure to save this information. Do you know of any server architectures I could use that would be more reliable than a home-run one? Would OpenFeint have the capabilities I needed to do this type of stuff?

  • Plague : I have never used openfeint before. For server side code, I always use GAE (google app engine), which is a free hosting (up to a limit) service that allows you to write custom server code in python. I suggest learning and using that because it will help you in the long run.

  • Plague:

    If you go the WebSockets way and use the socket.io implementation under Node.js, then there's free Nodester hosting (server- and client-side coding in JavaScript).

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