How are rollbacks handled for firing weapons and projectile spawning in Forest Brawl? #226
-
Hey! Just trying to get a better understanding of some of the Forest Brawl code -- seems like the "fire weapon" detection logic is handled by the brawler-weapon class in the tick function, but a bit confused as to how this would interact with rollback. I'm not very experienced with rollback, but from my understanding since I guess thinking about it some more, since there doesn't seem to be logic to despawn the bomb projectile during a rollback, if the input were repeated, then there'd be two instances of the bomb, but then does this mean that if there were some event added that could block the player from firing in the tick they did, the bomb would continue to exist even though the server deems the player shouldn't have been able to fire on that frame? Thanks for all the help in advance, would love to be able to get a point where I can help contribute as well! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey @robinreversi Great question, it made me curious and start digging. This is my take on it and so I could be completely wrong - @elementbound explains most of it really well in the docs. The core of it is here: When a client fires a weapon if its own checks pass it creates the projectile but also asks the server to confirm. From here the server will do its own checks and confirm if it was ok to shoot or deny it at which point the client destroys its version and if was allowed the servers version of the projectile spawns and takes over. Now... Neither weapon nor projectile participate in rollbacks as they don't implement Basically the weapon fires when it does at the first valid input and there's no correcting that. There's no did Han or Greedo fire first kind of thing, first packet received at server will be actioned if its checks out. As you noticed there's no stun mechanic, the brawlers can always fire if their cooldowns have lapsed. The projectiles explode on contact again without rollback participation but they don't do damage directly, they emit one of several types of repulse effect which does participate in rollback. So I guess projectiles explode without re-checks but the explosion itself will confirm if the player was in the blast zone taking into account positional corrections via rollback checks. Pretty clever! |
Beta Was this translation helpful? Give feedback.
Hey @robinreversi
Great question, it made me curious and start digging. This is my take on it and so I could be completely wrong -
@elementbound explains most of it really well in the docs.
The core of it is here:
When a client fires a weapon if its own checks pass it creates the projectile but also asks the server to confirm.
From here the server will do its own checks and confirm if it was ok to shoot or deny it at which point the client destroys its version and if was allowed the servers version of the projectile spawns and takes over.
Now... Neither weapon nor projectile participate in rollbacks as they don't implement
_rollback_tick
.The docs explain that it's likely not ideal to inv…