troublesum's Forum Posts

  • 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

  • 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

  • Although I will say the one saving grace about functions is they are the only true dynamically referable object (Called by String) in C2.. with out that functionality I wouldn't be able to create a game engine (Processor that calls a threaded function stack) or call functions across device in multipliplayer. If they can make the function names show up in intellisense with out losing the dynamic reference I would be a very happy panda

  • +1

    I would love this too. For now I'm stuck creating global variables with the same name so they show up in intellisense. Granted considering the number of functions my project has I would like to add that if this ever gets added to the IDE to nest it in a global param like fn.functionName so that way all my functions don't show up in the menu by default and clutter the list.

  • At the moment I don't believe there is an easy way to handle this. The only option for now until Ashley some how adds this (not even sure its possible in game) is to have your own web server handle player connections. (web developer would be needed)

    1- Basically create your own lobby system (website) where players select/create the room they want and then based on session whe the game loads join the selected room. This only works for games hosted on your server (web based) and not APK's as you wont be able to maintain session information. (This is what I'm doing)

    2 - Still requires a web server with single table in a database to match incoming players to their rooms via Ajax but it should work with APK's as long as Ajax is still working in game. Users wont be able to select who they play as it will always be next available but it should work. (I created this but I would prefer players be able to match them selves up with people of their choice so i went with option one)

    Others may have found another way (feel free to chime in) that I'm not familiar with but for now i think this is the only way?

  • yes.. it seams to happen for me when viewing debug items that are updated frequently. I get a huge performance hit. Its enough I can hear my fan spin up on my desktop cause the CPU is working so hard. C2 168

  • [quote:1ffx73v9]With my current method of using the C2 array my column names are C2 instance variables and so they show up in the C2 intellisense and when I change a variable name it goes through all the events and updates the name in all the places where I used that variable... with your plugin is that possible or not because you are referring to everything with strings of text?

    Is this what you mean for intellensence? You could have variables with string names that are used for referencing.

    [attachment=1:1ffx73v9][/attachment:1ffx73v9]

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

  • Yann Good lord sir... a simple "well that's kind of true but you meant to say was hash table" i think would have sufficed and even then that's nitpicking considering most C2 users aren't developers. I may as well be on reddit with a response like this. Yes all I did was mask a 3 dimensional JavaScript "object" (technically not an array for those that are in to symantecs) similar to whats available in most high level languages like JavaScript or PHP. That "object" however, which for most developers that program in high level languages, is considered and used like an array (they are practically synonymous even though not technically the same). I want people to use my plugin, not be scared away by complicated technical jargon, so they would have an option for dynamically "string" accessible 3 dimensional information which isn't currently available C2.

    I encourage you to at least try my plug in and offer constructive criticism on it before giving me a hard time for being symanteclly incorrect.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads