The objective of this is to create the easiest to use js netcode solution, even if it may not perform the best. Note: this sucks and is incomplete
Features:
- State tree, put all of the app state you want to share in JoNetInstance.state.world when a client connects, they get the full tree.
- State updates, at a set interval every client receives all the changes in state since the last state update.
- Binary messaging, uses webpack to serialize and deserialize state for smaller messages and faster encode / decode than json.
- Serverside Keyboard, the server has the state of each client's keyboard, so it can process their inputs.
- Code sharing, Write the game logic once for the server and clientside simulations... in theory.
- Install dependencies with
npm install
, and start withnode main.js
- everything in the client folder is served.
- Both the server and client use stuff in the shared folder
- The idea is you should just make your own extension of JoNetInstance.js see JoNetInstanceTest.js as an example.
- Classes are not serialzed, only the data will be intact, so if you want to use OOP, make all of your class methods static and use the hierarchy of the state tree to infer classes (see Vehicle in JoNetInstanceTest.js for example)
##todo
- Serverside Mouse
- Re enable state prediction, it is off currently because it without interpolation, clients with any lag will rubber band a lot.
- Actually make a game using this to see if it is any good.
- Maybe extend the syncing to allow some objects to use client side prediction, while others dont.
- Add a simple event system
- Re enable user input broadcasts (currently disabled because we are not doing client side prediction anyway)
- Use WebRTC instead of socket.io
- Add P2P networking using WebRTC
- Serverside input manager to replace mouse + keyboard system and support gamepads