Skip to content

๐Ÿš— ๐ŸŽ๏ธ ๐ŸŽฎ A browser-based isometric racing game built with a custom WebGL 1.x engine. Features real-time multiplayer with client-side prediction, spatial optimizations via quad trees, and AI opponents powered by neural networks trained through genetic algorithms.

License

Notifications You must be signed in to change notification settings

Mati365/micro-racing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

micro-racing

multiplayer 3D isometric racing game written in WebGL 2.x. Steering(both): WSAD / Arrows.

Gameplay

GIF
Screen
Screen 3
Screen 2

Todo

  • Improve client side prediction
  • Improve overall performance of server
  • Improve controls

Installation

Development mode (running at http://lvh.me:3000):

yarn install
yarn run develop

Production:

yarn install
yarn run build:production

Features

  • Client side prediction
  • High performance isometric engine using WebGL 2.x
  • Neural networks trained using evolution algorithms
  • Function precompilation in stuct-pack deserializers
  • Physics engine
  • Optimistic forms

Goals

  • Use monorepo, separated logic
  • Create tiny matrix math library
  • Create 3D isometric WebGL 2.0 functional wrapper(it should handle depth sorting and other stuff)
  • Car steering logic (using Marco Monster approach)
  • Procedural generated racetrack
  • Bots using Neural Network for AI(see neural-cars)
  • Multiplayer

Parts

Neural Network Implementation

forward propagation: https://github.com/Mati365/micro-racing/blob/master/src/packages/neural-network/src/unsafe/forwardPropagate.js

backward propagation: https://github.com/Mati365/micro-racing/blob/master/src/packages/neural-network/src/unsafe/backwardPropagate.js

evolution population train generation: https://github.com/Mati365/micro-racing/blob/master/src/packages/neural-network/src/genetic/forkPopulation.js#L70

ai car driver: https://github.com/Mati365/micro-racing/blob/master/src/network/shared/logic/drivers/neural/CarNeuralAI.js

ai cars trainer: https://github.com/Mati365/micro-racing/blob/master/src/network/shared/logic/drivers/neural/CarNeuralTrainer.js

cars intersection rays: https://github.com/Mati365/micro-racing/blob/master/src/network/shared/logic/drivers/neural/CarIntersectRays.js

Quad Tree

implementation: https://github.com/Mati365/micro-racing/blob/master/src/packages/quad-tree/src/index.js

Quad Tree handles multiple moving objects as list, stores only static objects

CSS in JS implementation

https://github.com/Mati365/micro-racing/tree/master/src/packages/fast-stylesheet

Bezier lines and de Castelja algorithm implementation

https://github.com/Mati365/micro-racing/blob/master/src/packages/beizer-lines/src/index.js

Car steering logic based on Marco Monster docs

https://github.com/Mati365/micro-racing/blob/master/src/network/shared/logic/physics/CarPhysicsBody.js#L43

Server update loop

https://github.com/Mati365/micro-racing/blob/master/src/network/server/RoomRacing.js#L148

See also

https://webcache.googleusercontent.com/search?q=cache%3A5cH3UfBvb2YJ%3Avodacek.zvb.cz%2Farchiv%2F681.html&hl=en&gl=us&strip=1&vwsrc=0&fbclid=IwAR2jxD6EayJZqvcOSNOBHgww35indUbC6pAeVA_3XtTCckCVeabjnbEuJvI
http://buildnewgames.com/real-time-multiplayer/
https://codea.io/talk/discussion/6648/port-of-marco-monsters-2d-car-physics-now-with-video
https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html
https://github.com/nadako/cars/blob/gh-pages/Car.hx
https://github.com/spacejack/carphysics2d/blob/master/marco/Cardemo.c
https://www.sevenson.com.au/actionscript/sat
http://www.dyn4j.org/2010/01/sat
HTML UI in AAA games:
https://www.gdcvault.com/play/1022055/How-to-Implement-AAA-Game

License

MIT

Resources

Icons: https://png.is/f/chatbot-robot-internet-bot-artificial-intelligence-icon-vector-robot/6051723894325248-201812161840.html https://icons8.com/icon/38824/meat https://www.kisscc0.com/clipart/u-turn-traffic-sign-turnaround-computer-icons-caut-y4h8ur/ https://dryicons.com/icon/zombie-brains-icon-11516 https://fontawesome.com/icons/car

Cars: https://opengameart.org/content/low-poly-cars https://free3d.com/3d-model/cartoon-low-poly-city-cars-pack-32084.html

Elements: https://free3d.com/3d-model/road-elements-40062.html

Map Elements: https://sketchfab.com/3d-models/muro-hormigon-981c60ea68ce4fcfa168d56ff8ee59ca by talekliaran

https://sketchfab.com/3d-models/cactus-low-poly-8027a1cceedb4d8189592f316b0c4704 by kaltyiontrish

About

๐Ÿš— ๐ŸŽ๏ธ ๐ŸŽฎ A browser-based isometric racing game built with a custom WebGL 1.x engine. Features real-time multiplayer with client-side prediction, spatial optimizations via quad trees, and AI opponents powered by neural networks trained through genetic algorithms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published