Рет қаралды 44
A couple huge optimizations later, and this is possible... With this many NPCs I only get ~20 fps, but quite impressive considering every entity is checking collision and all attacks are ''ray-casted''.
With 'normal' NPC numbers, frames went from a highly-volatile 450/sec(highly affected by collision load), to almost double that in a low-load situation. These numbers might seem quite excessive, but gives a lot of room for graphics/audio/networking/etc.
I finally got around to writing everything that's needed to break up the entire list of collidable objects into a grid, and each entity then checks only it's local spot within the grid. Previously, with 1500 NPCs, 1500 static world objects, and the 800 or so world boundary colliders - if everything was checking against all others it was 5.7 million checks a frame... It's now closer to maybe 300 thousand with the same numbers. ~3.7 billion checks a frame if it were 60k NPCs without the optimization...