Hunting the 8ms Budget: Stripping Godot 4 for Performance
Running a game at 60 FPS gives you 16.6 milliseconds per frame. At 120 FPS on a high-refresh phone screen, that window drops to 8.3 milliseconds.
Wirefrag is out on Android first (with our desktop Steam build coming later), so all of our performance work had to start on phones. On a desktop PC with active cooling, you can brute-force past a lot of engine overhead. On a phone, running the chip near full load heats the chassis up within minutes. Once thermal throttling kicks in, the OS cuts clock speeds in half and your frame rate tanks.
To hold a steady 120 FPS on Android without overheating the phone, we budgeted roughly 3 milliseconds for physics and 3 milliseconds for rendering, leaving the remaining third of every frame idle as thermal headroom. Designing around mobile heat limits first also meant our desktop build runs fast on everything from old integrated laptops to high-refresh monitors.
Godot 4 defaults to the Forward+ Vulkan renderer with a general-purpose 3D setup: dynamic shadow maps, reflection probes, and multi-pass post-processing. For a retro arena shooter built out of unshaded neon lines, almost all of that is dead weight—so our first move was switching to Godot 4’s Compatibility renderer (OpenGL ES 3.0 on mobile, OpenGL 3.3 on desktop) and stripping everything else we did not need.
Why Android Is Locked to Its VSync Refresh Ceiling
In PC shooters, players often disable VSync and run at 300 FPS on a 144Hz monitor to shave off a millisecond of input latency.
Android’s display pipeline does not work that way. The system compositor (SurfaceFlinger) enforces hardware VSync at the OS level. Whether a phone has a 60Hz, 90Hz, or 120Hz panel, the display hardware will never show more frames per second than its physical refresh rate.
Pushing uncapped frames past VSync on a phone actively hurts performance. Every frame rendered above the panel’s refresh rate gets discarded by the compositor before reaching the screen, while the extra GPU load turns battery power straight into heat. Within two minutes, the phone hits its thermal limit, downclocks the GPU, and drops your visible frame rate below 60 FPS.
We keep VSync locked on Android as a hard ceiling and hide the VSync toggle on mobile. Android players can pick a frame rate cap (30, 60, 90, 120 FPS, or Uncapped up to their screen’s native VSync limit) depending on whether they want full 120Hz speed or lower battery drain. On desktop builds, where cooling is not an issue, we expose full VSync options (Enabled, Adaptive, or Disabled) and uncapped frame rates.
Stripping the Default Engine Overhead
Our biggest early gains came from switching renderers and turning off Godot subsystems we did not need:
- Switching from Forward+ (Vulkan) to the Compatibility renderer (OpenGL ES 3.0 on Android, OpenGL 3.3 on desktop) eliminated clustered-lighting and Vulkan render-pass overhead we never used, cutting driver CPU time and keeping frame rates fast on budget mobile GPUs and legacy integrated laptops.
- Disabling positional shadow and reflection atlases freed 60 to 120 MB of VRAM right away and stopped mobile Tile-Based Deferred Rendering GPUs (Adreno and Mali) from flushing tile caches to system RAM between shadow passes.
- Halting Godot’s unused
PhysicsServer2DandNavigationServer2Dat startup stopped empty 2D broadphase ticks, saving nearly 0.5 ms of CPU time per frame on budget phone chips. - Switching from ACES filmic tonemapping to linear color and dropping the 2D UI canvas backbuffer from 16-bit HDR to 8-bit SDR kept our cyan and magenta lines sharp while cutting mobile memory bandwidth pressure by about 35 percent.
- Stripping 3D software occluder meshes (
ArrayOccluder3D) from imported TrenchBroom maps eliminated an 18.5 ms single-threaded CPU software rasterizer spike. Because our unshaded wireframe geometry is tiny, letting native GPU frustum culling handle visibility was ten times faster.
Shader Warmup, Object Pools, and Bypassing the Scene Tree
A single 10-millisecond hitch mid-fight is enough to eat a jump input or throw off a rail shot.
To prevent shader compilation stutter when a weapon fires for the first time, our map loader spawns a hidden camera behind the black loading screen and renders one frame containing every weapon mesh, projectile, beam, decal, and bot material. Every OpenGL ES shader pipeline is compiled and cached before the match starts.
During combat, we never allocate memory in the physics loop. Raycast query objects are created once at startup and updated in place, and multiplayer lag-compensation history writes directly into flat circular buffers. All ragdoll debris rigs, projectiles, scorch decals, and beams are recycled through fixed-size object pools.
Profiling those pools early on exposed two traps:
The 41,000 Collision Pair Trap
We initially parked all of our inactive pooled projectiles and debris segments together at the world origin (0, 0, 0) while waiting to be spawned. Even though they were hidden, the physics broadphase still checked if they overlapped each other, generating 41,673 collision pairs every tick in a ten-bot match. Stripping collision layers and shapes from pooled objects while idle cut active broadphase pairs by 98 percent (down to 845). We also switched bot stair climbing to native separation rays so bots run zero swept test_move() checks per frame.
Talking Directly to the Rendering Server
For high-frequency effects like explosions, shockwave rings, tracer swarms, and up to 256 active projectiles, updating hundreds of Node3D scene-tree nodes costs noticeable CPU time on mobile. Instead, our projectile and VFX managers register raw resource IDs (RIDs) and batched MultiMesh buffers directly with Godot’s low-level RenderingServer. Third-person bot weapon meshes are also built lazily on demand only when a bot equips that weapon.
Budgeting Raycasts and Single-Pass Neon Glow
In a chaotic match, bot perception and 3D spatial audio can spike frame times if every bot and sound source fires raycasts on the same tick. We put hard per-frame caps on both.
All bots share a global limit of 8 line-of-sight raycasts per physics frame across the entire match, using a flat 2D spatial grid for fast neighbor lookups and lower polling rates at long distance. Active 3D sounds are split into four round-robin batches (max 16 wall-occlusion raycasts per tick). If neither the listener nor the sound source has moved by at least a meter since the last check, the raycast is skipped and the cached muffle filter is reused, cutting audio raycasts by up to 75 percent.
For visuals, full-screen bloom looks great on desktop PCs (where we leave hardware glow on), but multi-pass blur chains force mobile tile-based GPUs to flush tile memory repeatedly. On Android, we disable post-process glow and create the neon halo in a render_mode unshaded shader (skipping PBR lighting math entirely) by nudging wireframe edges slightly outward along their view-space angles with a smooth screen-space falloff. That gives us glowing lines in a single forward draw pass.
Android-Specific Engineering: Lifecycle, JNI, and OS Throttling
Shipping on Android first meant solving several platform quirks that do not exist on PC:
Android 16 Allocator Safety, JNI Caching, and R8 Shrinking
Android 15 and 16 enforce strict native heap checks in jemalloc. Quitting the engine while raw RenderingServer RIDs from our projectile and explosion pools were still attached to the 3D scenario caused native teardown aborts. We added a pre-shutdown cleanup step that detaches and frees all singleton rendering RIDs first, hid the desktop “Exit” button on mobile, and routed the Android Back button on the main menu to background the app (moveTaskToBack).
For players using Bluetooth controllers (Xbox, DualSense, Razer Kishi) or USB-C mice and keyboards, we cache Android’s InputDevice JNI class wrappers once at startup and only probe when device connections change. That avoids per-frame JNI garbage while filtering out internal phone hardware (touch digitizers, gyroscopes, fingerprint sensors, and passive USB-C hubs) that masquerade as joysticks. We also lock the window into sticky edge-to-edge immersive mode so edge swipes never pull down system bars mid-fight, and pair pure GDScript (avoiding .NET runtime bloat) with Android R8 full-mode shrinking to keep the app bundle under 45 MB.
Auto-Calibration and Catching Silent OS Throttling
On first launch, Wirefrag benchmarks the device to set 3D render scale, MSAA, limb LOD distance, decal caps, and audio reverb DSP. Because Android often parks half of its big.LITTLE CPU cores on the menu screen, sometimes returns 0 for RAM in sandboxed builds, and injects trademark tokens like (TM) into GPU names (Adreno (TM) 830), we normalize the adapter string and check a flagship GPU list first so high-end phones always unlock native 120Hz presets. A rolling watchdog also steps Godot’s decoupled scaling_3d_scale down in 5 percent increments if frame rates dip during heavy fights, keeping the 2D HUD razor-sharp at native resolution.
Even optimized code cannot override OS power caps. During testing, players occasionally wondered why their 120Hz phone was stuck at 60 FPS, not realizing they had Android Battery Saver on, Android 12’s Game Dashboard set to Battery mode, or a Huawei/Honor device running in its default “Balanced” profile (which secretly caps GPU clocks and refresh rate unless “Performance Mode” is enabled in system settings). Our startup check queries Android’s power and thermal services for power-saving modes, OEM clock limits, critical low battery (under 15 percent unplugged), and active thermal throttling, showing a dismissible banner on the main menu when a device setting is holding performance back.
Benchmarks and Hardware Targets
Here is where the numbers landed in our 10-bot stress test on The Edge (an imported TrenchBroom arena with 950 brushes, 11,242 collision faces, and 160,000 triangles), followed by our target performance matrix across Android and desktop tiers.
10-Bot Arena Stress Test (Before vs. After Stripping)
| Subsystem / Metric | Unoptimized Baseline | Stripped & Pooled Engine |
|---|---|---|
| Active Physics Collision Pairs | 41,673 pairs | 845 pairs (-98%) |
| CPU Software Occluder Rasterizer | 18.5 ms / frame | 0.0 ms (Stripped) |
Bot Swept test_move() Checks |
50 to 80 / frame | 0 / frame (Native rays) |
| Draw Calls (10 to 16 Combatants) | 280+ draw calls | 25 to 65 draw calls |
| Mobile System RAM / GPU VRAM | ~380 MB / ~210 MB | < 220 MB RAM / < 80 MB VRAM |
| Android App Bundle (AAB) & Boot | ~115 MB / 3.4s boot | < 45 MB / ~1.1s cold boot |
Target Hardware Performance Matrix
| Hardware Tier | Representative Devices / Chips | Preset & 3D Scale | Target Framerate |
|---|---|---|---|
| Android Budget | Galaxy A14, Moto G Power, Redmi Note (Helio G85, Snapdragon 680, Mali-G52) | Low (50% to 65% 3D scale, 1080p HUD, Reverb bypassed) | 60 FPS Locked (60Hz VSync) |
| Android Mid-Range | Galaxy A54, Pixel 7a, Nothing Phone 1 (Snapdragon 778G, Dimensity 8100, Tensor G2) | Medium (75% 3D scale, 1080p HUD) | 60 to 90 FPS (Up to 90Hz VSync) |
| Android Flagship | Galaxy S23/S24/S25, ROG Phone 8, Xiaomi 14 (Snapdragon 8 Gen 2/3/Elite, Dimensity 9300+) | High / Ultra (100% Native 1080p/1440p + 2x MSAA) | 120 FPS Locked (120Hz VSync, <= 8.3ms) |
| Desktop Integrated / Legacy | Intel UHD 620, Iris Xe, Vega 8, 2015-2016 Intel MacBook Pro | Low to Medium (50% to 75% scale, Bloom off) | 60 to 90 FPS (Up from 15-25 FPS) |
| Handhelds & Apple Silicon | Steam Deck, ROG Ally, MacBook Air/Pro (M1 through M4) | High to Ultra (100% Native + 2x/4x MSAA, Bloom on) | 90 to 120 FPS (ProMotion / Handheld) |
| Desktop Discrete GPU | GTX 1660, RTX 3060/4060/4080, RX 6600/7800 XT | High to Ultra (100% Native 1080p to 4K + 4x MSAA) | 144 to 360+ FPS (Uncapped) |
In our next post, we will look at our custom map pipeline: how we embrace pure brush geometry, import raw TrenchBroom files directly on Android and desktop, and sandbox community maps for safe sharing.