Search the Community

Showing results for tags 'Nodjs'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 1 result

  1. Hello community, I was amazed by the number of positive feedbacks and forks of my tutorial about creating multiplayer game using and phaser (original topic available here We use for about two years in internal and client projects, but since now it only supported XHR and websockets which are more than enought for many multiplayer cases, but now that webrtc is becoming more and more popular, I decided to include it in the new release. So what's ? eureca is a bidirectional RPC library designed with simplicity in mind. and there is nothing better than some code examples to illustrate how simple it is This is an eureca server exposing a echo() function var eurecaServer = new Eureca.Server();eurecaServer.exports.echo = function (msg) { console.log(msg);}And this is an client calling the server var eurecaClient = new Eureca.Client({uri:'ws://localhost:8080'});eurecaClient.ready(function (serverProxy) { //echo() function is executed in the server serverProxy.echo('hello from client');});The client can also expose a function eurecaClient.exports.alert = function(msg) { alert(msg)}And server can send an alert to the client when the client connect or when the client call echo eurecaServer.onConnect(socket) { var client = socket.clientProxy; client.alert('Alert from server : I see you just connected');}//now we modify the initial echo functioneurecaServer.exports.echo = function (msg) { console.log(msg); var client = this.clientProxy; client.alert('Alert from server : I see you just called echo()');}Now suppose the server expose a function which return a result eurecaServer.exports.add = function (a, { return a + b;}Here is how you call and get back the result in the client side eurecaClient.ready(function (serverProxy) { serverProxy.add(5, 10).onReady(function(result) { console.log('5 + 10 = ', result); })});those are only some examples of features. Other cool features - Easy authentication : prevent client from calling server without being authentified with a custom server side function you define - Integrates with expressjs - Supports all those transport layers :, sockjs, raw websockets, Faye, Browserchannel and WebRTC! - Seamless return results + easy way to return from nested calls - Completely free and Open source A note about WebRTC is mainly designed for peer to peer communication, but use it for client/server communication (thank's to unlike websocket, WebRTC can be used as reliable or unreliable transport layer and this make HUGE difference in multiplayer game developement, because unreliable protocoles are very fast, and in many cases, losing some packets is not problematic for multiplayer games. In the present version there is a limitation, WebRTC server cannot be used on windows (because tha package we rely in do not support windows yet). Browser side is also limitted to the browsers supporting WebRTC : Firefox, Chrome and Opera (IE do not support WebRTC yet) So how can I write a game server if my developpement environnement is on Windows ? Easy, transport switching is transparent to the developper, you only change one configuration parameter in the client and server side. so you can write your code with any supported transport layer on windows, and switch to WebRTC for production. let's take the multiplayer thanks tutorial code, and change it so it support webrtc 1 - Edit server.js Replace this code var eurecaServer = new EurecaServer({allow:['setId', 'spawnEnemy', 'kill', 'updateState']});With this one var eurecaServer = new EurecaServer({transport:'webrtc', allow:['setId', 'spawnEnemy', 'kill', 'updateState']});2 - Edit ./js/tanks.js Replace this code var eurecaClient = new Eureca.Client();with this one for reliable WebRTC var eurecaClient = new Eureca.Client({transport:'webrtc'});or this one for unreliable WebRTC var eurecaClient = new Eureca.Client({transport:'webrtc', reliable:false, ordered:true, maxRetransmits:1});//you can tweek parameters as you wish3 - Done ! Want to build a production environement for your multiplayer game using nodejs ? here is a tutorial about how to build a self monitored nodejs server : Licence is under MIT license, this is one of the less restrictive open source licenses, so use it as you wish . Fork it modify it, contribute use it in your free or commercial project, there is no restriction as long as you respect the MIT license. Get visit the website or npm install eureca.ioDocumentation it's still not complete, but a big part is covered, There is also a lot of examples provided with the source code Source code I'm still working on the documentation of this new release, but I'll try to make a new multiplayer game tutorial using WebRTC as soon as I find some spare time. Hope this will help community to build amazing HTML5 multiplayer games Comments and suggestions are welcome.