Should the client own ai's network ownership?

I have noticed that when i leave the network ownership to the server that it seems you get caught further away than you should. i know that has been an issue for years. my game is singleplayer so i don’t really care about security that much.

1 Like

If your game is single-player, I suggest setting ownership to the client AND handling all pathfinding/movement/effects on the client. The main reason you would set the ownership to the server is so other players can’t destroy or mess with the NPC from their client. Or you might be to lazy to make a server-to-client replication system lol.

Either way, doing everything on the client is 100% recommended in your case especially since you aren’t too worried about security. However, if you do plan on making it multiplayer → I would recommend only using the server to verify and change the location of the NPC’s CFrames → occasionally send that data to every client → have every client render the NPC and move it according to the position the server specified.

^ The above method would make everything flow nicely but one downside (depending on how you handle the replication from server-to-client) is unsynchronized actions. I highly suggest working on a system like this from the get-go. Even if you’re dealing with 1 - 2 NPCs, eventually, you may need a system like this! However, if you’re working with a few NPCs (1 - 10), and the above method seems a little too daunting then having everything on the server shouldn’t be an issue!

3 Likes

something that i find stupid is that roblox servers still suck at that. it’s been years and they’ve been to lazy to improve. like some other online games even set the client’s owner network to the server and they work fine, but on roblox you get delay.

1 Like

Yea, unfortunately, they do. Most likely because it’s either too hard to establish reliable servers in every country/city or it’s too costly to maintain (as Roblox does let us devs host servers for free). That’s why you have to use a combination of both the client (for responsiveness and effects) and the server (for security and verification).

Luckily for you, your game is single-player. In your case, I would say forget security and do as much as you can on the client. It will ensure top-tier responsiveness (even for the laggiest players). Why forget security? Well, all the exploiter would be doing is ruining the fun for himself. If they want to cheat their way past the game, so be it. Their lose!

I still think you should brainstorm or attempt a demo version of a more “multiplayer” based NPC. I guarantee sometime in the future you’re going to want to implement NPC’s with multiple people :slight_smile:

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.