So, Heroes Battlegrounds’ Light Attacks (left click) run directly on the client (confirmed by disconnecting my internet lol) then to the server, and it achieves a very smooth feel to the game, even when in higher ping servers. I am kind of dumbfounded on how they would achieve such a system. Does anyone have any ideas on how could I achieve such a thing?
I play heroes battlegrounds every day and I also seem to know a little about scripting.
I do agree that heroes battlegrounds probably has one of the most if not THE most smoothest gameplay for high pings.
From what I can see when I load in, (my ping spikes to 10000 ping), my m1s don’t work, so that means before even handling animations the client requests the server. However, when my ping is constantly 160, my m1 chain is usually perfect.
How!?!?!?
Well, my best guess has to do with the holding-toggle. Incase you didn’t notice, you can hold down your left-click for a perfect m1 chain.
Usually, what most games do for when handling hold-toggles are to run a function on RunService’s Heartbeat event, where it would then see if InputService/ContextActionService can detect a toggle (holding left click, holding RT, etc) based on the user’s device. This works good, but when your ping is high, the remote that is fired can be delayed, causing some pretty bad m1s (jjs, realm rampage)
Like previously mentioned, this is MY BEST GUESS for how heroes’ handles m1 chains, since i’m certainly not a developer. I’d like to mention you could probably join their discord and ask one of the devs and they’d give you an answer.
I think when you begin to hold down the m1 button, a server event is fired once that sets a player’s userID to true on the server (like in a dictionary). Then, the server will handle each player’s m1s on heartbeat or something similar as long as that variable is held down. In other words, while the key was held down before and the player is lagging, the m1 chain is effectively smooth. When the key is released, another remote is fired to negate the variable aforementioned.
Although I personally think this is a good solution, people who get 40,000 ping for 10+ seconds don’t continue punching. This is what happens when I tested the system above with a lag switch (turning off my wifi).
Sorry if this wasn’t the answer you were looking for, but I hope you can use this as a base for your game. Ask me or correct me on anything if you want. Happy developing!
Client-sided hitreg helps with smoothness