Logic World Wednesdays #130: The Game Starts Up Better Now
New loading bars - Ecconia
[p]Starting the game used to take a lot of time, especially with 30 mods installed. Think of a Windows installer with its loading bar stuck at 99%. It's probably working, but it feels broken. In Logic World, there were no loading bars during startup.[/p][p]The real issue wasn't speed. It was perception. If something moves or spins, you know progress is happening and you're more patient. If nothing happens, it feels like the program froze.[/p][p]Nothing was shown because LogicWorld completed most of its initialization before rendering the first frame. That meant staring at a blank screen for more than 15 seconds.[/p][p]There were other issues as well. If you tried to close the game during startup, it kept loading anyway and only exited after finishing initialization. On Windows, you might even get the beloved and pointless "LogicWorld is not responding" popup.[/p][p]The solution is to load the game over multiple frames, which I have now finished implementing.[/p][previewyoutube][/previewyoutube][p][/p]Profiling - Ecconia
[p]I've also added a new profiler to measure what's taking up time while the game is starting. This has already allowed me to make some improvements in startup time, which you can see in the video above.[/p][p]Here's some example output from my new profiler. You can make the game save a log file with profiler output by launching the game with the new startup argument [c]--profile-startup[/c].[/p]▶ Game start[p]As you can see, the profiler allows us to measure precisely how long it takes to get between two points in the code. This system is available for modders as well, using the [c]LogicProfiler[/c] API.[/p][p]I was motivated to add the profiler by my work on making [c].lwmod[/c] files fully functional so modders can easily distribute their work as single-file drop-into-the-mods-folder packages. I had most code done, but encountered a performance regression. The game loaded even slower than before. I started optimizing slow parts, but did not achieve good results. Now that I have the profiler, I can figure out why [c].lwmod[/c] files are loading slower than folder mods, and hopefully [c].lwmod[/c] files will be fully supported soon.[/p][p][/p]
▶ Wait for first frame to finish
⏹ Wait for first frame to finish in 735ms
▶ Set up tasks
⏹ Set up tasks in 0ms
▶ Load tasks
▶ Prepare TaskControl
⏹ Prepare TaskControl in 3ms
▶ Go to Update() routine
⏹ Go to Update() routine in 52ms
▶ Task 'Setting up logging'
⏹ Task 'Setting up logging' in 8ms
▶ Task 'Initializing Dispatcher'
⏹ Task 'Initializing Dispatcher' in 2ms
▶ Task 'Loading scene 'UI_ErrorScreen''
▶ Activate scene 'UI_ErrorScreen'
💧 1ms
▶ Go to next frame
⏹ Go to next frame in 41ms
▶ Go to next frame
⏹ Go to next frame in 118ms
⏹ Activate scene 'UI_ErrorScreen' in 1ms (total 160ms)
▶ Collect tasks from scene 'UI_ErrorScreen'
⏹ Collect tasks from scene 'UI_ErrorScreen' in 3ms
▶ Prepare tasks in scene 'UI_ErrorScreen'
⏹ Prepare tasks in scene 'UI_ErrorScreen' in 0ms
▶ Process 3 scene tasks
▶ Task 'Initializing component ErrorScreen'
⏹ Task 'Initializing component ErrorScreen' in 0ms
▶ Task 'Initializing component HoverTagManager'
⏹ Task 'Initializing component HoverTagManager' in 0ms
Get the preview now!
[p]You can try the improved game startup in a new preview version we released today! Just opt into the "Public Previews" Steam beta.[/p][p]Changelog: v0.92.3 Preview 57
[p]Here are all the changes in today's preview since v0.92.2 (the current stable version).[/p][p]Game startup[/p]- [p]Added loading screen with progress bars for game startup (applies once Unity has finished loading, which takes about 5 seconds).[/p]
- [p]Fixed not being able to quit the game during startup quickly (via common window/process controls).[/p]
- [p]Game start is much more robust and will show errors in settings files as well.[/p]
- [p]Improved language loading performance by ~2.7x.[/p]
- [p]Improved settings loading performance by ~3x.[/p]
- [p]Improved debug command loading performance by ~6x.[/p]
- [p]Client startup arguments now start with two dashes [c]--[/c] instead of one dash [c]-[/c].[/p]
- [p]Added client startup argument [c]--help[/c] which prints command help on startup.[/p]
- [p]Added client command argument [c]--profile-startup[/c] which generates a profiler log file of the startup.[/p]
- [p]Startup arguments for Unity and mods must now be appended after a [c]--[/c] separator argument. Example for Unity argument [c]--screen-fullscreen[/c]: [c]./Logic_World --open-save "demo_world_official" -- --screen-fullscreen[/c].[/p]
- [p]Added [c]ClientMod.GameStartupCompleted()[/c]. This is called after the game has finished loading, but before it starts background tasks (like game loop / networking).[/p]
- [p]A new [c]LogicProfiler[/c] API is now available for measuring the execution time of your code. Currently, it only works while the game is starting up.[/p]
- [p]Improved error message if a component type is missing placing rules.[/p]
- [p]Updated engine version to Unity 6000.0.65f1.[/p]
- [p]Improved Unity physics settings to increase performance in very large worlds.[/p]
- [p]Made some code more robust when the error-screen is opened during world load.[/p]
- [p]Fixed demo world prompt causing an exception in main menu (once seen).[/p]
- [p]Fixed some DOTween warnings in console.[/p]