how could i know if it run correctly with linux server no graphic
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Re: how could i know if it run correctly with linux server no graphic
My client and server are unsync. It walk with difference velocity. My client is faster. Client use Unity. And Sever is use updateCharacterGoal.
I send bepu target and speed back to client. And then make character move.
But in bepu I make it send position back as foot print.
Here are my thread code
First i use sleep time but it seem slow at UpdateCharacterGoals. After that I try deltatime but it is slower.
So I try this
Program seem do nothing. I think because of it is rapid fire.
I have another question what is thread dispatcher?
I send bepu target and speed back to client. And then make character move.
But in bepu I make it send position back as foot print.
Here are my thread code
Code: Select all
void PoolThread()
{
var deltaTime = 0.015f;
var sleepTime = (int)(deltaTime * 1000);
while (true)
{
simulation.Timestep(deltaTime, threadDispatcher);
foreach (var pair in walkCharacters)
{
var character = pair.Value;
if (character.CalculateMagnitude() > 0.5)
{
var distant = character.CalculateDistant();
if (distant > 0.2)
{
if (!character.IsCalculateVelocityYet)
{
character.CalculateVelocity();
}
//charac.MunipulateVelocity();
character.CharacterInputt.UpdateCharacterGoals(character.Velocity, character.MoveSpeed, [color=#FF4000]sleepTime[/color]);
character.InstantMove();
}
else
{
walkRemoveCharacters.Add(character.collider.bodyHandle);
}
}
}
foreach (var handle in walkRemoveCharacters)
{
if (walkCharacters.ContainsKey(handle))
{
walkCharacters.Remove(handle);
//simulation.Bodies.Remove(handle);
//handleUnits.Remove(handle);
}
}
walkRemoveCharacters.Clear();
if (isStop)
{
break;
}
Thread.Sleep(sleepTime);
}
}
So I try this
Code: Select all
void PoolThread()
{
while (true)
{
foreach (var pair in walkCharacters)
{
var character = pair.Value;
if (character.CalculateMagnitude() > 0.5)
{
var distant = character.CalculateDistant();
if (distant > 0.2)
{
if (!character.IsCalculateVelocityYet)
{
character.CalculateVelocity();
}
character.CharacterInputt.UpdateCharacterGoals(character.Velocity, character.MoveSpeed, deltaTime);
character.InstantMove();
}
else
{
walkRemoveCharacters.Add(character.collider.bodyHandle);
}
}
}
foreach (var handle in walkRemoveCharacters)
{
if (walkCharacters.ContainsKey(handle))
{
walkCharacters.Remove(handle);
//handleUnits.Remove(handle);
}
}
walkRemoveCharacters.Clear();
if (isStop)
{
break;
}
Simulation.Timestep(deltaTime, threadDispatcher);
}
}
I have another question what is thread dispatcher?
Re: how could i know if it run correctly with linux server no graphic
Thread.Sleep will sleep at least as long as the input value, but is not guaranteed any level of precision beyond that. The resolution depends upon the operating system. On windows, I believe the default resolution is 15.625ms, so you're dealing with very coarse timing. It's possible to force higher resolution, and it's possible to use Thread.Sleep(1) if you know you need to sleep a duration longer than the sleep resolution to help skip some time, but for significant precision you generally need a busy loop. (To make it a little friendlier, you can use Thread.Yield and Thread.Sleep(0) to schedule different sets of waiting threads.)
On top of that, it's not enough to simply wait a fixed delta time between updates, since the update itself could take time. To know how much longer you need to wait, you have to measure how long it's actually been since the start of the last update. Stopwatch.GetTimestamp/Stopwatch.Frequency can give you reasonably precise measurements.
If you don't want to use multithreading internally, you can just not pass a thread dispatcher into the simulation.Timestep function.
On top of that, it's not enough to simply wait a fixed delta time between updates, since the update itself could take time. To know how much longer you need to wait, you have to measure how long it's actually been since the start of the last update. Stopwatch.GetTimestamp/Stopwatch.Frequency can give you reasonably precise measurements.
It's the interface that bepuphysics uses to launch threads for multithreading internally. It should launch a number of threads equal to the number of workers you want to use- the engine handles job scheduling internally.I have another question what is thread dispatcher?
If you don't want to use multithreading internally, you can just not pass a thread dispatcher into the simulation.Timestep function.
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Re: how could i know if it run correctly with linux server no graphic
Thank you.
Or you mean I have to use that every thread frame.(Use it inside thread)
After I make more dt the faster it walk after 6 it walk faster than unity
Is this code tell bepu deltatime?
What I have to put in this deltatime?
What is delta time I have to put in update character goals
You mean i can find fixed time by Stopwatch.GetTimestamp/Stopwatch.Frequency. Is this will get me delta time right?On top of that, it's not enough to simply wait a fixed delta time between updates, since the update itself could take time. To know how much longer you need to wait, you have to measure how long it's actually been since the start of the last update. Stopwatch.GetTimestamp/Stopwatch.Frequency can give you reasonably precise measurements.
Or you mean I have to use that every thread frame.(Use it inside thread)
After I make more dt the faster it walk after 6 it walk faster than unity
Code: Select all
simulation.Timestep(deltaTime, threadDispatcher);
What I have to put in this deltatime?
What is delta time I have to put in update character goals
Re: how could i know if it run correctly with linux server no graphic
Yes, in order to wait the correct amount of time, you must constantly be measuring how much longer you have to wait:Or you mean I have to use that every thread frame.(Use it inside thread)
The simulation itself should operate on a fixed timestep- choose a constant value ahead of time. After that much time has elapsed (as measured in the waiting loop) since the start of the previous update, you trigger another timestep with that constant timestep duration.Is this code tell bepu deltatime?
What I have to put in this deltatime?
UpdateCharacterGoals needs the same fixed timestep duration.
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Re: how could i know if it run correctly with linux server no graphic
I'm made stand alone version after not understand where I miss. Now this stand alone also use as it is in project. I don't know why it is slow.
Help me please.
Thank you.
https://github.com/parapoohda/testBepu
I only make it move forward. And It is base on character demo.
Help me please.
Thank you.
https://github.com/parapoohda/testBepu
I only make it move forward. And It is base on character demo.
Re: how could i know if it run correctly with linux server no graphic
The CharacterControllers system itself is not being used, so the only thing active is the CharacterControllerInput air control. The CharacterControllers needs to be hooked up like in the original demos.
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Re: how could i know if it run correctly with linux server no graphic
Oh I have to look into it. Thank you.
It seem after use character demo callback it is walkable.
But I want to make online game can All character share same character controller?
Update
I seem i am silly. I think character controller is for one character. But after I share character control It move(I move 2 character with different direction).
It seem after use character demo callback it is walkable.
But I want to make online game can All character share same character controller?
Update
I seem i am silly. I think character controller is for one character. But after I share character control It move(I move 2 character with different direction).
Re: how could i know if it run correctly with linux server no graphic
An individual CharacterController is indeed only for a single character and should not be shared, but the CharacterControllers system is designed to handle all the characters in the simulation.
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Re: how could i know if it run correctly with linux server no graphic
Thank you. I didn't notice there are character control with and without s.
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Re: how could i know if it run correctly with linux server no graphic
It try to use broad phase to tell which unit is near player. So I don't have to send every thing in bufferpool(game map) to client.
but I think broad phase work incorrectly with static.But it work fine with dynamic.
Can I use broadphase to see static object too.
Maybe because I use handle to refer to my custom object. Because first static and first dynamic share same handle (Not sure). So it break.
Is broadphase can sense static?
Is dynamic and static object can share same handle?
thank you
but I think broad phase work incorrectly with static.But it work fine with dynamic.
Can I use broadphase to see static object too.
Maybe because I use handle to refer to my custom object. Because first static and first dynamic share same handle (Not sure). So it break.
Is broadphase can sense static?
Is dynamic and static object can share same handle?
thank you
Re: how could i know if it run correctly with linux server no graphic
Yes to both. The broad phase reports CollidableReference instances which have a Mobility property that can be used to distinguish between bodies and statics.Is broadphase can sense static?
Is dynamic and static object can share same handle?
Note that the handle and mobility flag are packed into the CollidableReference.Packed field, so it could serve as a simulation-wide unique collidable identifier if you want.
-
- Posts: 92
- Joined: Fri May 31, 2019 6:30 am
Re: how could i know if it run correctly with linux server no graphic
Thank you. You're very helpful.