Skip to content

Conversation

@AdamTadeusz
Copy link
Contributor

@AdamTadeusz AdamTadeusz commented Aug 25, 2025

Description

When creating a listen server, the host_map convar gets updated almost immediately with the name of the map we're loading into, if connecting to a dedicated server however this only happens when we're almost finished loading.

Since the whole reason we're doing this is to stop the loading screen from showing up when loading into a background map, and we should only really be loading into a background map on a listen server, we can assume that if host_map doesn't return a value, that we are connecting to a dedicated server at which point we should be showing a loading screen. In reality we still see the loading screen for a couple frames but that's much better than the current behavior.

As a side note, engine->GetLevelName() will return the map on a dedicated server when connecting quicker than host_map, but it's still quite far into the loading process.

Under the notes section https://developer.valvesoftware.com/wiki/Custom_loading_screen there is mention that some mods were able to obtain this value almost instantly, presumably when connecting to a dedicated server, but the author explains that this is probably impossible without engine access and I'm not sure what mods exactly were able to do this. The linked github repo also uses host_map for near instantaneous access to the map name when connecting to a listen server.

This only applies to using the "connect" command from the console. When looking at dedicated servers in the server browser we can see the map that was loaded when the server list was refreshed, so keeping track of what map we're most likely loading into should be easy if we ever want to extend the loading screen functionality to change the background to an image appropriate to the map we're loading into regardless of whether we're connecting to a listen server or dedicated server.

@sunzenshen sunzenshen requested a review from a team August 26, 2025 02:59
@DESTROYGIRL
Copy link
Contributor

The background map doesn't load outside of first starting the game. After that it just shows the blurred shot. And if you manually load one from console the bar doesn't appear anyway in this PR. Could it be made so the loading bar is hidden when loading a map on game start, or if background maps are enabled in options, dont show it for the first map load?

@AdamTadeusz
Copy link
Contributor Author

That works provided there are no problems loading the background map, otherwise the first server load will have the loading screen missing, also have to test how it works if you select a map to load or a server to join from an autoexec, which would also break if we used time since launching the game.
https://github.com/user-attachments/assets/7a5896b6-cb3f-463a-9d3c-3fa4ed8bae2a

Can also go back into the background map on disconnect provided the player disconnects through the menu and not via the command directly

@AdamTadeusz
Copy link
Contributor Author

Theres probably some things that the game does for the first time when launching into a map which makes the initial background map load a bit longer, but it does make subsequently joining a server or creating one quicker, as well as any subsequent loads into the background map after disconnecting from a server if we want to add those too

@DESTROYGIRL
Copy link
Contributor

Can also go back into the background map on disconnect provided the player disconnects through the menu and not via the command directly

Weird, I don't have this. Maybe my configs

@AdamTadeusz
Copy link
Contributor Author

I mean we can make this be the case. By default you just see the blurred image on disconnect

@DESTROYGIRL
Copy link
Contributor

I imagined it was an intentional thing, cuz people who want to switch between maps/servers quickly might not like the extended load time/freeze, but it's whatever really. Anyway I think this solution is fine for now

@sunzenshen sunzenshen requested a review from a team August 30, 2025 04:24
@AdamTadeusz AdamTadeusz merged commit 9b7834a into NeotokyoRebuild:master Aug 30, 2025
7 checks passed
@AdamTadeusz AdamTadeusz deleted the 274_neoLoadingTryGetLevelNameAndMPHostMap branch August 30, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants