troublesum's Recent Forum Activity

  • You could try syncing instructions in stead of objects. I use extrapolation (predict location based on active state) instead of interpolation (plot movement based on known points) to coordinate movement.

    My way is much more complicated but for platform games it provides the results your looking for. What I do is call functions simultaneously on each device to sync the action instead of the object. Here is an example capx to demonstrate the theory. Open on multiple browsers, click connect. use arrow keys to move objects. Try it with 2,3,4 players and see

    [attachment=0:16aa78t5][/attachment:16aa78t5]

    Edit: I have reduced all the code from this example to simple plugin but haven't released the plugin yet (I'm debating on whether its worth the head ache of supporting it). In the mean time this example with out the plugin works if you want to give it try.

  • The more flexible the system the more logic you need to get specific results.

    I updated your capx

    [attachment=1:zyj9rkp0][/attachment:zyj9rkp0]

    There are so many ways to validate the click, some easy some hard. This is just one example that takes into account the relative position and zindex of the green sprite. I usually use variables to enable what i want clickable. But based on your example i chose to do this.

    [attachment=0:zyj9rkp0][/attachment:zyj9rkp0]

    In any case that's just the nature of programming. sometimes you have to do the heavy lifting.

  • You could Just add is visible to the condition or set variable when you want it enabled.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Having experience creating (multiplayer) plugins I can say that certain input expressions need to be explicitly in a certain format (string,int,etc) so as not to break the functionality of the object. The plugin parameter types are a predefined by the creator of the plugin as to what it will accept "paramAny, paramNumber, paramString" usually for a reason. In the case of multiplayer message (where i have a lot of experience) the problem you would have is that if you try to send a number it will always have to be converted to a string before being sent by the plugin. So when its received on the other end you will get a string in stead of the int you sent any way. You would have to convert it back to an int on the other end regardless.

    The best method for maintain data types for string transmission is JSON. With out any 3rd party plugins the easiest way to pass data is to load it into a dictionary, send the dictionary AsJSON and then when the peer receives it that load that JSON back into a dictionary and act on the data. By doing it this way you can maintain data types and can send complex instructions all in a single transmission. I can say with certainty that its just as fast and completely reliable as i do all of my multiplayer data transmission in this format.

  • Bl4ckSh33p - I had the same problem and after debugging the multiplayer plugin I found that once the peer connects to the room it still has to wait for the host to link to it. Its not part of the original process of joining the room. There is a peer condition called "Is Ready for Input" that you can work with to determine when its ok to start sending messages.

    Edit: Apparently I missed your last line as you mentioned "Is ready for input"

  • I posted this on your other thead but wanted to reply to this one as well.

    Make sure your encapsulating the php array in the format that the C2 array is expecting.

     $myArray = array();
        $myArray[] = 4;
        $myArray[] = 3;
        $myArray[] = 1;
        $myArray[] = 3;
        $myArray[] = 1;
    
        $output = array(
    	'c2array' => true,
    	'size' => array(
    	    0 => count($myArray),
    	    1 => 1,
    	    2 => 1
    	),
    	'data' => array()
        );
    
        $x = 0;
        foreach ($myArray as $value) {
    	$output['data'][$x] = array();
    	$output['data'][$x][0] = array();
    	$output['data'][$x][0][0] = $value;
    	$x++;
        }
    
        return json_encode($output);
    [/code:3rbxiej0]
    
    The resulting JSON string would look like this :
    {"c2array":true,"size":[5,1,1],"data":[[[4]],[[3]],[[1]],[[3]],[[1]]]}
    
    You can now take this string as is and load to the Array in C2
  • Make sure your ecapsulating the php array in the format that the C2 array is expecting.

     $myArray = array();
        $myArray[] = 4;
        $myArray[] = 3;
        $myArray[] = 1;
        $myArray[] = 3;
        $myArray[] = 1;
    
        $output = array(
    	'c2array' => true,
    	'size' => array(
    	    0 => count($myArray),
    	    1 => 1,
    	    2 => 1
    	),
    	'data' => array()
        );
    
        $x = 0;
        foreach ($myArray as $value) {
    	$output['data'][$x] = array();
    	$output['data'][$x][0] = array();
    	$output['data'][$x][0][0] = $value;
    	$x++;
        }
    
        return json_encode($output);
    [/code:1gjt5210]
    
    The resulting JSON string would look like this :
    {"c2array":true,"size":[5,1,1],"data":[[[4]],[[3]],[[1]],[[3]],[[1]]]}
    
    You can now take this string as is and load to the Array in C2
  • I've never tried it but this site claims to offer what you would need to turn your laptop wireless connection in to a wireless access point providing a link between it and other wifi enabled devices (your cell phone) via wireless network connection.

    http://virtualrouter.codeplex.com/

    Good luck.. let me know if this works.

  • You got it.. just change the version number every time you publish a new version of the game and the browsers will grab the new file instead of using a cached one.

  • There is only one method im aware of to accomplish this but I dont think C2 has any ability to do this. The trick is to append a parameter/string to the file name in the script tag (assuming your hosting your files) and change it when you file changes.

    Example:

    <script src="myfile.js?version=1.0"></script>

    The browser interprets the whole string as the file path even though what comes after the "?" are parameters. So next time you update your file just change the number in the script tag on your website (Example <script src="myfile.js?version=1.1"></script>) and each users browser will see the file has changed and grab a new copy.

  • Ex value = 183

    round(value/10)*10 = 180

    Ex value = 187

    round(value/10)*10 = 190

  • I use a 3rd party plugin for the moveto function but this is what i do.

    Create SpriteFont and give it behavior fade and set the fade out params. So by default as soon as i create the object anywhere on the screen even if i don't move it it will disapear in just under a second and destroy itself. Then assign the moveto behavior and give it a speed so as i spawn it i can tell it where to move (up down left, etc..)

    [attachment=1:1bfz9a2l][/attachment:1bfz9a2l]

    Next I create a function that spawns the object where i want and tell it to move up 100 pixels. (just enough so that by the time it reaches its destination is faded out)

    [attachment=0:1bfz9a2l][/attachment:1bfz9a2l]

troublesum's avatar

troublesum

Member since 4 Dec, 2013

Twitter
troublesum has 2 followers

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies