mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
### Description This PR implements a queue timeout in the lobby server. * After the time configured in `timeout` has elapsed (default: 3 minutes) since the first player joins the queue, matchmaking will start even if the queue has not reached the `players_per_game` target. Any missing slots will be filled with fake players. * If the first queued player leaves and other players remain, the timer is recalculated so that matchmaking starts after the `timeout` duration (default: 3 minutes) from the next player’s join time. (After that, the timer continues to be adjusted in the same way whenever the head of the queue changes.) ### Game Robocraft ### Please confirm - [x] I am the legal owner or represent the owner of all work submitted - [x] I consent to my submission being added to this FOSS project - [x] This PR used LLMs to generate some or all of the code changes Reviewed-on: https://git.ngram.ca/OpenJam/rc-servers/pulls/71 Reviewed-by: NGnius <ngniusness@gmail.com> Co-authored-by: MaxSignal <kastera58@gmail.com> Co-committed-by: MaxSignal <kastera58@gmail.com>
This commit is contained in:
@@ -619,6 +619,7 @@ fn default_multiplayer() -> super::MultiplayerConfig {
|
||||
super::MultiplayerConfig {
|
||||
players_per_game: 2,
|
||||
enabled: true,
|
||||
autostart_after_s: 180,
|
||||
network: super::multiplayer::default_net_conf(),
|
||||
fakes: super::multiplayer::default_fake_users(),
|
||||
battle_arena: super::multiplayer::default_ba_conf(),
|
||||
|
||||
@@ -403,6 +403,10 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
||||
fn is_multiplayer_enabled(&self) -> bool {
|
||||
self.battle.multiplayer.enabled
|
||||
}
|
||||
|
||||
fn multiplayer_autostart_after(&self) -> std::time::Duration {
|
||||
std::time::Duration::from_secs(self.battle.multiplayer.autostart_after_s)
|
||||
}
|
||||
|
||||
fn network_config(&self) -> crate::persist::NetworkConf {
|
||||
self.battle.multiplayer.network.clone()
|
||||
|
||||
@@ -27,6 +27,7 @@ pub trait ConfigProvider<C: Clone> {
|
||||
fn singleplayer_details(&self) -> SingleplayerConfig;
|
||||
fn players_per_game(&self) -> usize;
|
||||
fn is_multiplayer_enabled(&self) -> bool;
|
||||
fn multiplayer_autostart_after(&self) -> std::time::Duration;
|
||||
// FIXME don't use serializable types in traits
|
||||
fn network_config(&self) -> crate::persist::NetworkConf;
|
||||
fn maps(&self) -> std::collections::HashMap<GameMap, MapConfig>;
|
||||
|
||||
@@ -4,6 +4,7 @@ use serde::{Serialize, Deserialize};
|
||||
pub struct MultiplayerConfig {
|
||||
pub players_per_game: usize,
|
||||
pub enabled: bool,
|
||||
pub autostart_after_s: u64,
|
||||
#[serde(default = "default_net_conf")]
|
||||
pub network: NetworkConf,
|
||||
#[serde(default = "default_fake_users")]
|
||||
|
||||
Reference in New Issue
Block a user