Game Development Community

Gap between Server Unit and Client Unit

by Kevin · in RTS Starter Kit · 04/05/2005 (2:04 pm) · 3 replies

Hi,

I'm trying to add steering behaviour to the RTSUnit.
I have the force calculated in Movement code in the processTick function:
else if(mMoveState == ModeMove)
{
    Point3F posXY(location.x, location.y, 0);
    Point3F goalXY(mMoveDestination.x, mMoveDestination.y, 0);
    Point3F goalDelta = goalXY - posXY;
    //------------------------------------ steering here
    if(isUseSteering){				 
	m_pSteering->setTarget( mMoveDestination);
	m_pSteering->calculate();
	Point3F* force = &m_pSteering->force();
	goalDelta.set(force->x, force->y, force->z);

       }

I can see that the server object is doing just what I wanted but the Client unit is way off.

Could someone please help me?

#1
04/06/2005 (12:44 pm)
Are you sure that the client is also performing those calculations? It might be that isUseSteering isn't getting set properly, or that the codebranch isn't run on the client.
#2
04/06/2005 (1:00 pm)
I've been thinking about this one in the background as well, and as Ben said, there is probably a breakdown in what the client is doing vs what the server is doing.

I would have thought off the top of my head that the normal position updates would be networking the changes directly to any clients that have this unit in scope, but it's possible that you aren't updating the PositionMask, or that the script is being run on the client as well as the server, and therefore getting funky double applications of the steering behaviour...really hard to tell without digging deeply into what you are doing.

Could you define "steering behaviour" a little more stringently, so we can have a better feel for what you are trying to accomplish? If all you are doing is trying to have the player only able to turn a certain portion of an angle for facing, and then only move forward, then this is a -big- re-write to how processTick works for RTSUnits, and you are going to have to implement everything from the processTick itself, to the appropriate fields and pack/unpack methods.
#3
04/06/2005 (5:18 pm)
Thank you guys for replying.

I have the isUseSteering in the pack and unpack methods so I'm pretty sure the client gets to calculate the same method.

I have been thinking about another way of doing this.
Can I just use the calculations in the server and just pass the steering force to the client?
I know that the client is suppose to perform its own simulation but can I just pass the steering force faster?

@ Stephen
For the steering behaviour, I'm trying calculate a force and use it move the RTSunit. I'm using the stuff from the book "Programming game AI by Example".