troublesum's Forum Posts

  • 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

  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • First thing i would do i move those Set Text out of the every tick condition and put them in an every 0.5 sec - 1sec. I Notice a massive loss of performance updating text on every tick on mobile.

  • Question for the unity guys since I have no experience with anything else except C2. I only wanted to make multiplayer games. Turn based at first because I I'm web developer and could write AJAX in my sleep (when i bought C2 it only has AJAX but i was sold on that alone). But the multiplayer plugin is god send and actually works well enough for Real-time platformer on mobile. Can unity or any other native app support anything close to the multiplayer plugin offered by C2? To my knowledge i haven't seen a single mobile game that has real multiplayer functionality. They all use push sends and stuff like that.

  • So each trigger becomes an instance of the condition "OnFunction" and it loops through every trigger instance passing the name parameter to the condition until it returns true to know where the corresponding actions are to execute. But your pre building those "OnFunction" conditions somewhere else before the game is started so there is no looping. Interesting I guess that's why the alert() function i added to the "OnFunction" condition wasn't working when i trying to figure out how cf_fast_trigger works.