Giter Site home page Giter Site logo

chainpioneer1 / multiplayer-babylon-js-game Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aeon0/multiplayer-babylon-js-game

0.0 0.0 0.0 135 KB

Multiplayer BabylonJS game with Server and Client-Side physics engine synchronization

Home Page: http://185.82.21.82:8700

License: MIT License

JavaScript 1.90% TypeScript 92.37% CSS 1.85% HTML 3.88%

multiplayer-babylon-js-game's Introduction

Multiplayer Babylon JS "Game" with Client & Server-Side Physics Engine

alt text

You can open the Demo in two different browser tabs, that way you spawn two different players into the world
Demo here: http://185.82.21.82:8700

Run Localy

>> cd client
>> npm install
>> tsc
>> npm start

In a new console:

>> cd server
>> npm install
>> tsc
>> npm start

Then visit http://localhost:8700.

Development

If you want to play around with the code you can run >> npm run dev. (nodemon must be installed globaly). This will watch any chances for the typescript files, recompiles and on the server side, also restarts the server to serve the changes.

What is this?

Testing the server side "NullEngine()" from Babylon.js. This enables you to run Babylon.js on a node server without having to render anything to the screen. That means you can simulate the world on your Clients as well as on the Server.

This implementation uses Websockets for Client <-> Server communication. The physics engine is simulating on Client as well on the Server. The Server then sends each render loop updates to all clients about the current "State of the World". The Clients then adjust the World according to the Server updates. That means, the higher the delay, the more visible "jumps" can occur. Interpolation could smooth out this jumps, but is currently not implemented.

The "game"

Granted, it is not really a game. It is just an "arena" where each player controls a ball. By pressing W or D you can give the ball a spin forward or backward into the camera direction.
With A and D you can rotate the camera around the ball to apply the spin from different directions. With SPACE you can jump (only working on the ground as it is hacked in...)
The plan was (or is) that you would have to try to push your opponents of the arena, but this is not implemented yet. Right now you just fall forever and have to reload the page (That is why there are walls around the arena for now : ).

multiplayer-babylon-js-game's People

Contributors

aeon0 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.