An online 2D space battler that I have been making for the last couple of weeks, transferring it from old developments and testing the possibility of implementing the network part in default, as well as those things that I have not written here yet. Game
Peculiarities:
a completely authoritarian server that does all the calculations (the server is now also on Defold)
real online (of course there are bots when there are few players)
box2d collision physics
seamless “endless” world
leaderboard
radar for convenience and beauty
ships, asteroids, bonuses
and many other small things…
PC control: (everything is obvious from the phone)
right button (hold) - flight acceleration
left - shots
The metrics at the top are frame rate, number of incoming data per second and ping from the server.
Some technical details:
The server is located in Poland, written in Bun.
Interpolation is fixed - 150ms, if the ping is higher than this number, then the game will be uncomfortable (dynamic adjustment is disabled).
“Bun is a JavaScript runtime, package manager, test runner and bundler built from scratch using the Zig programming language. It was designed by Jarred Sumner as a drop-in replacement for Node.js. Bun uses WebKit’s JavaScriptCore as the JavaScript engine, unlike Node.js and Deno, which both use V8.”
Yes, I wrote the server on it.
Since I write all the code in Defold in TypeScript (https://ts-defold.dev/), and the Bun environment supports this language by default, it is quite convenient for me to write a server and compare the work of these 2 options.
And I want to share my conclusions, but they are not clear-cut.
First of all it works
Pros of Defold:
small amount of RAM memory consumption (about 8 times compared to bun)
one code base when writing
you can flexibly adjust the frequency of operation so that the server does not load the system and select the desired tickrate, but this is also the main problem.
Minuses:
requires a build (not the worst thing)
after all, in all tests (real-time game), the load is sometimes a little higher (~3-10%), but my test is not the most reliable in the sense that it strongly depends on the game and the implementation of the network part (binary data, serialization in C ++, we spend time on calls). On the contrary, Defold won some tests, for example, only physics simulation with a large number of objects compared to the same test in bun.