Optimized ogar project with WebGL rendering and native C++ parallelization.
Cytos: The best performant open source agar.io server & client combined in one project.
Specs | Result |
---|---|
Ryzen 7 5800x & 7900xtx, using 8 threads (bind to core) | Average 50% load with ~50,000 cells being rendered at 120 FPS |
Specs | Result |
---|---|
i5-8250U (Surface Pro 7), using 8 threads (bind to thread) | Still very much playable even though load jumps between 60% to 200% with ~15,000 cells being rendered at 40-60FPS |
There is NO networking at all in this project, but the concept of a server and client still exists:
cytos-addon.node
is loaded which has a native libuv loop integrated into the browser. It runs the physics solving and viewport querying at 25 TPS and a buffer is serialized and sent to the main page with self.postMessage
. The addon also contains a thread pool to accelerate calculations.gfx-addon.node
, is loaded to parse the buffer got from the worker/server and store the state; then during requestAnimationFrame
callback the module is called to generate the WebGL buffer.A lot of techniques are borrowed from my older project OgarX, but there are some in-depth native optimization that was not possible in pure JS:
All those changes brings about 3-4x single thread speedup and ~20x speedup with 8 threads.
Installer currently only available for Windows, but building for other platforms would be possible since electron
and cmake-js
are cross platform (see Developement section below)
Windows will show a warning popup because the installer not a signed binary.
Requirements:
npm i -g cmake-js
(or could be added as a dependency later...)git clone https://github.com/Yuu6883/Cytos.git
cd Cytos
./addon.sh
cd source-js
npm i
npm run build
cp ../build/Release/*.node build/
npm start
CTRL S
to save a server state into a buffer stored in IndexedDB and hit ALT X
to restore from it (per game mode)F1
to toggle the profiling panel.F4
for the ultimate easter egg: