Re: how could i know if it run correctly with linux server no graphic
Posted: Sat Aug 03, 2019 3:52 am
Thank you norbo.
Former forum of queegs; use github discussions now!
https://forum.bepuentertainment.com/
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);
}
}
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);
}
}
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?
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.
Code: Select all
simulation.Timestep(deltaTime, threadDispatcher);
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?
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?