Jump to content

Search the Community

Showing results for tags 'Nodjs'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

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 eureca.io and phaser (original topic available here http://www.html5gamedevs.com/topic/8296-tutorial-creating-a-basic-multiplayer-game-with-phaser-and-eurecaio/ We use eureca.io 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.io ? 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 eureca.io 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 eureca.io 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 : engine.io, 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 eureca.io use it for client/server communication (thank's to https://github.com/js-platform/node-webrtc) 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, eureca.io 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 : http://ezelia.com/2014/ubuntu-nodejs-varnish-monit-en Licence Eureca.io 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 eureca.io visit the website http://eureca.io/ or npm install eureca.ioDocumentation it's still not complete, but a big part is covered, http://eureca.io/doc/ There is also a lot of examples provided with the source code Source code https://github.com/Ezelia/eureca.io 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.
×
×
  • Create New...