troublesum's Recent Forum Activity

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

  • Based on your description it sounds like the Multiplayer plugin can only execute 1 tag per tick (make sense as i don't think it stacks information). So the last message you put in the "yourDeal" tag is what gets sent as everything else is just overwriten by it.

    So you could either spread it out to 4 different tags IE "yourDeal1" ,"yourDeal2" etc... or try doing an Every Tick if some var less than 4 increment var and set the array and send that message... You will use 4 ticks, 1 to send each message.

  • So I found how to make it work the way I want and allow variable names for function name declaration (yes i copied it and left the original in tact )...

    by removing the "cf_fast trigger" from the OnFunction Condition in the edittime.js

    AddCondition(0,	cf_trigger |cf_fast_trigger, "On function", "Function", "On <b>{0}</b>", "Triggered when a function is called.", "OnFunction");[/code:3qr3zex4]
    
    and then removing the fs.name from being passed to the trigger in the CallFunction action in the runtime.js. 
    [code:3qr3zex4]var ran = this.runtime.trigger(cr.plugins_.Function.prototype.cnds.OnFunction, this,fs.name);[/code:3qr3zex4]
    
    Granted I haven't fully tested to see what else might be broken but functions appear to work the way i want now and still work by name reference. I was wondering if you can tell me what benefit there is to having the cf_fast_trigger vs not having it?  Im sure its implied in the name but what am i actually losing by removing it?
  • Ashley - It would be nice to have the function name show in the intellense list so we can select it, move on, and know it is typed correctly. Its pain to debug something that doesn't work because of a miss typed function name somewhere in our code (specially for those of us that use functions for everything). Unfortunately the work around for now is to have the function name both declared on the function its self and then again on a variable we use through out our code to avoid this issue. The constant variable would allow us to declare the function name only once and then be able use that variable both on the declaration of the function and then everywhere through out our code. If we decide to re-scope the project because our naming conventions change it is also much less work as the function name will change every where in code because its a variable in the project.

  • Not a bug... That's just how functions work in C2 they use the "cf_fast_trigger" flag which forces you to use a string represented as a constant not to be confused as a constant variable that is a string. I attempted to remove this restriction on my plugin with no luck. I ended up breaking the function plugin with out it and had to revert back. There is currently no method anyone is aware of to use variables of any kind as a function name declaration.

  • Pandy yah my event sheets tend to look over complicated (I get that a lot). I'm also lazy with not commenting my code very well. Anyway you have to keep in mind that sometimes the simplest solution is not the best (seriously). It might seem like its really easy to just associate an object and have the host create it but you wind up losing flexibility in the process. I create functions for every (and I mean EVERYTHING). From spawning sprites to setting attributes to moving players object to fire projectiles to you name it (EVERYTHING). Nothing happens in my code that isn't called from a function. By doing this I can and do sync every action across all peers with functions no matter who initiates the function. But keeping to what Ashley said some functions are only ever called by the host depending if they are game state events like a point was scored or a hit was registered. IE the peer may signal that he fired a shot and from where but after the shot is fired, only the host is allowed to determine if it made a hit and will call a function on all peers to let them know a hit was made.

    Anyway with all that said I cant really help you with what do when you sync objects as I don't code that way. What I would try to do is reduce more of your code to small functions (spawning sprites, destroying sprites, setting text.. etc) and call them on both devices simultaneously as in the example. It will take some time to get used to but you wind having the control your looking for.

    To give proof of concept (and provide more complicated code) here is multiplayer platform example that uses nothing but functions. There is some fancy stuff in there that persists functions related to movement to reduce network overhead and lag (you will notice my object have almost not lag) but you will get the idea of how I use functions for everything.

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

    Edit: For got to mention you will need the moveto plugin by rex to use it. I assume most people have that plugin by now

    Same as before just open 2 browser windows enter the room name and player name in each and click connect. once both players are in use the arrow keys to move them around. (supports only 2 players per room or it will break)

  • If i'm not mistaken i thought ashley said somewhere that the multiplayer plugin already detects if your on LAN and handles data accordingly? The way he explained it is that the signaling server just sets up communication but then after that each device actually talks directly to the other devices that are connected with out going through the signalling server. So if your on LAN they talk to each other across the LAN. It probably already works the way you want.

  • Have you tried calling functions from host to peer and vise versa. Its much easier (specially when you game is only 2 players) and gives a fair amount of control.

    Heres and example CapX of calling functions cross device

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

    Just open up two browsers. Click connect on both and then type in the chat box and click send. the corresponding sprite fonts will be updated

    Hopefully it helps

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You do not have permission to view this post

  • +1 but I would happy if it would at least highlight my results when searching... lets start with the basics first

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