-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
feat: Adds optimized dynamic/static layout gumps #1652
Conversation
@kamronbatman I've just refactor the StaticGump as discussed yesterday. The converted static gump with dynamic strings is "PetResurrectGump" |
a70cd06
to
5fa464d
Compare
Before we can merge this, I think we can simplify the concepts. Our goal is:
The first with static strings can use a dynamic strings builder, but also cache the strings themselves. |
fa8135f
to
83300c9
Compare
d929875
to
2668a7c
Compare
6b7be72
to
e940b09
Compare
a9b4d87
to
38f10d1
Compare
0f81a2c
to
ac96b56
Compare
f41e4ea
to
c638ec4
Compare
Important
In the future, gumps that come with ModernUO will be converted to this new API where it makes sense. Please reach out in discord if you have questions or need help!
Note
DEVELOPER NOTE
We will not deprecate the legacy (RunUO) gump API. If you want to continue to use it, go for it!
New Gump API
We are pleased to release a new API that is faster, allocates nearly zero memory, and still feels very similar to the original API. The API is broken into 3 types of gumps, dynamic, static with placeholders, and static without placeholders.
Dynamic Gumps
These gumps will inherit
DynamicGump
and are meant for gumps that have a dynamic layout. This includes specifying dynamic arguments to HtmlLocalized entries.Example
Static Gumps
Static gumps are those where the function to the build the layout is called only once and cached forever. They can optionally have placeholders. These placeholders allow the developer to specify the string values later, dynamically in a
BuildStrings
method on the gump. If a gump does not have any placeholders, the string entries will also be cached forever.Example
Benchmarks
To make sure we were going in the right direction and not wasting time, we took copious benchmarks. Here are the final benchmarks for a really simple gump.
Note:
Non-Breaking Changes
Gumps/Legacy
.Gump
, which now inheritsBaseGump
Special Thanks
Thank you to @stefanomerotta for considerable contributions/benchmarking/testing to make this effort a reality! We collectively went through over 10 iterations, but it is finally ready.
Closes #1640