Configuration ​
Everything is in Config.Colshape in shared/config.lua. It is a shared file, loaded on the client and the server.
Every option can also be changed live in np_admin (Editable in np_admin). On GTAV Enhanced np_colshape is
idle and none of these options are used.
Config.Colshape = {
debug = false,
maxShapes = 4096,
maxPolygonPoints = 256,
cellSize = 64.0,
maxCellsPerShape = 256,
idleIntervalMs = 1000,
adaptive = false,
adaptiveMaxSpeed = 60.0,
adaptiveMaxDelayMs = 2000,
server = { fastIntervalMs = 200, slowIntervalMs = 500, sliceSize = 200 },
client = { fastIntervalMs = 100, slowIntervalMs = 500, sliceSize = 200 },
debugDrawDistance = 150.0,
debugServerRadius = 300.0,
debugMaxServerShapes = 256,
debugListSize = 12,
}
General ​
| Key | Default | Description |
|---|---|---|
debug |
false |
Extra console output: rejected shapes, export errors, shapes removed when their owner stops |
maxShapes |
4096 |
Most shapes at once per side. The client and the server count separately. A Create* past the limit returns -1 |
maxPolygonPoints |
256 |
Most points of one polygon. A longer polygon returns -1 |
Broad phase ​
| Key | Default | Description |
|---|---|---|
cellSize |
64.0 |
Shapes are indexed by their 2D bounding box into a grid of cells this wide (metres). An entity is only tested exactly against the shapes of its own cell |
maxCellsPerShape |
256 |
A shape covering more cells than this is not indexed. It sits on a short list that every entity is tested against (huge circles, map-wide polygons) |
idleIntervalMs |
1000 |
Loop delay while no shape exists and no entity is inside one |
A change to cellSize or maxCellsPerShape re-indexes the existing shapes on the next pass.
Adaptive rechecks ​
Off by default. It trades detection latency for fewer native calls on servers with many NPCs, vehicles and objects far from any shape.
| Key | Default | Description |
|---|---|---|
adaptive |
false |
Non-player entities far from every shape are looked at less often |
adaptiveMaxSpeed |
60.0 |
Assumed top speed (m/s) used to work out when such an entity could reach a shape |
adaptiveMaxDelayMs |
2000 |
Longest time an entity is skipped |
With adaptive = true, an entity that is not a player, has nothing in its grid cell and is inside no shape is looked
at again only when it could have reached the nearest shape's bounding box at adaptiveMaxSpeed, and at least every
adaptiveMaxDelayMs. The distance is a lower bound from the grid: shapes in the 8 neighbouring cells and on the wide
list are measured, anything farther is at least one cell away.
- Players are never deferred.
- Creating a shape (or re-indexing the grid) ends every deferral, so a new shape still gets its enters on the next pass.
- A deferral also ends when its handle misses a pass of its pool.
- The cost: something faster than
adaptiveMaxSpeed(a jet, a teleport) can enter up toadaptiveMaxDelayMslate, or cross a shape without an event.
getStats().deferred counts the deferrals (np_colshape exports). The effect in the benchmark is
on Overview → Performance.
Loops ​
Peds (players included) and vehicles run in the fast loop. Objects, and on the client pickups, run in the
slow loop. A pass yields a frame after sliceSize entities.
| Key | Default | Description |
|---|---|---|
server.fastIntervalMs |
200 |
Server: peds and vehicles |
server.slowIntervalMs |
500 |
Server: objects |
server.sliceSize |
200 |
Server: entities checked before the loop yields a frame |
client.fastIntervalMs |
100 |
Client: peds and vehicles |
client.slowIntervalMs |
500 |
Client: objects and pickups |
client.sliceSize |
200 |
Client: entities checked before the loop yields a frame |
Shorter intervals catch fast vehicles crossing thin shapes, at more cost per second. See Behaviour → Timing.
Debug overlay ​
Used by /colshapes.
| Key | Default | Description |
|---|---|---|
debugDrawDistance |
150.0 |
Client shapes within this distance (metres) are drawn |
debugServerRadius |
300.0 |
/colshapes server: server shapes within this radius of the player are sent |
debugMaxServerShapes |
256 |
/colshapes server: most server shapes sent, nearest first |
debugListSize |
12 |
Rows in the on-screen list of the nearest shapes. 0 lists none |
Editable in np_admin ​
When np_admin is running, all 19 options can be changed in its Resource settings page
(Colshapes). shared/config.lua stays the default; np_admin stores only the values you override. Without np_admin,
the config is used as written.
| Category | Fields | Scope |
|---|---|---|
| General | debug, cellSize (8 to 1024 m, step 8), maxCellsPerShape (1 to 65536), idleIntervalMs (100 to 10000 ms) |
Shared |
| General | adaptive, adaptiveMaxSpeed (1 to 500 m/s), adaptiveMaxDelayMs (100 to 10000 ms, step 100) |
Shared |
| Limits | maxShapes (1 to 65536), maxPolygonPoints (3 to 4096) |
Shared |
| Server loop | server.fastIntervalMs, server.slowIntervalMs (0 to 10000 ms, step 50), server.sliceSize (10 to 10000) |
Server |
| Client loop | client.fastIntervalMs, client.slowIntervalMs (0 to 10000 ms, step 50), client.sliceSize (10 to 10000) |
Shared |
| Debug | debugDrawDistance (10 to 1000 m), debugListSize (0 to 50) |
Shared |
| Debug | debugServerRadius (10 to 5000 m), debugMaxServerShapes (1 to 4096) |
Server |
Every field applies live. A new cellSize or maxCellsPerShape re-indexes the existing shapes on the next pass. Lowering maxShapes or
maxPolygonPoints only affects shapes created after the change.