mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-06 03:28:37 +01:00
fix(physics): the external program messages (multiplayer) no longer keep the physics steps in one thread, only network sessions do; the debug panel tells what keeps them in one
This commit is contained in:
@@ -866,7 +866,7 @@ void opengl46_renderer::SwapBuffers()
|
|||||||
( counts.threads > 1 ?
|
( counts.threads > 1 ?
|
||||||
"steps on " + std::to_string( counts.threads ) + " threads: " + std::to_string( counts.groups ) + " groups, largest "
|
"steps on " + std::to_string( counts.threads ) + " threads: " + std::to_string( counts.groups ) + " groups, largest "
|
||||||
+ std::to_string( counts.largestgroup ) + ", " + std::to_string( counts.maingroups ) + " in the main thread (forces by kind not timed)" :
|
+ std::to_string( counts.largestgroup ) + ", " + std::to_string( counts.maingroups ) + " in the main thread (forces by kind not timed)" :
|
||||||
std::string{ "steps on 1 thread" } ),
|
"steps on 1 thread (pool of " + std::to_string( counts.pool ) + ( counts.singlethread.empty() ? std::string{ ")" } : ", off by " + counts.singlethread + ")" ) ),
|
||||||
"" );
|
"" );
|
||||||
char const *const kindnames[] = { "rail, within ", "rail, farther", "road, within ", "road, farther" };
|
char const *const kindnames[] = { "rail, within ", "rail, farther", "road, within ", "road, farther" };
|
||||||
text += timeline( 3, "by kind (near: " + nearlimit + ")", " count stand forces update" );
|
text += timeline( 3, "by kind (near: " + nearlimit + ")", " count stand forces update" );
|
||||||
|
|||||||
@@ -204,6 +204,8 @@ struct subsystem_stopwatches {
|
|||||||
// the steps of the physics: threads, the groups of vehicles they were split in, the largest one, the groups done in the main
|
// the steps of the physics: threads, the groups of vehicles they were split in, the largest one, the groups done in the main
|
||||||
// thread (vehicle_table::update_steps_parallel())
|
// thread (vehicle_table::update_steps_parallel())
|
||||||
unsigned int threads { 1 };
|
unsigned int threads { 1 };
|
||||||
|
unsigned int pool { 1 }; // threads of worker_pool
|
||||||
|
std::string singlethread; // what keeps the steps in one thread, if anything
|
||||||
unsigned int groups { 0 };
|
unsigned int groups { 0 };
|
||||||
unsigned int largestgroup { 0 };
|
unsigned int largestgroup { 0 };
|
||||||
unsigned int maingroups { 0 };
|
unsigned int maingroups { 0 };
|
||||||
|
|||||||
@@ -8681,15 +8681,22 @@ vehicle_table::update( double Deltatime, int Iterationcount ) {
|
|||||||
Timer::subsystem.vehicles_prepare.stop();
|
Timer::subsystem.vehicles_prepare.stop();
|
||||||
Timer::subsystem.vehicles_forces.start();
|
Timer::subsystem.vehicles_forces.start();
|
||||||
auto const totaltime { Deltatime * Iterationcount }; // całkowity czas
|
auto const totaltime { Deltatime * Iterationcount }; // całkowity czas
|
||||||
// the steps of the physics on many threads (Global.performance_cpucores). not in a network session, which keeps the draws of
|
// the steps of the physics on many threads (Global.performance_cpucores). not in a network session (network.server, .client),
|
||||||
// Random() in step across the machines: the threads have engines of their own
|
// which keeps the draws of Random() in step across the machines: the threads have engines of their own. the messages to
|
||||||
|
// external programs (Global.iMultiplayer) don't mind
|
||||||
auto &workers { Workers() };
|
auto &workers { Workers() };
|
||||||
auto const parallel {
|
auto const parallel {
|
||||||
( workers.size() > 1 )
|
( workers.size() > 1 )
|
||||||
&& ( Global.iMultiplayer == 0 )
|
|
||||||
&& Global.network_servers.empty()
|
&& Global.network_servers.empty()
|
||||||
&& ( false == Global.network_client.has_value() ) };
|
&& ( false == Global.network_client.has_value() ) };
|
||||||
counts.threads = ( parallel ? static_cast<unsigned int>( workers.size() ) : 1u );
|
counts.threads = ( parallel ? static_cast<unsigned int>( workers.size() ) : 1u );
|
||||||
|
// why not, for the debug panel
|
||||||
|
counts.pool = static_cast<unsigned int>( workers.size() );
|
||||||
|
counts.singlethread =
|
||||||
|
( workers.size() <= 1 ? "performance.cpucores " + std::to_string( Global.performance_cpucores ) :
|
||||||
|
false == Global.network_servers.empty() ? std::string{ "network.server" } :
|
||||||
|
Global.network_client.has_value() ? std::string{ "network.client" } :
|
||||||
|
std::string{} );
|
||||||
if( parallel ) {
|
if( parallel ) {
|
||||||
update_steps_parallel( Deltatime, Iterationcount, coarse );
|
update_steps_parallel( Deltatime, Iterationcount, coarse );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user