-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event based future prediction engine #740
Comments
Intrigued. |
Interesting. What benefits going tickless brings? To me it sounds like complexity of code and network protocol increases by a lot, while not really bringing such substantial improvements. If I recall correctly, vanilla used variable-length ticks which addressed the issue of network latency to some extent. |
Maybe "Tickless" is the wrong word to describe the intentions behind this concept - maybe "predicting" is more accurate. The Idea is more to evaluate the consequences of each action and predict it as far as possible into the future. The benefit of having everything run in predictions is, that you just have to define certain key frames, that may even be some 30 seconds in the future, and in terms of networking and even simulation they do not have to be touched anymore, so no wasted CPU and Network load for them. The only things that may change a prediction are inputs by the user, that will then change a few predictions, these changes are transmitted, and violá - everything is back in sync. |
Shortest TODO entry I can make of it: Unit actions have an Instead, unit actions must generate predictions and corrections to these predictions. There must be another entity that will read these predictions/corrections and mutate attributes of the rendered objects. That entity must be able to seek backwards in history. There were 16 unit actions last time I've checked. |
Yes - every action done by a user is evaluated in the beginning and its consequences are calculated. The Unit, that draws/renders animation and needs to have a static snapshot for that, can do so by interpolating (linear or step-wise) between keyframes. Internally, this can be implemented by just walking over a double-linked-list indexed by timestamp, and storing a "active-element" reference for every value. Keep in Mind - this is not only done for Unit's locations, but also for their HP, for buildings, and their bulding progress, for the lists of existing units - for every single value that might be changing within every single game entity. |
I created a test project for this concept. |
void Physics::update_ball(PongBall &ball, const tube::tube_time_t &now, int recursion_limit) {
auto speed = ball.speed.get(now);
auto pos = ball.position.get(now);
float ty = 0;
if (speed[1] > 0) { // the ball is travelling downwards
ty = (1 - pos[1]) / speed[1];
} else {
ty = (pos[1] - 1) / speed[1];
}
auto hit_pos = pos + speed * ty;
ball.position.set_drop(now + ty, hit_pos);
speed[1] *= -1;
ball.speed.set_drop(now + ty, speed);
if (recursion_limit > 1) {
update_ball(ball, now + ty, recursion_limit - 1);
}
} Used methods:
What does it?It bounces the ball between the upper and the lower boundary (in the example 0 and 1).
Why!Do you see how simple and straight-forward the whole pall prediction was? |
quantum mechanics :) |
A formalization of what we will be doing is this: Just discovered it. We will basically perform dead-reckoning with player input to create the contents of the uncertainty cones. |
Is someone working on this?, If not, could I pick this up? |
@darkcoderrises the current implementation is in #744, so if you like you can add remarks and suggestions there. |
We have some ideas to make the game engine completely tickless. That means there will be no regular update interval in the simulation. It becomes event based!
Basically, on each event we always try to predict it's influence to the world as much into the future as "it makes sense". For that, we have a space-time model of the game state, that is, all the data is time-relative. We can then align the event into the spacetime and make required adjustments to the predictions.
The differences to the standard ticked-approach are not that big, especially in the simulation logic itself. Just the approach and data storage is totally different.
Questions to solve:
t -> ∞
(building progress, research, ...)Yes, it sounds crazy, but it may work. More info to come... 🔥
https://0fps.net/2014/02/26/replication-in-networked-games-spacetime-consistency-part-3/
The text was updated successfully, but these errors were encountered: