Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
Topic closed
I've seen those wicked sick bots where you shoot blocks and then there's a cooldown period. How do I keep track of a lot of players shooting then having to wait before shooting again? I wouldn't want to use stopwatches that count every tick for every player, right? Would I store the time when the player shoots and then check when they press shoot again if the difference between current time and previous time is greater than cooldown period?
Offline
Indeed, you want the second option. Timestamps with millisecond accuracy should suffice for anything game related.
When a button is pressed, simply compare the current time in milliseconds to the time the last bullet was fired for the player. If the difference is greater than your timeout, then fire away.
This is the approach that should be taken for just about anything timing related where you don't need an event fired at regular intervals.
You do need to be somewhat careful though, as a 32 bit integer can only represent an interval of about 49.7 days in milliseconds. If your bot runs for longer than that, you might get some issues if you don't account for overflow. Or... You can use a 64 bit integer, which can represent an interval of up to 584,550,048 years in milliseconds...
Offline
Pages: 1
Topic closed
[ Started around 1732211382.4002 - Generated in 0.044 seconds, 11 queries executed - Memory usage: 1.36 MiB (Peak: 1.45 MiB) ]