A NPC system i heavily enhanced from dvn warfare

After my disappointed view in DVN Warfare for doing a terrible job at rendering NPCs with the cap only at 40 FPS, it’s time for enhancement that i move them all to clients

So i had the urge to make a game that plays like serious sam 4 or 3 and decided to get my hands a try on doing it, completely moving from server to client with additional changes of a structure for my NPC system, rendering on client as many people said rends to save network data usage drastically and this works but what im here was to make it so i can run all NPCs with FPS improved as possible as it can be.

How was NPC handled from DVN Warfare??

The way it’s handled in my game was rendering it on a server that every traditional games use it, structuring in OOP was never pain in terms of scripting things but for performance, it tends to get slower and slower, everytime an NPC fires, my FPS drops around 10-20 which is bad considering i already had a throttle which reduces an overworked module states

here’s how it was before

Yes even after you’re hidden, they will still cause a massive performance reduction

The fix

I completely thrown out the OOP ways and moved to ECS letting it run without requiring modules each spawns and instead querying the components each frames, i picked matter instead of JECS as it’s preferred but JECS is drastically faster as it handles more entity, passed through 2k (more than Matter as of today)

The way Matter works is you have components that stores each data in it and once you store them in a components, you can then query through components to get it’s data, basically it works like OOP but fast as hell as ECS is designed for that!

with my NPC rendered on the client, i have to optimize it’s model that causes it to stutter and pathfinding to reduce amount of works it did along with more common methods that i don’t wanna list cuz that’s a lot,…,.,.,…
Yesterday before the optimization i managed to run them at 19FPS with 100 NPCs rendered, The maximum it holds were around 80 NPCs before drained to almost 10 FPS which is a good start but personally for me it isn’t enough.

though there’s still an issue with what I’m doing here and most of it is about performance for each NPCs to run, currently if they’re colliding with each others, they’ll also reduce FPS, i still don’t have a way to fix it rather than trying to space out NPCs, random speed works in this case, for now I’m trying to do it similar to this open source npc system which i copied to test and it ran 100+ efficiently at 60FPS

1 Like

This NPC system looks great! Nice job on it! How long did it take you to enhance it?

about 2 weeks and a half to make this work, components and loop are the only painful parts to manage here