So in my game there’s basically a system where players can queue and create rooms with other players. Once a room is created they get sent to the room (on the same server) and they have to fight hoards of enemies. These enemies are really simple, they find the nearest target and chase/attack them depending on the distance.
I want the enemies to be as optimized as possible, because worst case scenario a server could have 6 rooms with 40 enemies each, which leads to 240 enemies being moved on the server.
What i decided to go with is having the enemies only be rendered on the clients inside the room. Which leads me to this post, I’m not too sure how to go about this.
One idea i might go with is:
- Creating a hitbox part on the server
- Rendering/Loading the NPC on the client and welding it to the part.
- Setting the network ownership of the part to the target client.
- Handling the parts movement (chasing the player) on the server(?)
My thought process for this is basically, if the npc’s model and network ownership is on the client then that might take SOME strain off the server, while keeping everything in sync for each player.
I know this process is extremely flawed. For example exploiters can move the npcs where ever they want due to the network ownership being on the client. But hey, that’s the reason i’m making this post.
I’m not asking to be spoon fed, just a nod in the right direction is enough. So please send some suggestions if you have any!