feat(core): Phase 1 Complete - State Bag Migration & Legacy Bridge#1770
Closed
shadowcoder8 wants to merge 1 commit intoesx-framework:mainfrom
Closed
feat(core): Phase 1 Complete - State Bag Migration & Legacy Bridge#1770shadowcoder8 wants to merge 1 commit intoesx-framework:mainfrom
shadowcoder8 wants to merge 1 commit intoesx-framework:mainfrom
Conversation
- Implemented O(1) Inventory Hash Map in xPlayer (server) - Added State Bag replication for Job, Accounts, Inventory, and Group - Created client/modules/bridge.lua (The Emulator) to fire legacy events from State changes - Added 'esx_loaded' State Bag check to prevent Race Conditions during login - Implemented Initial State Force Trigger in Bridge to ensure HUD population on spawn - Added 60KB Payload Safety Check to State Bag setters - Updated fxmanifest.lua to include new bridge module
Author
|
testing is not 100 % completed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1: Core State Bag Migration & Legacy Bridge
Here is the completed Pull Request documentation for the Phase 1 Modernization.
Description
This PR implements a comprehensive modernization of the es_extended core data architecture. It transitions the primary data flow from legacy Server->Client Network Events to a State Bag driven system (OneSync).
Key Features:
Motivation
Performance (O(N) -> O(1)): Legacy ESX used arrays for inventory, meaning checking if a player had an item required looping through the entire inventory (O(N)). The new Hash Map allows instant access (O(1)), significantly reducing CPU time on high-pop servers.
Network Optimization: Previously, updating a job or money required a targeted TriggerClientEvent . Now, we simply update the State Bag. OneSync handles the replication efficiently, reducing custom network traffic.
The "Empty HUD" Bug: Legacy HUDs often failed to load on spawn because the client event arrived before the UI was ready. The new Initial State Force Trigger ensures that as soon as the player loads, the Bridge forces a local update, guaranteeing the HUD is populated.
Implementation Details
Usage Example
New Modern Access (Recommended):
Legacy Access (Still Supported via Bridge):
PR Checklist