turn down world sync time and enemy sync intervals,

This commit is contained in:
bgkillas 2024-08-30 17:12:17 -04:00
parent 090e02003b
commit 2d02856ef8
4 changed files with 17 additions and 13 deletions

View file

@ -84,11 +84,11 @@ impl Default for GameSettings {
use_constant_seed: false,
item_dedup: true,
enemy_hp_mult: 1.0,
world_sync_interval: 2,
world_sync_interval: 3,
game_mode: GameMode::LocalHealth,
friendly_fire: false,
chunk_target: 32,
enemy_sync_interval: 2,
enemy_sync_interval: 3,
progress: Vec::new(),
}
}
@ -626,7 +626,7 @@ impl App {
ui.add_space(10.0);
ui.label("Amount of chunks host has loaded at once, synced enemies and physics objects need to be loaded in by host to be rendered by clients");
ui.add(Slider::new(&mut game_settings.chunk_target, 1..=64));
if game_settings.world_sync_version == 2 {
/*if game_settings.world_sync_version == 2 {
ui.add_space(10.0);
ui.label(tr("World-will-be-synced-every-this-many-frames"));
ui.label(tr("Higher-values-result-in-less-performance-impact"));
@ -636,7 +636,7 @@ impl App {
ui.add_space(20.0);
ui.label("Enemy sync interval");
ui.add(Slider::new(&mut game_settings.enemy_sync_interval, 1..=8));
ui.add(Slider::new(&mut game_settings.enemy_sync_interval, 1..=8));*/
ui.add_space(20.0);
ui.label(tr("connect_settings_player_tether_desc"));

View file

@ -237,7 +237,7 @@ impl WorldManager {
let mut emit_queue = Vec::new();
// How many updates till we relinquish authority/stop listening.
let unload_limit = 36;
let unload_limit = 28;
for (&chunk, state) in self.chunk_state.iter_mut() {
let chunk_last_update = self

View file

@ -321,11 +321,14 @@ function enemy_sync.client_cleanup()
end
function enemy_sync.on_world_update_host()
local num = 1
if ctx.proxy_opt.enemy_sync_interval == 1 then
local int = 3 --ctx.proxy_opt.enemy_sync_interval
local num = 2
if int == 1 then
num = 0
elseif int == 2 then
num = 1
end
if GameGetFrameNum() % ctx.proxy_opt.enemy_sync_interval == num then
if GameGetFrameNum() % int == num then
enemy_sync.host_upload_entities()
end
if GameGetFrameNum() % 10 == 5 then

View file

@ -61,15 +61,15 @@ local function get_all_chunks(ocx, ocy, priority)
local grid_world = world_ffi.get_grid_world()
local chunk_map = grid_world.vtable.get_chunk_map(grid_world)
--local thread_impl = grid_world.mThreadImpl
if GameGetFrameNum() % ctx.proxy_opt.world_sync_interval == 0 then
local int = 3 -- ctx.proxy_opt.world_sync_interval
if GameGetFrameNum() % int == 0 then
for cx = ocx - 1, ocx do
for cy = ocy - 1, ocy do
send_chunks(cx, cy, chunk_map)
end
end
net.proxy_bin_send(KEY_WORLD_END, string.char(priority))
elseif GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 3) == 1 then
elseif GameGetFrameNum() % (int * 2) == 1 then
local nx = ocx
if iter_fast then
nx = nx - 2
@ -83,7 +83,7 @@ local function get_all_chunks(ocx, ocy, priority)
end
net.proxy_bin_send(KEY_WORLD_END, string.char(priority + 1))
iter_fast = not iter_fast
elseif GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 6) == 3 then
elseif GameGetFrameNum() % (int * 4) == 4 then
local nx = ocx
if iter_slow == 1 or iter_slow == 2 then
nx = nx - 3
@ -124,7 +124,8 @@ function world_sync.on_world_update()
else
get_all_chunks(ocx, ocy, 16)
end
if GameGetFrameNum() % (ctx.proxy_opt.world_sync_interval * 6) == 3 then
local int = 3 -- ctx.proxy_opt.world_sync_interval
if GameGetFrameNum() % (int * 4) == 0 then
iter_cam = not iter_cam
end
else