Yet-another Multiplayer Demo (with capx)

  • Hello ! (My first post <img src="smileys/smiley4.gif" border="0" align="middle" />)

    Thanks you very much for the demo.

    I have one question regarding the usage of the demo, I can use it without problem locally,but I can't launch the game from the web browser he didn't work. The game is only working if I launch it from Construct2.

    Does somebody know why ? ( I have already try to uncheck minify)

    I get this error if I check with chrome :

    Uncaught ReferenceError: log is not defined

    Thanks in advance for any help !

    Regards

  • Shiva : are you opening the web page by double clicking on it? that might not work, it has to be hosted in some kind of webserver. It works in debug mode in C2 because C2 uses a local webserver (localhost:5000) to host the game.

    Thank you for using the plugin!

  • Hi !,

    I have open the webpage by the url where I have upload it.

    What's strange is that the error that the function log is not defined is strange because there's other log usage before the error and they don't produce this error.

    I have tried to restart all from scratch and now I could not more open your capx after install the update R84.

    My goal was testing the usage in a website without construct 2. Because everything is working correctly from construct preview. I have manage to use my webserver at home to proxypass the connection in apache like this :

    player1 -> webserver.com -> webservereke@home -> webserver.com -> player2

    I have tried this because I could not launch node.js from my website hosting service.

    :)

  • good job this sample open my mind about possibilities html5 multiplayer game, but there is annoying bug in your code sample.. new player which just login can't see old player, but old player can see new player joined after him. can you tell me the problem or maybe you can fix the code and let me see it.

    Regards

  • istanto did you get this error with the new version? I saw that problem and I though I fixed it in the latest release. It was a problem with the code in the example_server.js file (I was not using the broadcast method in the socket).

    Shiva I have not tried R84 with the plugin yet, I will give it a spin.

  • istanto did you get this error with the new version? I saw that problem and I though I fixed it in the latest release. It was a problem with the code in the example_server.js file (I was not using the broadcast method in the socket).

    Yes this error on your new version package, I download socket-io-mod.zip today from sites.google.com/site/jptarqu/downloads to learn the code inside it. I believe nothing wrong inside your code, it's not out from my logic.. if I'm not wrong socket.broadcast.emit mean packet sent to global except the sender, but it's strange.. why only old player can see new player.. any enlightenment will really help me, I need to fix this bug to start something very soon.

    Regards <img src="smileys/smiley12.gif" border="0" align="middle" />

  • istanto : It was a silly mistake, I was calling the my splice function with the wrong index in the plugin code *facepalm*. I tested it in my machine and it works. I put a new version out there, please download this latest version and let me know if it works for you.

  • istanto : It was a silly mistake, I was calling the my splice function with the wrong index in the plugin code *facepalm*. I tested it in my machine and it works. I put a new version out there, please download this latest version and let me know if it works for you.

    still not works... new player can't see old player, old player can see new player. I try on chrome, firefox and opera <img src="smileys/smiley19.gif" border="0" align="middle">

    regards   <img src="smileys/smiley12.gif" border="0" align="middle">

  • istanto can you please open in notepad the following file in your construct2 folder:

    exporters\html5\plugins\socket-io\runtime.js

    At the end of the file there should be function called get_last_data at around line 179, can you please copy and paste those lines or take a screenshot of them?

    Thanks!

  • istanto can you please open in notepad the following file in your construct2 folder:

    exporters\html5\plugins\socket-io\runtime.js

    At the end of the file there should be function called get_last_data at around line 179, can you please copy and paste those lines or take a screenshot of them?

    Thanks!

         function get_last_data(dataStack)

         {

              var dataLength = dataStack.length;

              

              var data = "";

              if (dataLength > 0) {

                  data = dataStack[0];

                  jpt_splice(dataStack, 1);

              }

              return data;

         }

    regards <img src="smileys/smiley12.gif" border="0" align="middle" />

  • istanto i think you still have the old version because the line that says

    jpt_splice(dataStack, 1);

    Uses a zero instead of a one in the new version, so it looks like this:

    jpt_splice(dataStack, 0);

    thanks

  • Great job! I had been trying to do this through Construct for a while but got busy with work and gave up. This is a perfect tutorial and jumping off point to see how to work with node.js and socket.io within construct!

    Thanks for releasing this!

  • istanto i think you still have the old version because the line that says

    jpt_splice(dataStack, 1);

    Uses a zero instead of a one in the new version, so it looks like this:

    jpt_splice(dataStack, 0);

    thanks

    I got it work juantar <img src="smileys/smiley9.gif" border="0" align="middle" /> the problem is i'm not install socket.io on "c:\node_modules" and my browser is not updated. Thank you for your help GBU.

    regards <img src="smileys/smiley12.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wrote a new post in my blog on how the multiplayer demo works in Construct2:

    http://jptarqu.blogspot.com/2012/04/how-to-create-online-multiplayer-html5.html

    I also uploaded a new video showing an iPad connecting to the game:

    Subscribe to Construct videos now
  • I wrote a new post in my blog on how the multiplayer demo works in Construct2:

    http://jptarqu.blogspot.com/2012/04/how-to-create-online-multiplayer-html5.html

    I also uploaded a new video showing an iPad connecting to the game:

    Subscribe to Construct videos now

    Awesome, thanks for sharing!

    I wonder about Node.js, i doubt how to install node.js on shared web hosting

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)