haxball / haxball-issues

115 stars 43 forks source link

rate/burst minor bug #855

Open Wazarr94 opened 5 years ago

Wazarr94 commented 5 years ago

On game startup, I use the command /kick_rarelimit 0 180 3 (rate 180 burst 3).

Not much thanks to the documentation, I figured you start with the number of the burst (poor name, should be refering to the stock of shots available or something if I believe what it means) that you can spend as you begin the game and then you need to wait.

At first, reading the documentation, I thought you could store shots so you can use it "all at once", meaning you can do triple shot, which is kinda stupid.

If possible, I think the following sentences are more helpful for the documentation, as well as changing the name burst to storage, which is more fitting:

min is the minimum amount of frames between two kicks by the same player. Players won't be able to kick more frequently than this number of frames.

rate is the allowed amount of frames between two kicks, but unlike min, players are able to save up as many kicks as the storage value and use them regardless of the rate value.

storage determines how many kicks the player is able to save up.

Here's my plan. I shoot 3 times before the 3 second mark, let's say I have a special map and I can shoot instantly after every shot. I should be hitting the ball 3 times, and then run out of shot. If I understand this rate/burst thing, I have to wait 3 seconds after my first shot to be able to shoot again, or I can wait 6 seconds so I can shoot twice, or at last, I can wait 9 seconds so I can shoot 3 times in a row.

If I diminish rate to 120, I would have to wait 120 frames (or 2 seconds) to have a new shot, and if I change burst to 5, at startup I can do 5 kicks at the start and then I can load up to 5 shots.

I feel like this is what should be happening, the documentation is a bit too vague, but I can understand since it is hard to explain.

The problem I find is at the start, using my first command (0 180 3), I have a different number of shots everytime I stop and start the game.

There might be something with burst not being reset at the start of each game, I'd bet a dollar on that.

basro commented 5 years ago

The rate limit is not reset when you start a new game, I don't consider this a bug.

It might be an enhancement to reset it on kickoffs though, I'll consider it for future updates.

Wazarr94 commented 5 years ago

Yes, I'm not talking about the rate, but only the number of shots stored. If you start and stop multiple times, you can end up with 2n - 1 (?) shots in a row possible.

EDIT: no problem here after all

I'm gonna try and record it if possible.

PS: What's the difference from 0 burst to 1 burst ?

basro commented 5 years ago

That is what I meant, the stored kicks is not reset and I don't consider it a bug.

burst 0 makes rate work like min, so basically the larger of the two will dictate how often you can kick.

Wazarr94 commented 5 years ago

Doesn't burst 1 makes it the same ? Hence the question.

Update: switched to 0 240 6, started the game, ended the game, started another one and ended it after, switched to 0 120 1 and had a big amount of shots available for some reason.

EDIT : Oh I see it's additional shot my bad.

Wazarr94 commented 5 years ago

OK, after more tries, I understand your answer.

The problem with it seems that after restarting a game, you do not have your burst reset to the max.

Example of the problem (I tested it but I cannot make a gif from it, my Chrome is refusing and i cba to upload it as a rec) that you can reproduce yourself:

1) Create a room 2) Load a map that enables you to shoot at multiple times quickly without much distance to the ball 3) Enter the command /kick_ratelimit 0 240 2. When fully loaded up (you gotta wait 6 seconds), you get 1 normal shot + 2 extra shots (burst value of 2) 4) Start the game

If you rush the ball, you only get 1 shot (you don't start fully loaded up), if you wait 6 seconds, you'll get 3 shots. If you stop the game right after doing all your shots, if you start the game, you will not have the possibility to shot the ball for some time. The correct behavior imo should be that you get all shots at the reset of position, this way this behavior cannot happen. Also, if you change kick rate limit in a middle of a game, there are some weird stuff happening.

But since it is pretty hard to abuse (and rare, it only happens with big rate and short maps), I think this is a minor bug.

The documentation has some typos too, it says :

rate is the allowed amount of frames between two kicks, but unlike min rate a player to save up more kicks and spend them later all at once depending on the burst value.

And the line before it says wont instead of won't (while we're at it)

thanks for your time

Wazarr94 commented 5 years ago

Final post (even more minor problem), the replay doesn't show the change of kick_ratelimit, even though the game shows it.

Thanks

basro commented 5 years ago

Ok yes this is a bug. Changing the kick ratelimit of a room doesn't reset some internal counters which means players can surpass the rate limit for the first few kicks.

This bug requires a backwards incompatible update to fix and is low priority because the only way to "exploit" it is to first set a high kick rate limit and then lower it.

I will fix it the next time I make a backwards incompatible update.

Wazarr94 commented 5 years ago

No problem, I was just playing around and saw weird stuff happening, just wanted to mention it.