ModernUO/Projects/UOContent/Spells
Kamron Batman 65532ea887
feat: Adds optimized dynamic/static layout gumps (#1652)
# 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.

## 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.

## 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:
* The majority of creating a gump is compressing the layout and the strings. Compressing each section takes ~6,000ns (12us total).

```cs
| Method                         | Mean         | Error        | StdDev       | Median       | Ratio | RatioSD | Gen0   | Allocated | Alloc Ratio |
|------------------------------- |-------------:|-------------:|-------------:|-------------:|------:|--------:|-------:|----------:|------------:|
| OldGump                        | 13,308.29 ns | 1,059.695 ns | 1,883.608 ns | 14,330.72 ns | 1.000 |    0.00 | 0.1526 |    2400 B |        1.00 |
| DynamicLayoutGump              | 13,357.86 ns |   129.144 ns |   226.185 ns | 13,323.60 ns | 1.029 |    0.17 |      - |      48 B |        0.02 |
| StaticLayoutDynamicStringsGump |  6,653.10 ns |    81.815 ns |   143.292 ns |  6,617.45 ns | 0.514 |    0.09 |      - |      40 B |        0.02 |
| StaticLayoutGump               |     86.33 ns |     0.760 ns |     1.350 ns |     86.07 ns | 0.007 |    0.00 | 0.0020 |      32 B |        0.01 |
```

# Non-Breaking Changes
* All gump components in the core have been moved to `Gumps/Legacy`.
* All legacy gumps will still inherit `Gump`, which now inherits `BaseGump`

# 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.
2024-04-25 22:40:30 -07:00
..
Base fix: Fixes Feint so it properly reduces damage (#1657) 2024-01-11 00:01:52 -08:00
Bushido fix: Fixes poison field duration, cleans up skill calculations and poison calculations (#1582) 2023-11-04 12:32:54 -07:00
Chivalry fix: Fixes poison field duration, cleans up skill calculations and poison calculations (#1582) 2023-11-04 12:32:54 -07:00
Eighth fix: Changes Map.Sector.Mobiles to link list & Fixes various related crash bugs (#1553) 2023-10-29 22:42:46 -07:00
Fifth fix: Fixes PainSpike, ManaVampire, Evil Omen, and Curse (#1622) 2023-12-02 09:59:42 -08:00
First fix: Fixes bad localized messages (#1722) 2024-04-05 20:28:15 -07:00
Fourth fix: Fixes PainSpike, ManaVampire, Evil Omen, and Curse (#1622) 2023-12-02 09:59:42 -08:00
Gargoyle/SpellDefinitions fix: Cleans up more spells (#1122) 2022-07-16 23:15:45 -07:00
Mysticism fix: Changes Map.Sector.Mobiles to link list & Fixes various related crash bugs (#1553) 2023-10-29 22:42:46 -07:00
Necromancy fix: Optimizes gump relay info (Prep for Static Gumps) (#1698) 2024-03-07 20:54:53 -08:00
Ninjitsu feat: Adds optimized dynamic/static layout gumps (#1652) 2024-04-25 22:40:30 -07:00
Second fix: Fixes poison field duration, cleans up skill calculations and poison calculations (#1582) 2023-11-04 12:32:54 -07:00
Seventh fix: Fixes PainSpike, ManaVampire, Evil Omen, and Curse (#1622) 2023-12-02 09:59:42 -08:00
Sixth fix: Fixes poison field duration, cleans up skill calculations and poison calculations (#1582) 2023-11-04 12:32:54 -07:00
Spellweaving fix: Refactors getting static tiles to use enumerators (#1611) 2023-11-26 09:39:46 -08:00
Targeting fix: Cleans up some comments and spell code (#1120) 2022-07-16 19:45:41 -07:00
Third fix: Fixes poison field duration, cleans up skill calculations and poison calculations (#1582) 2023-11-04 12:32:54 -07:00
Initializer.cs fix: Adds Cleansing Winds Spell (#1126) 2022-07-17 07:49:55 -07:00
Reagent.cs Formats UO Content (#201) 2020-08-27 18:30:38 -07:00
UnsummonTimer.cs fix: Codegens talismans - Fixes memory leak (#1469) 2023-08-23 22:41:48 -07:00