4 ms·
Definitely not. Games operate in a loop: gather input, run update (tick), and then render the frame. The problem with the above is when sub-frame timings matte
by Laremere 4y ago
Definitely not. Games operate in a loop: gather input, run update (tick), and then render the frame.
The problem with the above is when sub-frame timings matter. What they're doing is being smarter about how they're calculating things.
Eg: A 'naive' approach to movement could be:
forward_pressed() {
moving_forward = true;
}
update_position() {
if (moving_forward) {
pos += time_since_last_update * player_speed;
}
}
But an approach which would improve timings is:
forward_pressed() {
forward_pressed_at = time.now();
moving_forward = true;
}
update_position() {
if (moving_forward) {
time_since_pressed = forward_pressed_at - time.now();
if (time_since_pressed < time_since_last_update) {
pos += time_since_pressed * player_speed;
} else {
pos += time_since_last_update * player_speed;
}
}
}
Except things are more complicated as you need to consider exact position someone was when someone else pressed the shoot button, etc.
To answer grandparent's question: They'll likely reducing tick rate to save server costs. However they can't lower too much without having noticeable effects for systems which don't account for sub-frame accuracy.
Nits: Above is a simplification and theoretically you could do things differently, but as this is in Source Engine 2, they're definitely using ticks still.
- adamwk 4y agoAren’t you describing frame rate? Tick rate is different; it’s when the server synchronizes state across clients
- squeaky-clean 4y agoFrame rate is often an interpolated and predicted view over a fixed tickrate.