-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow pre-rendering character sets in DynamicFont to avoid stalls during gameplay #2021
Comments
Would it be better to instead have a new resource type that is a serialized prerendered character set? |
I'm not sure about that, as it makes it quite harder for users to reason about DynamicFont usage. If you have to swap the resource to use a prerendered DynamicFont, it's not quite as transparent and easy to use as merely toggling a property. The prerendering should happen when the font is first used. It's not a problem if it happens while the game is running, but it must be done "all at once" as early as possible, rather than rendering new characters as they appear on screen. |
This comment has been minimized.
This comment has been minimized.
Implemented in godotengine/godot#51908 |
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
DynamicFont can introduce stalls during gameplay when new characters are used, since they need to be rendered on the fly. These stalls are mainly noticeable on mobile/web platforms due to their slow CPUs.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Allow pre-rendering character sets in a DynamicFont to avoid stalls during gameplay. This moves the rendering cost to happen before anything in the game has started, which is arguably less annoying than stalls during gameplay.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add a "Prerender Character Set" enum property to DynamicFont with the following values:
0-9
+ common symbols:+ - * / : ; ,
)Wider character sets allow for better language support at the cost of longer prerendering times and higher memory usage.
The old BitmapFont importer in Godot 2.1 also offered similar functionality to restrict character sets (including a way to reference a text file that contained the characters you wanted to render).
A question that remains is: Should we enable prerendering by default? I'd argue we should use ASCII prerendering by default (since it's very likely to help against jank in almost all situations), but there may be reasons not to do so.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Thanks to godotengine/godot#40491 (cc @RandomShaper), it can be worked around decently, but I'd still argue this should be a built-in feature to ensure a jank-free experience out of the box.
Is there a reason why this should be core and not an add-on in the asset library?
See above.
The text was updated successfully, but these errors were encountered: