Controlling NPCs

Started by
3 comments, last by Ozymandias43 16 years, 11 months ago
Hi, My Client is really coming along and its time to bring the server app up to par. My present dilemma is what mechanism to use to control the NPCs (non player charaters) on the clients. Obviously the server is managing their behaviour and informing interested clients, who are then performing the correct movement and animation. Should my server: 1) send out control messages in realtime, ignoring lag to some degree 2) cycle through objects, updating each at preset intervals, sending packets of strings of commands - move here, wait 1 second, move there, wait 2 seconds etc. Period of update could be related to in game variable, such as alert level. 3) Send control messages saying - move, arriving here at this time, compensating for lag to some degree 4) something else....! Its not a super fast pace FPS, but sometimes the pace cranks up in battles. Most of the time, NPCs are fairly placid, going about their business.... Some are frankly lazy, I expected more from them.... :) What do you think? Thanks Simon
Advertisement
1) or 3) would work best out of those options, I think.
enum Bool { True, False, FileNotFound };
Is there a reason why the client should care whether a given moving foreign object is an NPC or another player? Why would you want to handle their movement differently?
Valid point.... I just meant not the players character.

That is moved in direct response to the players input, giving a lag-less illusion.

Sending snapshots from a client is a bad idea right? too much trust in the client... So whats best in order to keep objects and servers informed?

CLIENT->SERVER
Send messages to server when client changes movement? eg:

ROLL_START
ROLL_STOP
YAW_START
ACCELERATE_START
ACCELERATE_STOP
YAW_STOP

Therefore trying to keep a version of a players position, etc, on the server. The server is always right and will bring incorrect clients into line, in theory!

SERVER->CLIENT
Inform client(s) of new position, rotation and speed of object(s). Use blending to force client from dead-reckoned position to actual server position.

Thoughts appreciated
Well, if you want the NPCs do behave laglessly, you could perhaps reproduce their logic on the client side and basically do client-side prediction with them, too.

This topic is closed to new replies.

Advertisement