DEAD RECKONING Model.

xiaoxiao2021-03-06  119

Today, when I play a online game, I found a problem when using the keyboard to operate the protagonist.

At the same time, hold two arrow keys, the characters are not straight to the corners of the two directions, but are circular around a point.

Sports, for this way of motion, if you use a traditional DEAD RECKONININING model, the direction will constantly change, then

It will bring a lot of network traffic, so how to solve such problems. Delicate for several times, finally realized.

First use the mathematical model to describe the traditional DEAD RECKONING model:

S (t) = v (0) * t (a * t ^ 2) / 2

For this model, when A is constant, or if the change frequency is not high, we can use the Linear Approximation to predict.

But for the circumstances, this model is changed, this model is not good.

If you understand what I said above, you can ignore this example I will talk about:

Two blind people walk in the desert, they have the root rope in the middle, and the rope is tied to a bomb. The rules are

When the rope is tight to a certain degree, the bomb will explode. Moreover, the left foot of the blind person in front of the road has

Point problem, so the route that came out is actually an arc to the left. The next blind is a normal person.

Just started, the rope between them always will often be due to the speed direction of the two blind people.

There is danger. Later, the blind people were painful, and they didn't dare to joke their lives. I followed the front.

Like the blind, we have gradually turned to the left of your own direction, so, the number of times the rope is tightened is less and less.

This example can be used to compare three synchronous methods, the most primitive synchronization method, Dead Reckoning, and improved version

Dead recning:

The most primitive method is that the blind man is dragging a big stone behind it, because there is friction with the ground, only

With the tightness of the rope, it will be near a distance from the blind, so the rope between them is timed every other paragraph.

Time will have a tight situation.

And dead recning is the front of the blind that is dragging the car, there are four wheels, when walking straight,

Perfect performance, almost never produce any rope, only tight occurs when turning

The situation is very satisfied with the blind in front of it.

However, when there is a problem with the blind feet in front, the car will have problems, and the car will tighten the rope.

Change to the same direction as the blind, but still straight lines, this time when the blind is the curve, the trolley

If you turn around and one right, you will change your straight line every time you walk to the rope.

The improved version of the dead reccking, more smart, has upgraded from the stone to the car, upgrade to another blind

People, as the saying goes, I only have blind people, I'm blind not deaf, the naked eyes can't see it, and

eye.

Well, then what is the math model of improvement?

In fact, it is very simple. Everyone has learned the mathematical knowledge of the distance and the third-order derivative equation.

The first-order derivative is the speed, the second order derivative is acceleration, the third-order derivative is acceleration / time

The unit is S / T ^ 3, temporarily giving it a name called K.

So, the forecast of time T is:

s (t) = v (0) * t a (0) / 2 (k * t ^ 3) / 4

In theory, the more the degree of the derivative, the more precise it is predicted. But is it necessary? There are only two status of the keyboard: press / release, there will be no saying that I press the 3/4 keyboard, then if the keyboard is pressed and released to change

If the speed A, this amount must be a quantity, so it is enough to get an equation by giving the acceleration guidance.

Most online games are used.

what? Is it worthless? This is the actual application value. The bottleneck of online games is mainly in the network, not

The display of the client, otherwise it will not be exhibited in the online game in the online game, it is exaggerated without considering the display efficiency.

Side model. So, when it is very likely to reduce network transmission, it still guarantees a better synchronous effect.

More important issues. While solving this problem, you get will allow more complex to be implemented on the server.

Logic or support more games.

Original article, if you need to reprint, please contact the author.

转载请注明原文地址:https://www.9cbs.com/read-99308.html

New Post(0)