nutmix's Recent Forum Activity

  • Hi Rex.

    I have tried both the official websocket and Zacks socketio plugin, and neither work (neither try and make any connection, nor send any data, nor repsond to any message).

    Do you have a general purpose socket.io plugin which you use? I looked at your list of plugins, and you only seem to have lobby, bottleneck and chat plugins, not one I can use.

    I have a very simple test node.js app:

    var io = require("socket.io").listen(8080);

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

        console.log("connected");

        socket.emit('balls', { ball:42 });

        socket.on('daub', function (data) {

          console.log(data);

        });

    });

    And if I hit it with a simple js page:

    <html>

    <head>

    </head>

    <body>

    <script src="socket-io/socket.io.js"></script>

    <script>

    var socket = io.connect('http://localhost:8080');

    socket.on('balls', function (data) {

        console.log(data);

        socket.emit('daub', { my: 'data' });

    });

    </script>

    </body>

    </html>

    It works perfectly. But i have yet to find any socketio or web socket plugin which will work (or even connect), e.g. this doesnt:

    System=>On start of layout: Socket - Connect to "ws://localhost" (set to 8080 in dialogue)

    does not make, or attempt to make, any connection to node server.

  • I have spent days trying to get this plugin (and the official web socket plugin) working, but they do nothing.

    I tried the echo test project, does nothing but create a blank page.

    I.e. something is seriously not working.

    Also, neither work at all with node.js.

    I am running node.js with socket.io on port 8080, using this very simple app:

    var io = require("socket.io").listen(8080);

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

        console.log("connected");

        socket.emit('balls', { ball:42 });

        socket.on('daub', function (data) {

          console.log(data);

        });

    });

    If I just write a dumb HTML page, it works perfectly:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    </head>

    <body>

    <script src="socket-io/socket.io.js"></script>

    <script>

    var socket = io.connect('http://localhost:8080');

    socket.on('balls', function (data) {

        console.log(data);

        socket.emit('daub', { my: 'data' });

    });

    </script>

    </body>

    </html>

    I get 42 logged in the console

    I have tried various plugins, (there are lot of versions floating round), none of them work at all, no error, nothing in console, no error events, no events what so ever.

    E.g. this 3 line socket.io plugin app doesn't do anything:

    <img src="https://www.dropbox.com/s/zh8dmd6ylxstkm0/sio.PNG" border="0" />

    Nor does this one using the official plugin:

    <img src="https://www.dropbox.com/s/mkommxixt23e1l2/WSProj.PNG" border="0" />

    I am trying on the latest chrome and FF. Neither work. using the developerconsole/firebug, they show no socket connections being made. Ill try using wireshark, but the impression I get is that the "connect to" method is simply not making any connection attempt.

    I have also tried exporting the projects as html5 sites, and running them from there. no joy.

  • I have a tiny test app running on node.js with socket.io installed:

    var io = require("socket.io").listen(8080);

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

        console.log("connected");

        socket.emit('balls', { ball:42 });

        socket.on('daub', function (data) {

          console.log(data);

        });

    });

    As you can see, it sends one message, and logs when it receives one.

    I know its all working as when I try this test js outside of C2, it works:

    <html>

    <head>

    </head>

    <body>

    <script src="socket-io/socket.io.js"></script>

    <script>

    var socket = io.connect('http://localhost:8080');

    socket.on('balls', function (data) {

        console.log(data);

        socket.emit('daub', { my: 'data' });

    });

    </script>

    </body>

    </html>

    Using the official C2 web sockets plugin, nothing happens.

    Using Zacks socket.io plugin: scirra.com/forum/plugin-zack0wack0s-socketio-mod_topic56503.html

    Nothing happens.

    My capx simply says:

    system->On load complete=WebSocket connect to "ws://localhost:8080" (required protocol "").

    It never connects to the server. no errors no nothing.

    WebSocket->On message is never fired.

    WebSocket->On connection error is never fired.

    WebSocket->On connection opened is never fired.

    The same using the Socket object provided by Zacks plugin, it does nothing. i.e.

    system->On load complete=Socket Connect to "ws://localhost" (port 8080 specified in the dialogue) never connects. It also never calls any events, such as On Connect or on error.

    They are both just "dead". But I know the server side is working fine.

    any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ive just realised that the official one doesnt have the fallbacks that socket.io has. i.e. socket.io will work with IE8&9 (i.e. work with people stuck with XP) via its flash socket fallback.

    Also, I cant get the oficial web socket plugin to work with socket.io running on node.js.   I can write a js page which works with it, but cant get C2 to work with it. It never connects, no errors, nothing gets sent or received.

  • Wow, thats great. I cant open the capx in the socket.io tutorial which requires the unofficial one (https://www.scirra.com/tutorials/571/modded-socketio/page-1) anyway, so perhaps Ill just go it alone with the official plugin.

  • Hi, there seem to be two plugins developed for socket.io:

    JohnnySheffilds: scirra.com/forum/plugin-zack0wack0s-socketio-mod_topic56503.html

    Zacks: scirra.com/forum/plugin-zack0wack0s-construct-2-plugins_topic43422.html

    Anyone know what the difference is between them, and which one is best to use to use web sockets to node.js?

  • I would like to ask if anyone has any kind of Bingo project they would be willing to share, to help a beginner start a bingo demo.

    Whats the best forum to ask for this kind of help?

    Many thanks!

  • Construct 2 is good at the core game canvas, but not so good at lobbies, login sessions, info screens, help screens etc.

    What I am wondering is this:

    1. Is it possible to "call" a URL/HTML Page from within the game, such that on that page, if they hit a "return to game" type HTML5 button, they can get back to the game (ideally the game will pause, but I guess that's not possible)

    2. If you imaging a lobby of game rooms, showing the number of players etc, I would do this using a server driven HTML5 page. I would then want to be able to click on a page, and launch the game. When the game is finished, it should go back to that page.

    Is there any way to do this kind of stuff?

  • I would like to whip up a quick bingo demo, to see how feasible it would be. The idea is to eventually hook it up using web sockets or socket.io to a server sending out the balls etc.

    Does anyone have bingo type demo of any sort by any chance that they might want to share? The biggest issues will probably be scaling an moving items around to fit the multitude of mobile devices (HTML5 only - apps are not wanted, unfortunately).

    If the company likes the game client (the server is the easy part), there may be work=money in it!

  • One of the main reasons I stopped using the otherwise excellent C2 because I could not reuse code between lots of similar games.

    Having tried stencyl, they achieve something like this by putting the code (using their drag and drop code editor) into a new behavior, then you can save this behavior (and its code) for use in other projects. I have not looked at how they handle the behavior codes interface, i.e. if you can instantiate he behavior (and its code) with parameters, make calls to sub functions/methods etc.

    Is this possible in C2? I cant see a way of creating a new behavior (or other object) which has code behind it, but can be exported. I had no luck trying to export/import event sheets, even if all the dependent objects were duplicated in the new project.

    Another main reason for not using C2 is that you cant fire your own events. Stencyl has this feature (I am informed by my team).

    The final reason for not using C2 is that creating dialogues, settings editing page etc. is a lot of work (for HTML5 mobile browser target at least) requiring all clickable objects to monitor some very hairy state code which got too complex to maintain. Stencyl allows you to set a layer to be active and layers below inactive, so the sprites in the layers below don't get click events.   I know in C2 you can put events in a group and disable groups, but this doesnt work for our complex games with a lot of sprite buttons on a lot of different layers/event sheets (required for a casino game).

    As an aside, Haxe seems a great language - dont know if its been considered for C2.

    I still prefer C2, if only it could offer "enterprise" features (i.e. code reuse, fire your own events, dialogue handling etc). Adding functions was a big step towards this.

  • I was struggling with the same issue for mobile. I was thinking of loading the background dynamically, and storing a ton of sizes and aspect rations on the server as images. If there is not an exact fit, I would either get a larger one and crop or scale down, or smaller and up.

    However, what I found was that although my game only displayed a few sprites at a time, there were so many outside the game (as you need to have sprites for every thing which can be touched or moved). The core game was fast, but when I added all the dumb info screens and their backgrounds, buttons, settings and all the stuff you need to put round the game, it was too slow and the code unattainable so abandoned the project even though the games themselves were complete (it was a suite of slot machines for real money for an existing online casino).

    However, I'm keeping my eye on construct 2's progress, hoping that one day it will have more support for native html 5 mobile, e.g. the ability to swipe in a settings form and a better solution for multiple screen sizes/ratios without black letterbox bars (which is currently possible, but extremely difficult when you add swipe navigation). When It does, the world we be at our feet.

  • Thanks for the replies. By Dialogues, I meant dialogue boxes for things like settings, info, rules, help etc.

    To implement swipe, you have to track x & y mouse coords, and have thresholds for dx dy etc. however, if they start/end the swipe over a button, then you get an unwanted button event also. Unless you manage all button type events yourself, which is pure pain.

    Other libs I have used have allowed more interaction with the surrounding OS, which for mobile would be the html5/css outside the canvas. I could not find a way to use this (e.g. use CSS transforms to swipe in info pages outside of the canvas, which was not designed to do this).

nutmix's avatar

nutmix

Member since 16 Aug, 2012

None one is following nutmix yet!

Trophy Case

  • 12-Year Club

Progress

12/44
How to earn trophies