troublesum's Recent Forum Activity

  • rex is definitely the authority on plugins but to add to what i think your problem is that you are not passing the correct instance of the spritefont object your trying to change to the function you are calling.

    "this.inst" <- I assume that's the instance of your plugin your passing to the function call? But what it needs to be is the sprite font object instance you want to scale.

    You need to somewhere get the instance of the sprite font object usually by adding a condition to pick it. Once picked you store instance of the sprite font into a variable like "this.spriteFontInstance"

    Your function call would then look like this.

    cr.plugins_.Spritefont2.prototype.acts.SetScale.call(this.spriteFontInstance, 0.5);[/code:3hi931cq]
  • Robsta If it helps you in any way then im glad... ... yah i have since changed how i coordinate instructions (I since turned this into a plugin also, so its all done with a single line now) but i now i set position prior to every move instruction and don't update position every 30 ticks anymore. This reduced jerkiness as you described and aided in syncing being more accurate. Also as long as the host is the only entity validating events like when a player is hit then its less prone to hacking. Just because a peer sees something get hit doesn't mean it actually happened. Only if the host sees it will the host then call a function to indicate a hit for all peers. Host controls all game metrics and events always. Players just move them selves and tell the host what they are doing. (The example doesn't reflect this very well as its just showing movement with out any game events). In any case if you have any questions about this method I'm happy to help.

  • It didn't work? Really... I use this method (even in my commercial projects) and it works... granted I just mash the keyboard (or have PHP generate it) and generate a longer string but the concept is still the same.

    This is what mine usually looks like <script src="c2runtime.js?version=euwkjfskdfskddfsdfwrfsdnf"></script>

    I can say from experience (As a web developer) that this is how its done. Try it with a longer random string name. It should work..

  • Yes, you need append a parameter/string to the file name in the c2runtime.js script tag and change it when your file changes.

    Locate this text in the "index.html" file

    <script src="c2runtime.js"></script>

    And change to something like this

    <script src="c2runtime.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="c2runtime.js?version=1.1"></script>

    This will trick the browser into thinking it s new file and not used the cached file.

  • Kniggles Your GET string you typed in is missing an argument. You need an "&" symbol just before password in text so the GET string parameters now where the username value stops and password parameter starts

    "http://mywebsite.com/getscoresPLAYERone.php?username="&playerName&"&password="&password

    In full string view it would like this

    [http://mywebsite.com/getscoresPLAYERone.php?username=troublesum

    &password=12345]

  • Robsta - The best way I found to do this so far is to synchronize instructions instead of objects for multiplayer platform based games. Its bit more complicated but I call functions cross device to achieve this. Here's a working example of a multiplayer platform using functions. Maybe you can adapt it to your project if you like how it works.

    Open a few browser windows, click connect on each and then use arrows to move.

    [attachment=0:pwgnwr68][/attachment:pwgnwr68]

  • Not bad.. I like the little intro story, but didn't like having to press enter every time. Could just be me but i would make that a play sequence with an option to skip (for return players). The camera work (view positioning) was nicely done. Good transitions, very impressive. Game play and user experience was intuitive, I knew what i was supposed to do and how to do it, accept when the player looses health when getting hit, the fading trail almost feels like i got a speed boost as opposed to being hit. Just the visual effect i guess but at first i was confused at to what had happened. After few screens though i got a little bored because after i kill an enemy if i die before finishing the level and respawn those enemy's are no longer there so i get bored going through game terrain to catch up to where i last died. Maybe don't have the player start so far back when they die so they always get instant action or re-spawn the enemy's so i have something to do catching up to my last point. Lastly I would just add some more parallax objects like clouds or something so as I'm scrolling the movement doesn't feel so fixed the few that are there don't feel like enough to keep persective. But all in all this has a lot a potential. Nice Job!

    Not game related:

    The file appears to be large and takes a while to load.. the first time you load it you just see a black box for quite some time and don't realize the file is still loading. I refreshed the page a few times thinking it broke. I would add some sort of spinning wheel if you can to indicate loading.

    But again. Nice job!

  • xoros Yeah is more complicated... Ill try my best to describe how it works (as a developer i can write pretty complicated/convoluted code)

    So to start out what I do is call functions simultaneously on all devices. I sync instructions not objects. Take a look at the Player event "Keyboard LeftArrow" You will notice i call two functions. One of them calls a function "MoveLeft" to move the player on my screen using a simulated action. You will notice the "MoveLeft" function takes a peerid as the parameter. This is so the function will for work any player (as you will see this is the same function each client will call as well using the the peerid they receive).

    [attachment=0:22fjanwm][/attachment:22fjanwm]

    The other function I call "Sync_MoveLeft". This is where the magic happens. "Sync_MoveLeft" packages up the function name "MoveLeft" and a peerid (which is my id since im the one that called it and loads them to a dictionary and then sends the dictionary AsJSON to all peers. Each peer receives the JSON string and loads it back into a dictionary on their end. They read the function name they are supposed to call and the parameters (peerid) they should pass to it and call that same "MoveLeft" function for me on there screen. All clients call the same function. pretty neat...

    But I found that the signalling just wasn't quite fast enough and the player would stutter a bit while moving. This where extrapolation comes in. What did was a create method for telling the peers to persist the function call on there end. You will notice in the Sync_MoveLeft function I also package up a persist value of 1. On the peers end they see this persist value and load the dictionary for constant use on their end. So every tick they will now call the move left command with the same peerid even if i don't send another. Poof! the player moves smoothly now.

    But now the player will move left to infinity so I need a way to tell it to clear that persisted action. So in the "Sync_MoveLeft" I also package up a persist tag (action tag really) with a key name "move" and the peerid of the player (more than one player could be calling move left at the same time). So what each peer does is when the see a persist value of 1 they check the perstsTag and if a persistTag already exists is clears it. So MoveLeft is persisted until MoveRight is called or stop is called. Bingo.. solid movement and precision control. If i call the same function twice thats not big deal because the persits tag will match and just keep using the same function anyway.

    Last just to account account for any potential lag I send a set position command every 30 ticks while I'm moving to ensure player objects don't drift to far out of sync while performing persisted actions.

    And that in a nutshell is how it works. Theres a bit more in there but I think if you follow the code along with the comments it should make more sense over time. Its just nice to know that you can achieve smooth movement you just have to do some of the heavy lifting you self and write some extra code.

  • I haven't used LiteTween but MoveTo is so simple it fits the paradigm of C2 perfectly. MoveTo would have my vote to be inducted into official status. In any case I never understood why something like this wasn't standard in C2 to begin with.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Every time i see a post referring this I make the argument that for platform multiplayer games the current method of if interpolation doesn't work very well. What I do is sync instructions instead of objects and get perfect results. Its a bit more complicated but it works. Not realizing what I had developed after researching I found that what im doing is called extrapolation where the client predicts position based on state instead of plotting between two known points.

    Here is an example platformer that syncs instructions (function calling) instead of objects. Your welcome to try and adapt it. Just open it in a couple of browsers, click connect then use arrows to move players. You will see the synchronization is near flawless.

    [attachment=0:xtgdvv0o][/attachment:xtgdvv0o]

  • Ahh.. out of my league... good luck

  • "random()" will produce a floating point (decimal) number between 0 and 1 Ex. 0.24523 at which point you can round or perform some math to clean up the number as desired.

    To choose from a list of possible values you can do "choose(1,2,3)" which will randomly select either 1,2,3 as per the example. Is that what you mean by distributed?

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