The next optimization…
Alright it’s been a while so it’s time for the next optimization.
This time I’m taking on something a bit more hard, probably the hardest one on here.
Protocol Rewrite
So basically swordbattle has a protocol, a protocol is kind of a language on which the server and your computer talks. So that if you press a button, the server knows and it updates everyone else’s game.
Now I’ve noticed that the swordbattle protocol is very inefficient.
For example:
-
It sends a lot of unneeded data about each player every frame. We only need to know a player’s name once. We can use the player’s id to link it to a player. But the current protocol sends a players name 30 TIMES A SECOND (or whatever the TPS is)
-
It sends it super fast. The current default TPS is 30. This is very high and most modern games use at max 20 TPS. I’ve experimented with lower TPS but if I go down from 30 it starts losing smoothness. So the protocol needs to be optimized to allow for lower TPS and smoother gameplay…
The new update aims to fix all this by entirely re-writing and redesigning the protocol from the ground up. This will also include a lot of rewritten code in the client and the server, so they can still understand each other optimally.
This may take a lot of time, since this is prone to many small bugs, and rewriting messy code is always a pain, but when this is finished, I do believe lag will be MUCH better if not completely gone.
Again please be patient I do this game for fun, not for profit. I won’t be adding many new features during this period, maybe some new skins ( @ManagePasswords ), and some small improvements but nothing big.
Thanks.