How I'm planning to fix lag

then you make it

use this: https://github.com/codergautam/swordbattle.io/blob/main/classes/Chest.js

1 Like

Single laziest person thtss actually ddone smtn smhw tht ive ever met

Uh anyone else have high ping on USA.

I mean you are not in the USA soooooo

1 Like

that is weird for me it’s around 40. can you play tmrw and see if it stays the same.

I got 329 ping usually now

—-

I am still on a break, just checking the forum

2 Likes

Lag too muh after u left. I closed tab like four yimes. It hit 3k and 5k

329 on usa?!

Only?

:grimacing: Just wait until protocol reset i guess

1 Like

Only hapened today

happened tODAY?

I posted tht yesterday. And ye.

Better image loading

Improves: load time

This was something i was working on for fun, and it turned out pretty good.

Basically I noticed that swordbattle is taking longer and longer to load, especially the first time, due to there being so many skins now.

The way loading in swordbattle used to work is, it would load all the skins during that first “Loading” screen with the green background.

This is very inefficient for 2 reasons

  • Not all the skins loaded won’t be shown, it will just be sitting in computer wasting memory
  • It lags the server because the server has to send the image to everyones computer every time they load.

I have fixed this, by changing the load mechanism.

Now when someone joins a game, it instantly sets them to the basic player skin, which is always downloaded at the beginning.

Then it checks if your computer already has their skin, if it does, great it will replace their skin almost instantly.

If it can’t find the skin, it will then only request that skin from the server, and store it in your browser session for later use. This way, only needed skins are shown, and only downloaded when it’s requested.

This isn’t really a huge fix, but might improve loading times, especially for new players.

Update is now pushed btw

2 Likes

thx man

Just pulled and looked and it seems uve deleted over 100 lines. Gj. Deleted the three useless players btw

Im curious, should I consider rewriting the game?

Lag has always been a problem, and maybe it’s more of a deeper issue than just

oh just change this boom lag gone

Rewriting will defentitly take a lot of time and effort, but will it pay off in the long run?

1 Like

I think it will pay off and eithrr way ur codinh will improve and itll be easier to update bc cleaner code

Temporary lag improvement… NEW SERVER!

Read more here;

2 Likes

The protocol rewrite is now… Abandoned :frowning:

Don’t worry, something much bigger is coming…

3 Likes