FPS Limiter API
Control game FPS to reduce CPU usage while keeping the in-game FPS counter showing the original value and ticks stable at 50/s.
Global name: fps_limiter
fps_limiter:set_fps(target_fps: number)
Set the FPS limit. Values <= 0 or >= 60 restore the default. Frame counter spoofing is automatically enabled so the in-game FPS display still shows 60.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
target_fps | number | Yes | Desired FPS (e.g. 15, 30). Pass 0 or 60 to restore default. |
fps_limiter:fps() -> number
Get the current FPS limit.
Returns:
number- Current FPS (60 if not throttled)
fps_limiter:restore()
Restore original FPS limits and disable frame counter spoofing.
fps_limiter:engine_captured() -> boolean
Check if the engine object has been captured yet. The engine object is captured on the first rendered frame after DLL injection.
Returns:
boolean-trueif the engine object pointer is available
-- Check engine is ready
if fps_limiter:engine_captured() then
-- Throttle to 15fps (~70% CPU savings)
fps_limiter:set_fps(15)
logger:info("FPS: " .. fps_limiter:fps()) -- prints 15
sleep(10000)
-- Restore to normal
fps_limiter:restore()
end
- FPS is automatically restored when the DLL detaches
- The in-game FPS counter will show ~60 even when throttled
- Game ticks remain at 50/s (the game batches ticks automatically)
- Can also be controlled from the desktop UI via the FPS buttons in the Tools toolbar