Sign in to follow this  
Ripiz

Client/Server AI handling

Recommended Posts

I kinda hit wall when I need to program how to handle Monsters and NPCs. At the moment I plan to have big map, without warps, so client loading all the NPCs and Monster is kinda out of question, also I don't want to update client everytime I add or remove one monster. I've been suggested to simply load monsters when new area is entered, but I won't have any warps, so I it's not my case. I though of keeping list of visible monsters to each player (server side), then just add or remove monsters from list as player moves, and visible monsters change, as well sending add/remove packet to client, but that sounds like a lot memory and CPU usage on server side. Maybe anyone could suggest how to handle all this? Thank you in advance. P.S. Sorry if I didn't explain things clearly, I'm unsure how to explain.

Share this post


Link to post
Share on other sites
Not sure what your world layout is, but one simple solution would be to partition it into a grid of large squares. As entities move, they are removed from/added to the correct square. Server figures out what squares the player could conceivably see and sends updates on just those entities.

Without more detail it's hard to recommend specific techniques. Is the world 2d or 3d? How is it divided? How far can players see? How much info is in an update? Etc. More importantly, until you know what your bottleneck is, you can't know what optimizations will work best.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this