mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 14:59:19 +02:00
multiplayer: the session imposes the settings that decide the physics
server_hello.config had been a TODO carrying a zero, and every peer ran with whatever its own eu07.ini happened to say - including a vehicle physics thread count, which makes the order vehicles are stepped in depend on how threads get scheduled. - the handshake now carries a bitfield of the settings that change how the physics comes out (full physics, realistic control) and a joining peer takes them on, saying in the log what changed - a multiplayer session runs the vehicle physics on one thread on every peer, host included Settings that only affect what a player sees or how comfortable the controls feel stay with the player; only what alters the outcome belongs in here.
This commit is contained in:
@@ -168,7 +168,7 @@ void network::server::handle_message(std::shared_ptr<connection> conn, const mes
|
||||
server_hello reply;
|
||||
reply.seed = Global.random_seed;
|
||||
reply.timestamp = Global.starting_timestamp;
|
||||
reply.config = 0; // TODO: pass bitfield with state of relevant setting switches
|
||||
reply.config = pack_session_config();
|
||||
reply.scenario = Global.SceneryFile;
|
||||
reply.app_version = Global.asVersion;
|
||||
reply.session_token = cmd.session_token;
|
||||
@@ -433,7 +433,7 @@ void network::client::handle_message(std::shared_ptr<connection> conn, const mes
|
||||
Global.random_seed = cmd.seed;
|
||||
Global.random_engine.seed(Global.random_seed);
|
||||
Global.starting_timestamp = cmd.timestamp;
|
||||
// TODO: configure simulation settings according to received cmd.config
|
||||
apply_session_config(cmd.config);
|
||||
Global.SceneryFile = cmd.scenario;
|
||||
Global.ready_to_load = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user