JohnnySheffield's Recent Forum Activity

  • Great work!

    Really glad someone took time to improve socket.io integration in C2.

    Cheers!

  • Great resources, thanks for sharing!

    My test have shown that with using socket.io i get acceptable real-time results (Acceptable for me), with hosting on nodejitsu (i'm in europe).

    It would be probably better if i'm using my own local server, but that's on the to-do list!

    Also, i'm not sure does it affect the performance, but for my games, i edit the plugin and add my own events to the edittime.js and runtime.js, so i don't have to split data, then compare the first element of array then do some actions. That way, the code looks messy and it's not easy to maintain.

    What i do is add a condition to edittime.js somwhere around line 22 like this:

    AddCondition(5, cf_trigger, "On my event", "My Category", "On My event", "Triggered when my event", "MyEvent");

    To the runtime.js somwhere around line 120:

              socket["on"]

              (

                  ?'MyEvent',

                  ?function(data)

                  ?{

                  ?instance.dataStack.push(data);

                  ?runtime.trigger(pluginProto.cnds.MyEvent,instance);

                  ?}

              );

    and finally add a condition to the condition list around line 265:

         cnds.MyEvent = function()

         {

              return true;

         };

    So i my code looks like:

    On My event ---> DoAction (Split data or not, your choice)

    And not like:

    On Data ---> Split Data

       ---> If LastDataElement(0)="My Event" ---> DoAction

    As for making it work with JSON, maybe look into the following plugins:

    Load JSON

    Hash Table

    And perhaps use them in combination with this plugin!

    Also, if you do some edits to the plugin, i'd be really grateful if you'd share the edits so i can implement them in the plugin, and if you have some test to share that would be great also!

    Cheers!

  • Thanks for this great plugin but I'm having trouble understanding the LastData bit.

    Why not present data?

    Consider:

    io.sockets.on('connection', function (client) {

            client.userid = UUID();

            client.emit('onconnection', {id: client.id});

            console.log('\t socket.io:: player ' + client.userid + ' connected');

            client.on('disconnect', function () {

                console.log('\t socket.io:: client disconnected ' + client.userid );

            });

         

    });

    Is this your server-side code?

    I do a connection, then check if any data is available. If I receive an event named 'onconnection' I spit out the alert with Socket.LastData.

    This comes up as 'websocket' before another alert '[Object] [object]' which is the one I want.

    What is this 'websocket', why do we look one step back in time?

    I must be missing something here!

    Ok, you probably don't want to use the socket.LastData expression, it behaves really strange, and messes up the data... If you read the explanation of the Socket.LastData expression it says:

    (Get the last chunk of data that was received via the socket. (Warning: this exression actually manupalates the data stack, be careful when evaluating it in Construct)

    Meaning: Don't use it!

    What you want to do is:

    On Data ---> Split data received

        ---> Access your data with Socket.LastDataElement(index)

    The "Split data received" Action actually makes the Data.split(','); so it returns an array.

    If you don't want to split the data, and just access the last data recived do the

    On Data ---> Access your data with Socket.LastDataElement(0)

    This is actually the main reason why this plugin isn't the best it can be, it doesen't manipulates recived data on the best possible way.

    Reason for this is that this plugin was originally written by Zack0Wack0, then edited by Juantar, then by some other members, and lastly by me... I added some functionality to it, made it minifiable, but it actually needs an overhaul. A lot of stuff isn't coded the best it could be!

    I'm currently waiting for the socket.io 1.0 to become official, because it makes some serious changes to the Socket.io module and possibly a different API, so probably would be waste of time to overhaul it now!

    I hope i helped,

    Cheers!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also:

    line 1515: "ret.set_boolean(this.isPaused);"

    set_boolean is not defined, you'll have to find a workaround (maybe return 1 or 0 intead of boolean value)

  • Great plugin, thanks for sharing!

    I may have found a bug:

    Behavior version : 1.5.4.145

    Runtime.js, line 1505:

    Your code:

    "ret.set_text(this.target);"

    Proposed fix:           

    "ret.set_string(this.target);"

    Cheers!

  • My two cents:

    If TCP is good enough for World of Warcraft, should be good enough for HTML5 games.

    Socket.io is a good solution, but it has its own limitations. Current socket.io plugin for Construct isn't greatest but if you tweak it for your own needs, and respect the limitations of socket.io, it'll be good enough for most projects.

    If you really want UDP, currently your only hope is Node-webkit export and UDP / Datagram Sockets module from Node.js. But that's .exe, not HTML5.

    Without central server for game logic, there is no talk about some serious multiplayer game. I don't think we'll see some good solution for C2 multiplayer games with the "No programming required" premise any time soon.

    Cheers!

  • Try:

    1. Ctrl+N (to create a new project)

    Then scroll down to "Template: Infinite Jumping" and

    2. Click Open

    Voila!

    That template should give you a decent starting point for that kind of game,

    Cheers!

  • Great!

    Thnx for the plugin,

    Cheers!

  • Works for me when i export the project, click here

    You have some errors on the console:

    Failed to load resource: the server responded with a status of 403 (FORBIDDEN) dl.dropbox.com/s/bjt2h4wqiy80nxs/c2runtime.js[/b]

    Uncaught ReferenceError: cr_createRuntime is not defined index.html:107

    Application Cache Error event: Manifest fetch failed (403) dl.dropbox.com/s/bjt2h4wqiy80nxs/offline.appcache

    Uncaught ReferenceError: cr_setSuspended is not defined index.html:113

    Uncaught ReferenceError: cr_setSuspended is not defined index.html:115

    Uncaught ReferenceError: cr_setSuspended is not defined index.html:113

    Uncaught ReferenceError: cr_setSuspended is not defined index.html:115

    Try to re-upload the project to your public Dropbox folder.

  • Cool, sounds like a plan!

    Currently i don't need this plugin in my projects, so i won't be developing it further, but if i make a new version i plan to release it to the community!

    Cheers, and good luck with your game!

  • Yup, that's pretty much that!

    Just to repeat myself, i really made this plugin in a hurry, if you do some changes to it (and i hope you will! :) please share, so we can improve this plugin!

    Cheers!

  • Sorry, i haven't been clear!

    If you export with node-webkit, this gives you full access to the file system (e.g. the game can delete the contents of your drive if you die)

    If you use this plugin in the classic html5 export, it will probably break your game, or it won't do anything.

    For local or webstorage use the official plugins.

    Cheers!

JohnnySheffield's avatar

JohnnySheffield

Member since 31 Jul, 2012

Twitter
JohnnySheffield has 1 followers

Trophy Case

  • 12-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies