Skip to main content

Performance Optimization

Optimizing your vehicle mods for better performance.

Understanding Performance Impact

Polygon Count

Lower polygon count = better performance

LOD System (Level of Detail):

  • LOD0 - Highest detail (up to 50m) → 30,000-50,000 polygons
  • LOD1 - Medium detail (50m-100m) → 15,000-25,000 polygons
  • LOD2 - Low detail (100m-200m) → 5,000-10,000 polygons
  • LOD3 - Distant (200m+) → 1,000-3,000 polygons

Example impact:

Vehicle without LODs: 50,000 polygons always -> 30 percent FPS loss
Same vehicle with LODs:
- Near: 50,000 polygons (full detail)
- Far: 2,000 polygons (minimal)
- Result: 10 percent FPS loss

Texture Optimization

Texture Size Impact:

SizeMemoryLoading
512x5121 MBUnder 1ms
1024x10244 MB2ms
2048x204816 MB8ms
4096x409664 MB32ms

Best Practice:

  • Use 1024x or 2048x for main textures
  • Use 512x for detail maps
  • Compress using DXT5 format

Draw Calls

Fewer draw calls = better performance

Multiple materials: 5 draw calls
Combined material: 1 draw call
Result: 4x faster rendering

Optimization Techniques

1. Geometry Optimization

Before: 45,000 polygons
- Remove hidden faces: -10,000
- Decimate mesh: -8,000
After: 27,000 polygons (40% reduction)

Process:

  1. Remove internal faces (not visible)
  2. Use decimate modifier (Blender)
  3. Merge nearby vertices
  4. Remove duplicate geometry
  5. Test in-game frequently

2. Texture Optimization

Before:
- Diffuse: 2048x2048 (8MB)
- Normal: 2048x2048 (8MB)
- Specular: 2048x2048 (8MB)
Total: 24MB

After:
- Diffuse: 1024x1024 (2MB)
- Normal: 1024x1024 (2MB)
- Specular: 512x512 (0.5MB)
Total: 4.5MB (81% reduction)

3. Material Atlasing

Combine multiple small textures:

Before: 10 separate 512x512 textures (10MB)
After: 1 combined 2048x2048 atlas (4MB)
Result: 60% reduction + faster loading

4. LOD Configuration

<Distances>
<LOD0>0-50</LOD0> <!-- Full detail nearby -->
<LOD1>50-150</LOD1> <!-- Medium detail mid-range -->
<LOD2>150-300</LOD2> <!-- Low detail far -->
<LOD3>300+</LOD3> <!-- Minimal detail very far -->
</Distances>

Handling Optimization

Physics Simplification

<!-- Complex handling -->
<fSuspensionForce>1.5</fSuspensionForce>
<fSuspensionCompDamp>0.25</fSuspensionCompDamp>
<fSuspensionReboundDamp>0.22</fSuspensionReboundDamp>

<!-- Simplified (similar feel, less CPU) -->
<fSuspensionForce>1.2</fSuspensionForce>
<fSuspensionCompDamp>0.15</fSuspensionCompDamp>
<fSuspensionReboundDamp>0.12</fSuspensionReboundDamp>

Weight Reduction

Lower mass = faster calculations:

<!-- Heavy vehicle -->
<fMass>2500.0</fMass>

<!-- Optimized weight -->
<fMass>1800.0</fMass> <!-- Still feels realistic -->

Network Optimization

File Size

Keep mod sizes small:

Vehicle mod breakdown:
- Models (.yft): 15MB
- Textures (.ytd): 20MB
- Audio (.awc): 8MB
- Config (.xml/.meta): 0.1MB
Total: 43MB

Optimized:
- Models: 8MB (LODs + decimation)
- Textures: 6MB (reduced resolution + compression)
- Audio: 4MB (compressed)
- Config: 0.1MB
Total: 18MB (58% reduction)

Streaming

Load assets efficiently:

-- Bad: Loads all immediately
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end

-- Good: Async loading
RequestModelAsync(modelHash)
while not HasModelLoaded(modelHash) do
Wait(10) -- Don't spam CPU
end

Testing Performance

FPS Monitoring

local frameCount = 0
local lastTime = GetGameTimer()

Citizen.CreateThread(function()
while true do
Wait(1000)
local currentTime = GetGameTimer()
local fps = frameCount * 1000 / (currentTime - lastTime)

TriggerEvent('chat:addMessage', {
args = {"FPS", tostring(math.floor(fps))}
})

frameCount = 0
lastTime = GetGameTimer()
end
end)

Memory Profiling

Monitor resource usage:

-- Check model memory
print("Model loaded: " .. GetModelHeapSize(modelHash))

-- Monitor vehicle memory
local vehicle = GetVehiclePedIsIn(PlayerPedId())
print("Vehicle memory: " .. GetVehicleHeapSize(vehicle))

Optimization Checklist

  • LOD models created for all assets
  • Textures compressed (max 2048x2048)
  • Polygon count reduced to minimum viable
  • Materials combined where possible
  • Handling physics simplified
  • Vehicle mass realistic
  • File size < 50MB total
  • FPS impact < 5% in testing
  • All features work correctly
  • No visual glitches at distance

Performance Benchmarks

SystemExpected Impact
High-end PCLess than 1 percent FPS loss
Mid-range PC3-5 percent FPS loss
Low-end PC8-15 percent FPS loss

Target Sizes

AssetRecommended Size
Single vehicle30-50MB
Vehicle pack (5 cars)150-250MB
Full mod suite500MB+

Advanced Optimization

Baking Lightmaps

Pre-calculate lighting:

Dynamic lighting: 25% GPU load
Baked lighting: 2% GPU load
Result: 12x faster rendering

Instancing

Reuse geometry:

Unique vehicles: 5
Shared wheels: 1 wheel instance × 5 = 5 wheels
Memory saved: 80% on wheel data

Compression Formats

Use appropriate compression:

Uncompressed: 64MB texture
DXT1 (no alpha): 16MB
DXT5 (with alpha): 32MB
BC6H (HDR): 32MB
Result: 75% memory reduction

Pro Tips

  1. Profile first - Identify bottlenecks
  2. Optimize iteratively - One change at a time
  3. Test on lower-end hardware - Ensures compatibility
  4. Use LOD system - Essential for performance
  5. Compress textures - Biggest impact for size
  6. Reduce polygon count - Second biggest impact
  7. Monitor FPS - Track actual performance
  8. Keep backups - Before optimizing

Optimization Tools

  • Blender - LOD generation, decimation
  • Substance Painter - Texture optimization
  • Texture Baker - Lightmap baking
  • CodeWalker - Model analysis
  • GPU-Z - GPU monitoring
  • HWiNFO - System monitoring

Performance optimization is key to making vehicles that work well across all player systems!

📺 Live Stream