fix: Avoid a couple cases where no NUIManager would cause trouble. #4919
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This seemingly fixes a case where you can't host the game headlessly if you have modules active with
UISkinFormat
assets ! Which is probably a bit quirky. Since there's no longer aNUIManager
available in theContext
when you're running headlessly we really shouldn't attempt to use it during initialization. There may still be other cases where this could factor in.Additionally I caught an exception being swallowed and a weird game state being entered in the case where you fail to establish the game host due to for instance already having the port in use. Previously that would freak out and fail to create a NUI popup informing the user which isn't very helpful when trying to start a headless server. Now it logs an error and promptly terminates the game - if headed it'll still fall back to single player, although I'm not sure if that's actually sensible.
With that fixed you now get a good error in the logs. You still get the CrashReporter starting, which is kinda weird. Maybe we lack that flag when starting from Gradle, but what if you're running from a game binary on a server? CR should be disabled if headless, period. Haven't looked into fixing that, I had to juggle this tricky fix alongside toddler, baby feeding, and angry neighbors showing up to complain about our plants dripping water onto their balcony stairs below us. Yup.
Bonus: filters out typical virtual NICs from listening - this may be more controversial but I'd like to leave it as a GFI exercise to turn it configurable via
config.cfg
- I suspect it is hugely unlikely to cause trouble in the meantime. Even if somebody tries to host a game server inside VirtualBox I figure that would end up reachable via some bridged network like the host OS? Dunno. But this speeds up "listening to all the NICs!" from more than 30 seconds for me to just a few. Could ignore a couple more still. This is how my startup ends up looking: