Week 26: More improvements to scaling, mobile layouts, and style configurations

A screenshot of the Godot editor showing the node-structure of the About screen scene.
So many custom widgets (all the yellow ones).


tl;dr: I made a lot of improvements to GUI scaling, mobile layouts, font and style configurations, and minor console errors.


What happened last week?

Highlights

  • I made a lot of improvements to scaling, mobile layouts, font and style configurations, and minor console errors.

Laundry list

  • Created a handful of new reusable wrapper widgets, and made updates across the codebase to use these new widgets.
    • The new widgets this week:
      • ScaffolderProgressBar
      • ScaffolderSlider
      • AnimatedTextureRect
      • ScaffolderLabel
    • Remove most rect_min_sizes across the codebase, in favor of using "size_override" parameters with each of my new widgets, which gives me much better control of resizing things to match the current viewport.
    • Add new editor icons for each of the new widgets, as well as a new placeholder editor icon.
    • Default some widgets size_flags to shrink-center, and use the new ScaffolderProgressBar.
    • Refactor ScaffolderTextureButton scaling to be more consistent with the new pattern.
    • Replace old LinkButtons in data-agreement screen with new wrappers.
  • Made fonts and styles more configurable.
    • Create and use the new ScaffolderLabel widget.
      • This enables configuring font parameters synergistically between label nodes and app-config files.
    • Support configuring font-size in notification-screen params.
    • Make overlay panel styles configurable.
    • Fix some font-color regressions.
  • Created a new screen-container system.
    • This simplifies screen editing, since screen scenes no longer need to include a bunch of redundant node structure and logic.
    • Fix size/position of screen contents with the new screen-container system.
  • Made a lot of improvements to how GUIs are re-sized for mobile screens.
    • Add support for configuring different default_game_area_sizes for mobile vs PC.
    • Add support for dynamically splitting the NavBar into two rows depending on the width of the screen and the width of the header contents.
    • Add support for configuring font-size overrides on mobile.
    • Fix an issue with screen size changes on mobile-rotation.
    • Fix mouse-filters to allow scrolling-by-swipe on mobile.
    • Fix splash-screen scale on mobile.
    • Add some mobile-web and touch-device detection utilities.
      • Godot really doesn’t give any support for detecting these two features.
      • For mobile-web detection, I’m checking if we are running in _a_ browser environment, and, if so, I trigger an external JavaScript function that checks the useragent.
      • For touch-screen detection, it seems like the state of the art is really to just listen for a touch event, and only assume you are on a touch-screen device if there has been a previous touch event in the app.
    • Split-out some device-specific logic into a separate DeviceUtils script.
    • Fix bug in mobile-web check.
    • Fix some old mobile-app checks to now be mobile-device checks.
A screenshot from Momma Duck showing the main menu screen with desktop GUI scaling.
Main menu screen with desktop GUI scaling.

A screenshot from Momma Duck showing the main menu screen with mobile GUI scaling.
Main menu screen with mobile GUI scaling.

A screenshot from Momma Duck showing the settings screen with desktop GUI scaling.
Settings screen with desktop GUI scaling.

A screenshot from Momma Duck showing the settings screen with mobile GUI scaling.
Settings screen with mobile GUI scaling.
  • Fixed mostly harmless console errors/warnings that had been accumulating.
    • Fix console errors from accessing AutoLoads within editor "tool" scripts.
      • It got to the point where I couldn’t actually open Godot anymore. It would crash before letting me interact with the editor.
    • Fix a memory-leak with set_interval.
    • Add some missing return types.
    • Free possible memory leaks.
    • Fix a null reference in labeled-control items.
    • Fix an error from trying to draw a polyline with too-few vertices.
    • Did some research into a couple redundant Godot warnings relating to memory leaks when exiting the app.
      • “WARNING: cleanup: ObjectDB instances leaked at exit”
      • And “ERROR: ~List: Condition "_first != __null" is true.”
      • Apparently, this is due to a bug in how Godot’s type system handles circular references, and _might_ be fixed in 4.0?
      • It doesn’t _seem_ like this causes any actual problems for me for now.
      • It seems like the only real fix for this would be to essentially remove all type references across my codebase.
      • So I’m going to ignore this problem for now.
    • Add support for ignoring certain error patterns in the CrashReporter.
    • Fix some corrupt/stale tilemap cells.
  • Tried to debug an issue I with HTML builds inconsistently failing to start in mobile browsers.
    • This manifested as two possible error messages shown before the app would start:
      • “Function signature mismatch"
      • "Memory access out of bounds"
    • I tried exporting without debug symbols, but that didn’t seem to fix things.
    • Bizarrely, I found that if I connect my phone to use remote debugging through chrome, the issue never repros.
    • I tried exporting with different types (Threads, GDNative), but that didn’t seem to help.
    • I tried a GLES2 HTML export in case it works on mobile.
      • Still broken.
      • But it now toggles between these two error messages:
        • “Memory access out of bounds”
        • “Unreachable”
    • I tried a GLES3 HTML export without a custom shell.
      • Still broken.
    • It _sounds_ like this might be exacerbated by a bug with Godot that was introduced in a recent version, and that this might be fixed in an upcoming version?
    • Also, it sounds like WebGL apps in general don't work well in mobile browsers, and it's not just a problem with Godot. Apparently, it's just fundamentally hard for things to perform well in the relatively resource-constrained environment of a mobile browser.
    • So I think I won’t try to figure out a work-around right now.
    • I _really_ want mobile to work, since that’s half the point of the cool point-and-click gameplay that Surfacer enables, but I guess I can just make sure to release mobile apps for each of my upcoming little games, and I won’t just rely on mobile-web working out.
  • Fixed lots of scaling edge-cases to work well with the new scaling system.
  • Miscellaneous other fixes.
    • Refactor framework configuration to preload more scenes at build-time, rather than at run-time.
    • Create a better system for configuring in-screen images through Scaffolder.
    • Update all GUIs to use the new scale system.
    • Fix color and size of splash screens.
    • Refactor splash screens to re-use logic in a common parent class.
    • Fix a tween regression in accordions from recent scaling changes.
    • Fix issue with everything disappearing when dragging screen-size instead of toggling max-window.
    • Fix the small gap below the welcome-panel subheader.
    • Fix regression with ScaffolderButton shadow.
    • Fix an issue with the vertical height of the pause screen.
    • Fix an issue with Screen._on_deactivated not being called.
    • Split loading and game screens into separate screens.
    • Fix event-timing so the loading screen can display information earlier when calculating platform graphs.
    • Fix mouse-filter regression for game screen.
    • Fix bug when restarting level from settings screen.
    • Create a new CameraZoomSettingsLabeledControlItem.
    • Update all global nodes to use a consistent pattern for logging their initialization and for naming their nodes.
    • Fix some small issues with restarting from the pause screen.
    • Have the CameraZoomSettingsLabeledControlItem slider update in response to changes in camera zoom.
    • Create a new _on_app_quit framework lifecycle event.
    • Fix a mis-configuration of the error_logs_url.
    • Fix a couple regressions relating to deallocating TreeItem state.
    • Move custom HTML shell into Scaffolder.
    • Fix bug that could cause the ruler annotator to show before any other screens were ready.
    • Again fix the small gap below the welcome-panel subheader.
    • Pause music when loading platform-graphs in the web version, since apparently the web audio player can't handle the main thread being blocked that long.
    • Rename Gs.draw_utils to Gs.draw.

What's next?

  • 🎇🎆🎉 Happy Fourth of July!
  • Make some changes to Scaffolder to make things have a more pixelated, low-res look.
  • Another medium-long list of small Scaffolder bugs to fix.
  • Then I'll get back to making improvements to Surfacer and procedural navigation.


🎉 Cheers!


This is a simple icon representing my sabbatical.

Comments