ModernUO/Projects/Server
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
..
Buffers feat: Adds optimized dynamic/static layout gumps (#1652) 2024-04-25 22:40:30 -07:00
Client fix: Removes support for v4 Client and old gump packet. (#1739) 2024-04-24 19:39:37 -07:00
Collections fix: Fixes pooled ref collections dispose on defaults (#1638) 2023-12-15 13:46:52 -08:00
Comparers chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Configuration feat: Adds configurable skill and stat gain (#1489) 2023-10-14 12:02:36 -07:00
Console fix: Fixes unresponsive console input (#1720) 2024-04-05 15:07:43 -07:00
ContextMenus fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Diagnostics fix: Fixes PainSpike, ManaVampire, Evil Omen, and Curse (#1622) 2023-12-02 09:59:42 -08:00
Events feat: Moves TcpServer to another thread. Rewrites Firewall (#1660) 2024-01-20 14:25:12 -08:00
Exceptions chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
GarbageCollection fix: Adds Gen2 callback for each STArrayPool (#971) 2022-03-26 13:57:42 -07:00
Geometry fix: Changes Map.Sector.Items to link list. (#1547) 2023-10-16 20:51:02 -07:00
Gumps feat: Adds optimized dynamic/static layout gumps (#1652) 2024-04-25 22:40:30 -07:00
Items fix: Fixes max items serializatio n issue (#1728) 2024-04-12 14:11:58 -07:00
Json fix: Fixes codegenned spawners and adds RunUO spawner import support (#1682) 2024-02-17 10:46:55 -08:00
Localization fix: Simplifies create food and localizes. Fixes localization fallback (#1721) 2024-04-05 19:45:42 -07:00
Logging chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Maps fix: Fixes iterating with multiple multis in a sector (#1706) 2024-03-10 11:35:57 -07:00
Menus fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Migrations fix: Adds missing migration files. (#1642) 2023-12-20 13:02:01 -08:00
Mobiles feat: Adds optimized dynamic/static layout gumps (#1652) 2024-04-25 22:40:30 -07:00
Network feat: Adds optimized dynamic/static layout gumps (#1652) 2024-04-25 22:40:30 -07:00
PropertyList chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Random fix: Cleans up code with feeding pets and adds batch coin flips random check (#1717) 2024-04-04 15:09:15 -07:00
Regions fix: Fixes region duplicates (#1684) 2024-02-18 12:01:16 -08:00
Serialization feat: Adds console commands (#1714) 2024-03-30 09:40:43 -07:00
Targeting Adds hue support to StaticTile (#1321) 2023-01-21 11:19:11 -08:00
Text fix: Adds required changes for Advanced Search feature (#1650) 2023-12-28 18:16:58 -08:00
TileMatrix fix: Fixes wrong sector shift for tilematrix iteration (#1623) 2023-12-01 18:09:26 -06:00
Timer chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
TimeZones fix: Fixes order of execution with AutoSave and TZ (#1665) 2024-01-24 17:17:45 -08:00
Utilities fix: Adds support for ROS to HashUtility (#1740) 2024-04-25 00:42:10 -07:00
World feat: Adds console commands (#1714) 2024-03-30 09:40:43 -07:00
AssemblyHandler.cs fix: Fixes spawner timer deserialization, decimal deserialization, and adds potion keg reverse lookup (#1711) 2024-03-28 13:34:12 -07:00
Attributes.cs fix: Fixes unresponsive console input (#1720) 2024-04-05 15:07:43 -07:00
CityInfo.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Commands.cs fix: Fixes codegenned spawners and adds RunUO spawner import support (#1682) 2024-02-17 10:46:55 -08:00
Effects.cs fix: Adds GetClients to map iterators (#1574) 2023-10-30 18:49:00 -07:00
EventLoopTasks.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
ExpansionInfo.cs feat: Adds KR/EC client versions (No actual support yet). (#1506) 2023-09-18 23:53:18 -07:00
Guild.cs fix: Fixes serialization threading, moves world save to end of loop, and eliminates Parallel.ForEach. (#1530) 2023-10-03 00:42:49 -07:00
HuePicker.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
IAccount.cs fix: Reverts GetAccount to use IAccount. Adds IAccount to serialization. (#1565) 2023-10-25 19:17:57 -07:00
IEntity.cs fix: Fixes map iterators for Items (#1564) 2023-10-26 17:49:15 -07:00
Interfaces.cs fix: Fixes casting by sending ParalyzeFlag to client while animating (#1397) 2023-04-27 23:12:07 -07:00
KeywordList.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Main.cs fix: Fixes unresponsive console input (#1720) 2024-04-05 15:07:43 -07:00
MessageType.cs fix: Moves the rest of the Incoming packets (#1338) 2023-02-10 22:59:36 -08:00
Module.cs fix: Fixes sending packets and sidesteps a major issue with stackalloc and PGO in .NET 8 (#1607) 2023-11-21 12:18:20 -08:00
MultiData.cs fix: Refactors getting static tiles to use enumerators (#1611) 2023-11-26 09:39:46 -08:00
MUO.ico Adds MUO Logo (#52) 2019-09-12 13:13:13 -07:00
Party.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Poison.cs fix: Adds ISpanParsable and fixes command conditionals (#1241) 2022-11-12 00:26:02 -08:00
Prompt.cs fix: Cleans up core code (#1187) 2022-10-10 21:47:08 -07:00
Race.cs fix: Fixes TryParse for Race (#1244) 2022-11-12 00:31:25 -08:00
SecureTrade.cs fix: Update LabelTo, SendMessage, etc to Interpolated Strings (#1283) 2022-11-28 19:58:12 -08:00
Serial.cs chore: Updates copyright (#1448) 2023-08-09 09:09:26 -07:00
Server.csproj fix: Adds missing migration files. (#1642) 2023-12-20 13:02:01 -08:00
Skills.cs feat: Adds configurable skill and stat gain (#1489) 2023-10-14 12:02:36 -07:00
TileData.cs fix: Cleans up FindItems and removes allocations (#1516) 2023-09-28 22:20:36 -07:00
TileList.cs fix: Refactors getting static tiles to use enumerators (#1611) 2023-11-26 09:39:46 -08:00