troublesum's Forum Posts

  • mdvgames - I don't think i understand your question? Are you having a problem?

    The idea is that when a peer successfully connects he calls a function "Spawn_Player" locally on his device and pass it his peer id and start location to create him self on his screen. He then calls a function "sync_SpawnPlayer" that will call that same function all other peers devices with the same information so now his peer object is created on everyone else's screen too. The sync message is really only sent to the host and then the host will broad cast it to the other peers so they call function he wanted with the parameters he passed.

  • Radulepy - Its been a while since I've checked but I'm pretty sure current exporters don't support WebRTC yet (someone please correct me if you know differently) so you can't even make multi-player games as stand alone apps yet.

    So assuming its multi-player game using Official C2 Multiplayer Plugin (Uses WebRTC) the game files need to be launched in a real browser (That supports WebRTC as not all of them currently do) from a real website that people will go to, to play the game. That domain has to be hosted somewhere. If I go to Radulepy.com to play the game, that domain name has to translate to an IP address somewhere on the internet that is serving the game files that will launch the game on my computer. How will people find your game with out the game files being served to them from a server either hosted by you or externally that you pay for?

  • Paincho hmm.. Only other things i can think of is if this server has a website running on it and Apache or IIS is running and listening to those ports it will prevent node from starting the listener. If you have no other web services running the I would suggest restarting the computer if you haven't tried that to clear any old node listeners that may not have closed properly due to an improper start (I had to do this a few times). Other than that if by some chance the host specifically requires a domain name and wont work from IP (its a long shot as I don't fully understand web-sockets but know enough to be dangerous) you may need to purchase a domain name and point it to your public ip

  • Does this server have a direct connection to the internet from that IP or is it behind a router? You may have to forward port 443 and 80 from the router to the local IP (192.168.x.x) of the server so the path can be completed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • While creating a webworker that can execute dynamically generated code (ex. action script inside a function) is possible it would be complex to achieve though as you would need an algorithm to prep code and stringify it to be executed in a eval() statement in the worker, on top that and the elephant that really prevents this from being usable is that web workers have no access to DOM objects including the canvas for drawing purposes. You can only run large equations the work with specific variables (path finding) or data management actions (sorting or re-configuring array data) that have no DOM requirements in it.

    If you wanted to try and create your own plugin this will get you started.

    Method for taking all code inside a function and converting it to a string to be passed to the eval statement

    function stringifyFunction(callback) {
        //used to return stringified code from a function to make eval() usage easier
        var string = callback.toString();
        var startPos = strpos('{', string) + 1;
        string = string.slice(startPos, string.lastIndexOf('}'));
        return string;
    }
    [/code:t6z1jcpd]
    
    Your action script
    [code:t6z1jcpd]
    var worker = new Worker("workerFilePathGoesHere");
    
    var workFunction = stringifyFunction(function(){
        
        //this puts the cart before the horse as you will below this send the data variable
        //IE  data.test = 42;
    
        var response;
     
        //dynamic code goes here acting on the data you passed to it and sets something in response variable
    
         response = data.test + 1;
    
        //send response back when finished
        postMessage(response);
    
    })
    
    var data = {
        test : 42
    }
    
    //Send
    worker.postMessage({
        data : data,
        work : workFunction
    })
    
    //Receive
    worker.onmessage = function (e) {
    	   var response = e.data;
               //response = 43
               // the response from the work file will be here.
               // after ward you can trigger anything else on the even sheet and pass or store this response as needed
    	    worker.terminate();
    	}
    [/code:t6z1jcpd]
    
    worker file that can work on dynamically generated stringified code
    [code:t6z1jcpd]
    self.addEventListener('message', function(e) {
        var data = e.data.data
        eval(e.data.work);
        self.close();
    })
    [/code:t6z1jcpd]
    
    I can't take you any farther but good luck
  • its possible but it will probably be more work than its worth.. You can send an AJAX request to your PHP server and then call a PHP function to read a webpage to string

    $content = readfile("https://google.com/")

    with google you can pass it search parameters in the URI string Example.

    $content = readfile("https://www.google.com/#q=scirra")

    From there you can parse the html code received and do what ever you want with it but you're in effect attempting to create a webcrawler and parsing HTML is a daunting task. I wish you luck in your journey.

  • Moved files to drop box and updated the links... they can be downloaded again.

  • Yah.. the forum doesnt support files any more.. i need to upload it to drop box and create a link.. ill gget the links up tomorrow

  • On a final note, I do remember that ashley told rexrainbow... or someone on the forums that it was a bad idea to call the aces of another behavior from within a behavior.

    Ruskul - It is bad ... because it creates a dependency on other plugins that the user might not have and if those plugins get updated by Ashley the new changes might break your code or worse yours breaks the functionality of the existing plugin. That's why I wont release this plugin. I don't want to pollute the C2 ecosystem with a plugin that may become defective and not work in the future and some poor dev cant open his project in the future because of it.

  • Ruskul - Interesting... while intellesense (I hadn't even considered this) would solve have the problem the last part is if the user removes the behavior there would have to be the dependency check on the reverse side to remove the code in use or warn the user about the error but maybe I'm thinking about this wrong. I wonder if it were possible for Ashley to have 2 IDE's in one. One that's visual that prevents you from making mistakes (like the current IDE) and another one that's for advanced devs allowing them to make mistakes but because they're actual developers that's on them if they get it wrong. That would be interesting if Ashley could pull that off

  • Ruskul - haha.. thanks... and prototype is ugly .. good god if there one thing i hate more its reading and working on object oriented code by developers that use prototype. I know its the standard but the Internet guys need to make method available that's cleaner and more intuitive.

  • Ruskul - You wouldn't be able code this because someObject might not have the behavior enabled that your coding for. If your code depends on a plugin function (IsOverlapping) then you have to have a way to force the developer to enable that behavior for all the sprites that will be worked on by your code. To do this Ashley would have to build in dependency checking and notify the developer that a behavior is required based on the code requirements. Hence the visual IDE he created that does exactly this but in reverse allowing you to select what you have enabled from a drop down menu because that's the only way its even possible to do this and prevent users from writing invalid code.

  • Ruskul - I feel like saying the SDK sux is a bit unfair. I found it fairly easy to learn the API Ashley put in place and write my own plugins. I'm not a fan of the code format as it could have been cleaner but the functionality to do what you want is there. I have a personal plugin (unreleased) that joins the Multiplayer and Function plugins together so I can pass parameters and call functions on all/specific peers with a signal event action. That's pretty powerful functionality available in the API and there are tons more sophisticated plugins than that which are available on the forum. I might be a little biased because I am professional JavaScript developer and I can write it fluidly. But other than the code format its really easy to use.

    I don't know if you know how to code in JavaScript but if you do and I in no way mean to put down your coding abilities but you should see how I rewrote the API from the template Ashley provides to be more clean and intuitive. I removed all prototype usage because its confusing as hell to follow. Check out the runtime.js file from my 2D Dictionary Plugin https://www.scirra.com/forum/plugin-table-2d-dictionary_t125862. If you use any kind of IDE with code folding (i use netbeans) you will see how much easier it is to read and use and might not think it sux.

    You can see how much cleaner and easier it is to add Actions,Conditions,Expressions

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

  • Interesting... a quick way to see what plugins you have that have an update available that can be one click updated is a great idea!... I recommend if possible to keep a version history that users can revert to if for some reason an updated plugin is broken they can go back to the last good version they were using.

  • bucktoothfrog - Per your request was able to add the ability to Merge C2 Data editor arrays directly into the Storage object. I have updated the original post so please re-download the plugin from there. Below are some screen shots and examples of usage.

    Example of loading the AsJSON example of the C2 Data Editor you gave me and then retrieving the values.

    [attachment=2:2k6x8nqb][/attachment:2k6x8nqb]

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

    Example Capx

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

    Let me know if you have any questions. Thank you