How is physics implemented in multiplayer threejs games?
Hi all, I'm pursuing a side project with the belief that basic implementations of some old-school games (eg. halo 1, fifa 2001, Mario kart) would be relatively easy to implement given that 20 years have passed since they were first released.
Do you believe that Halo 1 multiplayer would be significantly easier to implement today than it was in 2001? To the point of being easyish?
I have a basic fps implemented in threes using simple custom collision detection on the client with a dead simple websocket server to sync up clients, and want to make the jump to something more powerful. I previously made a post here asking how server-side physics were implemented for a multiplayer game and was surprised to learn that server-side physics isn't the de facto approach -- so I'm taking one step back to ask in general how physics in multiplayer games are implemented.
First person shooter physics involved:
- FPV guns + ray casting and projectiles
- basic car physics
- grenades (basic projectile and explosion physics)
- flight / airplane
- player can run around a map (built in blender + imported as GLTF)
Sports game physics
- rocket league is a good example of the basic physics that I have in mind.
Racing game physics / mariokart:
- cars driving on map
- car collisions
- simple weapons
Am I correct in believing that the main problems to solve are:
-
Collision detection between a player and the map, with mechanics for walking, running, and jumping
-
Implementing the above physics mechanics on the client (threejs -- maybe with ammo.js)
-
Sending position / rotation updates between clients. Either P2P or via websocket server. Maybe optimizations with bitpacking
-
Maybe robust physics on the server for certain major events
-
Network latency. Is network latency the main, always-difficult problem in multiplayer games?
Aiming for 30fps
Posted Apr 1, 2023, 6:58 PM UTC