endel

Members
  • Content count

    36
  • Joined

  • Last visited

About endel

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    http://endel.me
  • Twitter
    https://twitter.com/endel

Profile Information

  • Gender
    Male
  • Location
    Hamburg, Germany

Recent Profile Visitors

810 profile views
  1. Hi @Arcanorum, There are two 2d physics libraries I can think of. You can include both of them on Node.js, and also run in the client, if necessary: P2: https://github.com/schteppe/p2.js MatterJS: https://github.com/liabru/matter-js I believe you can simulate only the physics in the server (movements, collisions, etc), not including the whole engine (Phaser) in it. Cheers!
  2. @iiceman hey! alright. I see you're using your client's data and trying to replicate it to all clients. Depending on the kind of game you're making, this could be fine - it's very likely, though, that all clients will be seeing a completely different state of the game. Ideally, you should only send the action the clients are trying to perform to the server, validate and then process them on the server. For position update, the clients should send the command "move forward", for example. And then the server calculates it based on the data it already has, and updates the room state. When the room state is changed, the changes will be broadcasted to all clients - and only then the entity will actually move. In authoritative server implementations like this, it's important to never trust the client. Most of the game loop will be implemented on the server (movements, collisions, actions, etc), even though some of them can be present in the client as well as some sort of prediction when it's necessary. The clients are usually just a dumb representation of the data coming from the server. Hope this helps, and please let me know if you have any questions regarding the usage of Colyseus Cheers and happy holidays!
  3. @iiceman hey! this issue has been reported already, you just need to set NPM_CONFIG_PRODUCTION environment variable to false on Heroku. EDIT: If you want to try out the client v0.6.0 alpha, I've recently added a new feature that simplifies listening to changes coming from the server: https://github.com/gamestdio/colyseus.js#listening-to-room-state-change The boilerplate is using v0.5.x that doesn't have it. @Raggar about client prediction, it very much depends on the experience you want your players to have. Sometimes, simply interpolating values in the client is enough. wilds.io just interpolate player's positions, for example. Getting slightly out of sync is not really a big deal when it doesn't influence the gameplay directly. If every player is kinda delayed, nobody will ever be ahead in time. For really fast objects then it might make sense to apply some sort of client-side prediction. So I'd recommend evaluating the kind of objects you have, and which ones really makes sense to apply prediction or not. Cheers!
  4. Hey @Nicolai, I'm using Colyseus for my prototypes. It was designed to be really easy to integrate server and client. JavaScript client: https://github.com/gamestdio/colyseus.js Server: https://github.com/gamestdio/colyseus I'm currently working on a multiplayer racing game that I plan to release by mid of next year. I'd be glad to support you with yours if you have any question. The beauty is that you can code both client and server using TypeScript, which is quite handy. Cheers!
  5. Hi. Your boilerplate has inspired me to have a go at a multiplayer game. My experience so far is only with static sites.  I have forked the boilerplate repo and cloned it locally. Having made some changes to reflect the name of my game I pushed it to my github here https://github.com/dragonmaths/nine-clone-morris

    Following the instructions here https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction

    I have successfully got to the stage of creating the app but on trying to push it I got a load of error messages after this point.

    remote:        sh: 1: tsc: not found
    

    Prior to all this I had tried cloning the boilerplate and using the deploy button but the deployment never finished. I also tried the steps on the the original clone and got the same error message.

    When and if you get the time perhaps you could give me a suggestion where I'm going wrong.

    My node is 3.9.2 and npm 3.10.9.

    Should you need any further information please let me know.

    Thanks in advance

    John

    1. endel

      endel

      Hi John, that's great :)

      Brian had the same issue recently: https://github.com/endel/babylonjs-multiplayer-boilerplate/issues/1

      You can also set the "NPM_CONFIG_PRODUCTION" environment variable to "false" through Heroku's administration panel.

      Don't hesitate to open issues on GitHub if you have any issues.

      Good luck in your game! :)

      Cheers!

    2. JohnK

      JohnK

      Thanks for the information, next time I have a problem I will check the issues first. Soory not to get back to you sooner but when I set the

      "NPM_CONFIG_PRODUCTION" environment variable to "false"  I came up with a timeout problem (I am dragonmaths) and didn't want to reply and say all is well and neither did I want to mention the problem here as I had found out about using issues on github and so wanted to use that.

      Anyway all my issues so far you have resolved and I appreciate both the boilerplate you have contributed and the help you have given to me and others .

      I expect I will come across new problems as I further learn about multi-user sites and heroku.

      Once again thank you for your help

    3. endel

      endel

      You're welcome! <3 Good luck with your game! Don't hesitate if you need help regarding multiplayer. I'm currently working on some updates for Colyseus. I hope to release them by the end of December. Cheers!

  6. Hi @inteja. Oops, that was my mistake. The fix is quite simple, though. I've updated the project already. You can pull with git or update your local version manually. I couldn't test it on Windows, but it should work fine. Please feel free to open issues on GitHub if something goes wrong, I'd be happy to support you. Cheers!
  7. Hey guys, I've created a template project using BabylonJS + Colyseus, and made it available here: https://github.com/endel/babylonjs-multiplayer-boilerplate There's a button to deploy your own in the README. Here's the live demo: https://babylonjs-multiplayer.herokuapp.com/ It's basically a simple BabylonJS example from the website, connecting to a Room on Colyseus. If you open the developer tools you'll see a new log appearing for each user visiting the page. Feel free to ask if you have any question and good luck with your games
  8. Sure, I'll do my best. I'll create a boilerplate integrating both libraries and hopefully post it here tonight
  9. That's great news. Would be a great opportunity to test out Colyseus for multi-player communication, if you haven't already. The project has been completely rewritten in TypeScript recently. Feel free to post questions on GitHub and Gitter if you struggle with something.
  10. Awesome. Thanks for sharing your experience I'm making an open-source game server called Colyseus (https://github.com/gamestdio/colyseus), which by now I only used for some prototypes in game jams, and extrapolating data is exactly what I'm trying to achieve right now. I'm trying not to over-engineer but applying lag compensation techniques can be kinda messy. Hope your game become a huge thing!
  11. That's amazing. Did you made everything by yourself? Great work! Smart move to separate the sprite sheet of the legs and arms to allow rotating them separately. What was your biggest challenge on making it multiplayer? Keep it up!
  12. Hi there! For those who are interested in making multiplayer games, I'm trying to create some simple ones to demonstrate how to use Colyseus as your game server. Here's the first one: https://tictactoe-colyseus.herokuapp.com (mobile friendly) Source-code: https://github.com/endel/tic-tac-toe Thanks for checking out!
  13. Taking three.js as an example: they have a plain "userData" object on every Object3D. Using pixi.js you could do the same thing on DisplayObject's.
  14. I'd like to announce a tool that helps you to build multiplayer games in JavaScript. Colyseus is a JavaScript server (for Node) and client (for the browser) It handles WebSocket connections, has multiple room support, handles room state synchronisation and allows clients to create, join and leave rooms. Here's an overview of how it works: Match-making cycle: - User asks to connect in a specific room, with optional "join" arguments. // (client-side)var Colyseus = new Colyseus("ws://localhost:3553");var battleRoom = colyseus.join('battle', {options: 'here'}) - Server will loop through all spawned room handlers named 'battle' and call requestJoin method against that handler. // (server-side)// only accept new users if limit isn't reachedrequestJoin (options) { return ( this.clients.length < 12 )} - If requestJoin succeeds, a method named onJoin will be called with the client reference and client options given. // (server-side)onJoin (client, options) { // setup new player here}- If requestJoin fails on every available room, a new handler will be spawned if requestJoin succeeds in a fresh handler state. In case it fails again, an 'error' event will be dispatched on client room instance. // (client-side)battleRoom.on('error', function(message) { console.log("error triggered on battle room:", message)})Room state handling: Once the player received the room state upon it's connection, he only needs to receive the state difference on later broadcasts, called patches. By default, room handlers will deliver the patched room state to all clients each 50ms. // (client-side)battleRoom.on('update', function(newState, patches) { console.log(patches) // array of patches console.log(newState) // newState with patches applied})The array of patches usually look like this: (JSON-Patch format) [ { "op": "remove", "path": "/players/2" }, { "op": "add", "path": "/players/3", "value": {"x": 10, "y": 10} }, { "op": "replace", "path": "/players/1/x", "value": 5 }]// JSON-Patch Spec - RFC6902You can take a look at patch handling on tanx project to see how it looks like. Here's some prototypes using Colyseus as a game server: - PlayCanvas tanx fork (original game is here) - Redneck River Race (made in 72h for LD34) - CubeClub Soccer Colyseus's code base is quite straightforward, which is good for it's growth as a library, I believe. It doesn't do much, but it tries to do really well what is meant to. Thanks for reading until here, and feel free to ask anything here or on gitter chat channel. Cheers and happy new year!
  15. Hi there! There's a major new update on the game, it would be nice if you guys could check it out: http://cubeclub.gamestd.io I've learned a few things with the first version that I'd like to share here. In the first version, all the game logic was being computed by the clients, the server just trusted whatever messages the clients were sending. It seems easier to develop all the logic by the client but it's quite obvious that it's not a good decision. It can be really painful to ensure that all clients are seeing the same game state and eventually it just will not happen, causing strange behaviour in some clients. Now that all the communication was rewritten the clients are now just sending inputs such as movements and kick/tackle events, which the server validates and then broadcasts to all connected clients. Only the server will handle the game state and broadcast a patch state (JSON Patch - RFC6902) to all clients. I really liked this "patch state" approach, which removes the necessity of triggering different kind of messages (e.g. new player entered, player leaved, etc). If a new player enters in the room, the clients will receive it as an arbitrary state update instead of a message with a particular identifier. I'm releasing a handy library to create game server rooms and matches, called Colyseus. As your game probably will have time-based events (interval/timeouts) there's another handy tool for it: clock-timer.js I expect to write more about this subject as I make progress. Cheers!