troublesum's Recent Forum Activity

  • CasperRosewater - Absolutely. Remember if you can pick an instance and set text then you can pick an instance and set its CSS

    [attachment=2:16zfs9mm][/attachment:16zfs9mm]

    [attachment=1:16zfs9mm][/attachment:16zfs9mm]

    Updated capx

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

    Also just for future reference be sure when trying to get a hold of someone put the "@" symbol infront of their name so they will get an orange notification.

  • and here i was thinking i completely miss read the question because it seemed to easy.. haha... we all have those moments

  • You could just create a function and a var. And when an instance is created check of the var is true. If not then execute the function and set the var to true so the next time an instance is created the function wont be called again. Still requires at least one instance to be created but it will only be triggered once.

    var runonce = false;
    
    function Myfunction(){
     //do something
    }
    
    instanceProto.onCreate = function(){
        if(runonce==false){
             runonce = true;
             Myfunction();
        }
    }
    [/code:8d69cljx]
  • No problem... I updated my original post so you can re-download it from there to get the updated capx files.

  • CasperRosewater - Hmm. Is this happening on both capx or just one. I realized that one of the capx i provided was using a another plugin i didn't give you (not required.. i just accidentally left is added). I removed it and re-uploaded both capx again in the zip file. Try downloading and running it again.

    As for this error path:

    construct2\exporters\html5\plugins\table\common.js.

    I wouldn't rename folder. If Ashley Ever includes a "table" folder mine would b over writen so I would keep it the same name as what i put it. But any way try it again and let me know.

  • CasperRosewater - you know my plugin might actually be very useful for what your doing. Its really easy to work with text boxes dynamically when you have named storage. Here is a zip file with my plugin and a few examples. You might fund it useful for what your doing?

    Plugin + Example Capx

    [attachment=0:5ansb07h][/attachment:5ansb07h]

    Examples

    [attachment=2:5ansb07h][/attachment:5ansb07h]

    [attachment=1:5ansb07h][/attachment:5ansb07h]

    Edit: In case you not familure with how to install plugins just drop the plugin folder from the zip file to this directory "C:\Program Files\Construct 2\exporters\html5\plugins". Then re-open C2 and the capx should work

  • Unfortunately i don't think so. I had the same problem and ended up coming up with this solution. Pros and cons because Ashley's method is so much easier but you end up sacrificing functionality and speed for it. I tested by sending messages back and forth at first with x,y pos and noticed they were lightning quick so the lag has to be due to something else which i can only assume is CPU related to back end code linking the objects (the part that makes it easy).

  • That was mine i think.. are you referring to this?

    [attachment=1:2pggadvc][/attachment:2pggadvc]

    Its a custom plugin (I haven't published it yet) that i created that gives me 2D dynamic named storage with some cool features like sorting, merging, select where conditions stuff like that. Its basically a turbo charged hash table ... if you not sure what a has table is then think of it as 2 dimensional dictionary. The storage plugin is the same thing buts its 3 demensional. The list plugin is the same thing as a dictionary but optimized for better performance and works with raw JSON files (they all do).

    Any way if this is what your referring to in interested in using them id be happy to post them for you.

    Edit: better explanation I think

    • List = dictionary (with custom improvements)
    • Table = 2 dimensional dictionary (with custom improvements)
    • Storage = 3 dimensional dictionary (with custom improvements)

    Example Usage to help describe its purpose:

    [attachment=0:2pggadvc][/attachment:2pggadvc]

  • joelbelo Per your message I wanted to post a new updated version of my multiplayer platform example that uses functions to perform multiplayer actions instead of synced objects to eliminate lag. I have commented the code as best i can to help better understand it but its still more complicated than syncing objects. The difference is that there is almost no lag when you do persisted function calling and simulated actions.

    It supports unlimited players so just open as many browser windows as you want and click connect. Each player scrolls to them selves. Move them around using the arrow keys.

    Note: you will need the moveto plugin by rex for the capx to work. I assume most people have that plugin by now

    [attachment=0:3u0zys99][/attachment:3u0zys99]

    How it works:

    When "Player1" presses the left button instead of using the built-in behavior move i disable those on start and instead call a function "MoveLeft" and pass it a parameter of the peerid to move that simulates moving left for that player. At the same time i take the function parameters and the function name and package them into a dictionary. I then send the dictionary AsJSON in a multiplayer message to all peers. They load that JSON string back in to a dictionary on their end and then call the exact same function with all the same parameters that were sent in the dictionary. Both devices call the same function at near the same time.

    Based on my experience function calling messages appear to be just as fast as synced variables but don't have any over head performing lag calculations. Its just save AsJSON and load AsJSON. The irony is the side effect of syncing objects looks like it induces lag by using a large amount of CPU performing the calculations to correct for lag. Function calling is just a straight call so you do all the lag correction your self.

    To use as little bandwidth as possible I don't send the move left command every tick. I only send it once at the beginning (even though the user is holding down the move left key, the command is only sent once) and its repeated on the other end (persisted) until the player lifts his his finger off the key at which point a stop command is sent. This is accomplished by tagging the dictionary as a persisted action so when the peer receives it they lock it in and keep calling "MoveLeft" (even though they only received it once) until a dictionary message is sent with the same tag name but a different function telling it to stop. So for the full move event i send one dictionary telling it to move left. as soon as the player takes his finger off of the key i send a dictionary with a function to stop moving left and once the object has stopped moving i send the last dictionary with a moveto function call for the specific location to compensate for latency but ensure they are at the same position. 3 commands to move a player all the way across the screen with no lag using simulated functions. Now just to ensure its as accurate as possible while moving every 20-30 ticks or so the player will send a set pos command to account for any latency.

    You will notice there is basically no lag and movement is smooth. I know that function calling is bit more complex but once you get used it it makes lag free actions very easy. Give it a try and let me know if it helps

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure what limitations might exist in the free version but here you go...

    First make sure your selecting the right control. You might be selecting the text object and not the "Textbox" object

    [attachment=2:1lgc5vle][/attachment:1lgc5vle]

    Then you need to add the action to the event sheet.

    [attachment=1:1lgc5vle][/attachment:1lgc5vle]

    You will find it here in the action window

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

    Hope this helps...

  • Glad it helped... Good rule of thumb when making mobile games...is try to avoid doing anything on every tick if you can that isn't specifically related object movement. Set X,Y any time you want cause those are movement but things like conditional changes like when to change animation (if i can get a way with it) or spawn sprites and stuff like that I put in an every 0.nth(sec) to squeeze as much juice out of the app as i can for movement and actual animations that are currently playing. sure my smoke takes 0.1 second to show up after a hit but the player doesn't notice it and i don't waste CPU every tick checking if its time to show it. I want movement as smooth as possible always so some things get sacrificed. Good luck!

  • Whiteclaws Thanks... curious then why we don't see many (any really) true multiplayer games on the market. Yah theres words with friends and stuff like that but those are too slow. I want tanks shooting at each other (Im currently making a scorched earth clone ) or platform fighters. I feel that's the next thing with mobile games and C2 really does make it easy. People have got be getting tired of playing against the computer by now.

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