Technical Details
This page covers the internal architecture for developers and server owners who want to understand how F5 Boost works under the hood.
Client Architecture
The client runs several threads. The three main performance-related loops are:
Per-Frame Loop
Runs every game tick (Wait(0)) when settings are active. Only calls natives that reset every frame (they have ThisFrame or NextFrame in their name). If settings are not active (player hasn't configured anything yet), the loop sleeps for 500ms.
Natives called per frame:
SetPedDensityMultiplierThisFrameSetRandomVehicleDensityMultiplierThisFrameSetParkedVehicleDensityMultiplierThisFrameSetVehicleDensityMultiplierThisFrameSetScenarioPedDensityMultiplierThisFrameSetAmbientPedRangeMultiplierThisFrameSetAmbientVehicleRangeMultiplierThisFrameOverrideLodscaleThisFrameSuppressShockingEventsNextFrame(performance mode only)SetRainLevel(when rain/wind is disabled)SetDisableDecalRenderingThisFrame(when clear events is enabled)
Slow Tick Loop
Runs every 5 seconds. Handles cleanup operations that don't need per-frame precision:
- Blood stain removal (
ClearPedBloodDamage) - Debris cleanup (
ClearAllBrokenGlass,RemoveDecalsInRange,ClearAreaOfProjectiles,RemoveParticleFxInRange) - Fire extinguishing (
StopFireInRange) - Density toggle re-enforcement (game can reset these after loading screens)
- Cop clearing in performance mode (
ClearAreaOfCops)
FPS Counter Loop
Optional loop (controlled by Config.ShowFPSCounter). Runs every frame to count actual rendered frames. Sends the count to NUI once per second, only when the menu is open.
Ped Caching
PlayerPedId() is not called every frame. The script caches the ped handle and refreshes it every 1000ms via GetGameTimer() comparison. This avoids unnecessary native calls in the per-frame loop.
Settings Storage
KVP (Client-Side)
Settings are stored under the key fps_menu_settings using FiveM's SetResourceKvp / GetResourceKvpString. This is instant, local, and doesn't require a database. Every setting change triggers a KVP save.
On join, KVP data is loaded first. If it exists, the script applies those settings after a 3-second delay (gives the game time to fully load).
Database (Server-Side Profiles)
Profiles use MySQL through an auto-detecting bridge. The bridge checks for running database resources in this order:
- oxmysql: uses
query_async/update_asyncexports - mysql-async: uses callback-based exports with a synchronous wrapper (
while not done do Wait(0) end) - ghmattimysql: uses
executeSyncexports
The bridge waits up to 30 seconds for a database resource to start. For mysql-async specifically, it also polls is_ready() for up to 10 seconds.
Settings Merge
When settings arrive from the server (profile load, default profile, import), they go through a merge process:
- Start with a fresh copy of vanilla settings (100% quality, all effects on)
- Overlay the incoming values, but only for keys that exist in the vanilla template
- Assign the merged result as the current settings
- Apply all natives
- Save to KVP
This ensures that if a profile was saved on an older version with fewer settings, missing keys get safe defaults instead of nil.
Dispatch Disable
When Config.DisableDispatch is true, the script calls EnableDispatchService(i, false) for services 1 through 15 once on startup (after a 5-second delay). This covers all GTA dispatch types including police, ambulance, fire, and military.
One-Time vs Per-Frame Natives
It's important to understand the distinction:
Per-frame natives (must be called every tick to stay active):
- All
*ThisFrame/*NextFramenatives SetRainLevel(gets reset by weather system)SetDisableDecalRenderingThisFrame
One-time natives (called once, effect persists until changed):
CascadeShadows*functions (BoundsScale, EntityTracker, TrackerScale, AircraftMode, DynamicDepthMode, DynamicDepthValue)SetArtificialLightsState,SetArtificialLightsStateAffectsVehiclesSetWindSpeed,SetWindDirectionSetFarDrawVehiclesSetGarbageTrucks,SetRandomBoats,SetRandomTrainsSetCreateRandomCops,SetCreateRandomCopsNotOnScenariosDistantCopCarSirensSetForceVehicleTrails,SetForcePedFootstepsTracksSetReducePedModelBudget,SetReduceVehicleModelBudgetEnableDispatchService
One-time density natives are re-applied every 5 seconds in the slow tick as a safety measure, since GTA can reset them during loading screens or area transitions.
Resource Stop
When the resource is stopped, the script only resets NUI focus. Per-frame natives stop automatically since the loops stop running. One-time natives persist until the server restarts or another script changes them. This is standard FiveM behavior.