mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix UI issues & cleanup
This commit is contained in:
parent
66f6b81575
commit
9ababec625
@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Portals that spawn in place of the last staircase at old style dungeons to prevent stair cheesing
|
||||
- Mutliple singleplayer worlds and map generation UI.
|
||||
- New arena building in desert cities, suitable for PVP, also NPCs like to watch the fights too
|
||||
- The loading screen now displays status updates for singleplayer server and client initialization progress
|
||||
|
||||
### Changed
|
||||
|
||||
|
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -6785,7 +6785,6 @@ dependencies = [
|
||||
"authc",
|
||||
"byteorder",
|
||||
"clap",
|
||||
"crossbeam-channel",
|
||||
"hashbrown 0.13.2",
|
||||
"image",
|
||||
"num 0.4.1",
|
||||
|
@ -61,18 +61,18 @@ hud-sit = Sit
|
||||
hud-steer = Steer
|
||||
hud-portal = Portal
|
||||
hud-init-stage-singleplayer = Starting singleplayer server...
|
||||
hud-init-stage-server-db-migrations = [{ common-server }]: Applying database migrations
|
||||
hud-init-stage-server-db-vacuum = [{ common-server }]: Cleaning up database
|
||||
hud-init-stage-server-db-migrations = [{ common-server }]: Applying database migrations...
|
||||
hud-init-stage-server-db-vacuum = [{ common-server }]: Cleaning up database...
|
||||
hud-init-stage-server-worldsim-erosion = [{ common-server }]: Erosion { $percentage }%
|
||||
hud-init-stage-server-worldciv-civcreate = [{ common-server }]: Generated { $generated } out of { $total } civilizations
|
||||
hud-init-stage-server-worldciv-site = [{ common-server }]: Generating sites
|
||||
hud-init-stage-server-economysim = [{ common-server }]: Simulating economy
|
||||
hud-init-stage-server-spotgen = [{ common-server }]: Generating spots
|
||||
hud-init-stage-server-worldciv-site = [{ common-server }]: Generating sites...
|
||||
hud-init-stage-server-economysim = [{ common-server }]: Simulating economy...
|
||||
hud-init-stage-server-spotgen = [{ common-server }]: Generating spots...
|
||||
hud-init-stage-server-starting = [{ common-server }]: Starting server...
|
||||
hud-init-stage-multiplayer = Starting multiplayer
|
||||
hud-init-stage-client-connection-establish = [{ common-client }]: Establishing connection to server
|
||||
hud-init-stage-client-request-server-version = [{ common-client }]: Wating for server version
|
||||
hud-init-stage-client-authentication = [{ common-client }]: Authenticating
|
||||
hud-init-stage-client-load-init-data = [{ common-client }]: Loading initialization data from server
|
||||
hud-init-stage-client-connection-establish = [{ common-client }]: Establishing connection to server...
|
||||
hud-init-stage-client-request-server-version = [{ common-client }]: Waiting for server version...
|
||||
hud-init-stage-client-authentication = [{ common-client }]: Authenticating...
|
||||
hud-init-stage-client-load-init-data = [{ common-client }]: Loading initialization data from server...
|
||||
hud-init-stage-client-starting-client = [{ common-client }]: Preparing Client...
|
||||
hud-init-stage-render-pipeline = Creating render pipeline ({ $done }/{ $total })
|
||||
|
@ -30,7 +30,6 @@ tracing = { workspace = true }
|
||||
rayon = { workspace = true }
|
||||
specs = { workspace = true, features = ["serde", "storage-event-control", "derive"] }
|
||||
vek = { workspace = true }
|
||||
crossbeam-channel = { workspace = true }
|
||||
hashbrown = { workspace = true }
|
||||
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "abb1a705827984e11706d7bb97fb7a459e1e6533" } # xMAC94x/current_master_till_refactored branch
|
||||
|
||||
|
@ -72,6 +72,7 @@ pub fn make_client(
|
||||
username,
|
||||
password,
|
||||
|_| true,
|
||||
Arc::new(|_| {})
|
||||
))
|
||||
.ok()
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ use common_net::{
|
||||
use common_state::State;
|
||||
use common_systems::add_local_systems;
|
||||
use comp::BuffKind;
|
||||
use crossbeam_channel::Sender;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use image::DynamicImage;
|
||||
use network::{ConnectAddr, Network, Participant, Pid, Stream};
|
||||
@ -307,17 +306,11 @@ impl Client {
|
||||
username: &str,
|
||||
password: &str,
|
||||
auth_trusted: impl FnMut(&str) -> bool,
|
||||
init_stage_update: Option<Sender<ClientInitStage>>,
|
||||
init_stage_update: Arc<dyn Fn(ClientInitStage) + Send + Sync>,
|
||||
) -> Result<Self, Error> {
|
||||
let update_stage = |stage: ClientInitStage| {
|
||||
if let Some(updater) = &init_stage_update {
|
||||
let _ = updater.send(stage);
|
||||
}
|
||||
};
|
||||
|
||||
let network = Network::new(Pid::new(), &runtime);
|
||||
|
||||
update_stage(ClientInitStage::ConnectionEstablish);
|
||||
init_stage_update(ClientInitStage::ConnectionEstablish);
|
||||
let mut participant = match addr {
|
||||
ConnectionArgs::Tcp {
|
||||
hostname,
|
||||
@ -347,7 +340,7 @@ impl Client {
|
||||
let in_game_stream = participant.opened().await?;
|
||||
let terrain_stream = participant.opened().await?;
|
||||
|
||||
update_stage(ClientInitStage::WatingForServerVersion);
|
||||
init_stage_update(ClientInitStage::WatingForServerVersion);
|
||||
register_stream.send(ClientType::Game)?;
|
||||
let server_info: ServerInfo = register_stream.recv().await?;
|
||||
if server_info.git_hash != *common::util::GIT_HASH {
|
||||
@ -366,7 +359,7 @@ impl Client {
|
||||
|
||||
ping_stream.send(PingMsg::Ping)?;
|
||||
|
||||
update_stage(ClientInitStage::Authentication);
|
||||
init_stage_update(ClientInitStage::Authentication);
|
||||
// Register client
|
||||
Self::register(
|
||||
username,
|
||||
@ -377,7 +370,7 @@ impl Client {
|
||||
)
|
||||
.await?;
|
||||
|
||||
update_stage(ClientInitStage::LoadingInitData);
|
||||
init_stage_update(ClientInitStage::LoadingInitData);
|
||||
// Wait for initial sync
|
||||
let mut ping_interval = tokio::time::interval(Duration::from_secs(1));
|
||||
let ServerInit::GameSync {
|
||||
@ -401,7 +394,7 @@ impl Client {
|
||||
}
|
||||
};
|
||||
|
||||
update_stage(ClientInitStage::StartingClient);
|
||||
init_stage_update(ClientInitStage::StartingClient);
|
||||
// Spawn in a blocking thread (leaving the network thread free). This is mostly
|
||||
// useful for bots.
|
||||
let mut task = tokio::task::spawn_blocking(move || {
|
||||
@ -3007,7 +3000,7 @@ mod tests {
|
||||
username,
|
||||
password,
|
||||
|suggestion: &str| suggestion == auth_server,
|
||||
None,
|
||||
Arc::new(|_| {}),
|
||||
));
|
||||
let localisation = LocalizationHandle::load_expect("en");
|
||||
|
||||
|
@ -192,7 +192,7 @@ fn main() -> io::Result<()> {
|
||||
editable_settings,
|
||||
database_settings,
|
||||
&server_data_dir,
|
||||
None,
|
||||
Arc::new(|_| {}),
|
||||
runtime,
|
||||
)
|
||||
.expect("Failed to create server instance!");
|
||||
|
@ -118,7 +118,6 @@ use crate::{
|
||||
persistence::{DatabaseSettings, SqlLogMode},
|
||||
sys::terrain,
|
||||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use hashbrown::HashMap;
|
||||
use std::sync::RwLock;
|
||||
|
||||
@ -200,6 +199,7 @@ pub struct ChunkRequest {
|
||||
key: Vec2<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ServerInitStage {
|
||||
DbMigrations,
|
||||
DbVacuum,
|
||||
@ -230,7 +230,7 @@ impl Server {
|
||||
editable_settings: EditableSettings,
|
||||
database_settings: DatabaseSettings,
|
||||
data_dir: &std::path::Path,
|
||||
stage_report_tx: Option<Sender<ServerInitStage>>,
|
||||
report_stage: Arc<dyn Fn(ServerInitStage) + Send + Sync>,
|
||||
runtime: Arc<Runtime>,
|
||||
) -> Result<Self, Error> {
|
||||
prof_span!("Server::new");
|
||||
@ -239,12 +239,6 @@ impl Server {
|
||||
info!("Authentication is disabled");
|
||||
}
|
||||
|
||||
let report_stage = |stage: ServerInitStage| {
|
||||
if let Some(stage_report_tx) = &stage_report_tx {
|
||||
let _ = stage_report_tx.send(stage);
|
||||
}
|
||||
};
|
||||
|
||||
report_stage(ServerInitStage::DbMigrations);
|
||||
// Run pending DB migrations (if any)
|
||||
debug!("Running DB migrations...");
|
||||
@ -271,7 +265,6 @@ impl Server {
|
||||
|
||||
let pools = State::pools(GameMode::Server);
|
||||
|
||||
let world_generate_status_tx = stage_report_tx.clone();
|
||||
#[cfg(feature = "worldgen")]
|
||||
let (world, index) = World::generate(
|
||||
settings.world_seed,
|
||||
@ -286,11 +279,12 @@ impl Server {
|
||||
calendar: Some(settings.calendar_mode.calendar_now()),
|
||||
},
|
||||
&pools,
|
||||
Arc::new(move |stage| {
|
||||
if let Some(stage_report_tx) = &world_generate_status_tx {
|
||||
let _ = stage_report_tx.send(ServerInitStage::WorldGen(stage));
|
||||
}
|
||||
}),
|
||||
{
|
||||
let report_stage = Arc::clone(&report_stage);
|
||||
Arc::new(move |stage| {
|
||||
report_stage(ServerInitStage::WorldGen(stage));
|
||||
})
|
||||
},
|
||||
);
|
||||
#[cfg(not(feature = "worldgen"))]
|
||||
let (world, index) = World::generate(settings.world_seed);
|
||||
|
@ -52,7 +52,7 @@ impl ClientInit {
|
||||
) -> Self {
|
||||
let (tx, rx) = unbounded();
|
||||
let (trust_tx, trust_rx) = unbounded();
|
||||
let (init_stage_tx, init_stare_rx) = unbounded();
|
||||
let (init_stage_tx, init_stage_rx) = unbounded();
|
||||
let cancel = Arc::new(AtomicBool::new(false));
|
||||
let cancel2 = Arc::clone(&cancel);
|
||||
|
||||
@ -69,13 +69,17 @@ impl ClientInit {
|
||||
|
||||
let mut last_err = None;
|
||||
|
||||
let client_stage_reporter: Arc<dyn Fn(ClientInitStage) + Send + Sync> =
|
||||
Arc::new(move |stage| {
|
||||
let _ = init_stage_tx.send(stage);
|
||||
});
|
||||
|
||||
const FOUR_MINUTES_RETRIES: u64 = 48;
|
||||
'tries: for _ in 0..FOUR_MINUTES_RETRIES {
|
||||
if cancel2.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
let mut mismatched_server_info = None;
|
||||
let new_init_tx = init_stage_tx.clone();
|
||||
match Client::new(
|
||||
connection_args.clone(),
|
||||
Arc::clone(&runtime2),
|
||||
@ -83,7 +87,7 @@ impl ClientInit {
|
||||
&username,
|
||||
&password,
|
||||
trust_fn,
|
||||
Some(new_init_tx),
|
||||
Arc::clone(&client_stage_reporter),
|
||||
)
|
||||
.await
|
||||
{
|
||||
@ -120,7 +124,7 @@ impl ClientInit {
|
||||
|
||||
ClientInit {
|
||||
rx,
|
||||
stage_rx: init_stare_rx,
|
||||
stage_rx: init_stage_rx,
|
||||
trust_tx,
|
||||
cancel,
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ use tokio::runtime;
|
||||
use tracing::error;
|
||||
use ui::{Event as MainMenuEvent, MainMenuUi};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DetailedInitializationStage {
|
||||
// TODO: Map generation and server startup progress
|
||||
Singleplayer,
|
||||
SingleplayerServer(ServerInitStage),
|
||||
StartingMultiplayer,
|
||||
|
@ -206,11 +206,11 @@ impl Screen {
|
||||
),
|
||||
};
|
||||
|
||||
Container::new(Text::new(stage_message).size(fonts.cyri.scale(25)))
|
||||
Container::new(Text::new(stage_message).size(fonts.cyri.scale(20)))
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.padding(10)
|
||||
.align_y(Align::End)
|
||||
.align_x(Align::Start)
|
||||
.into()
|
||||
};
|
||||
|
||||
|
@ -728,6 +728,7 @@ impl MainMenuUi {
|
||||
pub fn show_info(&mut self, msg: String) { self.controls.connection_error(msg); }
|
||||
|
||||
pub fn update_stage(&mut self, stage: DetailedInitializationStage) {
|
||||
tracing::trace!(?stage, "Updating stage");
|
||||
self.controls.init_stage(stage);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,9 @@ impl SingleplayerState {
|
||||
editable_settings,
|
||||
database_settings,
|
||||
&server_data_dir,
|
||||
Some(server_stage_tx),
|
||||
Arc::new(move |init_stage| {
|
||||
let _ = server_stage_tx.send(init_stage);
|
||||
}),
|
||||
runtime,
|
||||
) {
|
||||
Ok(server) => (Some(server), Ok(())),
|
||||
|
@ -224,6 +224,7 @@ impl<'a, R: Rng> GenCtx<'a, R> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum WorldCivStage {
|
||||
/// Civilization creation, how many out of how many civilizations have been
|
||||
/// generated yet
|
||||
|
@ -87,6 +87,7 @@ pub enum Error {
|
||||
Other(String),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum WorldGenerateStage {
|
||||
WorldSimGenerate(WorldSimStage),
|
||||
WorldCivGenerate(WorldCivStage),
|
||||
|
@ -646,6 +646,7 @@ impl WorldFile {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum WorldSimStage {
|
||||
// TODO: Add more stages
|
||||
Erosion(f64),
|
||||
|
Loading…
Reference in New Issue
Block a user