How I'm planning to fix lag

19tps for only 18 players

1 Like

As stated above, Yes i have noticed that, next I will work on optimizing the server.

3 Likes

much

1 Like

i havent gotten disconnected since u refreshed the server, and my ping went from 26k to like 40

2 Likes

I have been asking a lot of people, and no’one has been disconnected after the update. So that means the update is working!

3 Likes

For some reason the disconnecting bug still works for me after the update

Anyone else getting it still? None of the players I have seen in game got it

There is some slight botting going down bringing down the TPS but nothing too bad

2 Likes

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.

swordbattle.io updated protocol - Google Docs

I am working on this document, to contain the updated protocol. This is not perfect and be subject to change.

2 Likes

cool, im sure that will help the game greatly

2 Likes

Thank you!

1 Like

New skins will be coming out soon

2 Likes

New server!

I used to use Heroku as my server. While heroku was decent with performance, and inexpensive, it was really terrible with maintainence.

For example, it would restart once a day, and I would have no control over it.

It also made it really hard to update the game, I had to kick everyone out for it to update the game.

So I decided it’s finally time to get rid of it…

swordbattle.io now uses GCP (google cloud!)

now since this is a server from Google it’s way more reliable and lag free, I’m noticing improved TPS already.

(note: I have only switched the USA server, the Europe server is still running on heroku)

new problems…

Now switching to GCP comes with it’s own set of problems.

The main thing is schools

The advantage with heroku is that heroku gives out a free url for your app: *.herokuapp.com

This is not a huge deal but, I noticed that most players are using this heroku url to play, since the main OFFICIAL url (swordbattle.io) is being blocked by schools.

I have been testing without the heroku url and there are so many complaints of the game not working.

So I am leaving the heroku url to work for a few months, but the URL will still connect to the GCP server.

This will not last forever though, since it’s just an extra thing to maintain.

conclusion

While this update did improve the game, it caused issues for a lot more players.

Do let me know if I should switch back to heroku

For the time being, GCP is much more easier for me.

Thanks.

1 Like

Jdjidbbxh. I told u. To.do smtn like this for chests

2 Likes

U liie the post but dint do it…

Do something like what?

A nice organized post ezplaining chest spawns and coins/their rank based on their color. We went over this…

1 Like

well isnt it a bit late now lol

maybe there should be a wiki

1 Like

No bc i still dont knoww

1 Like