Added debug output.

This commit is contained in:
hiker 2017-06-08 09:17:34 +10:00
parent f772c090ec
commit 08cd8bf235
4 changed files with 19 additions and 16 deletions

View File

@ -103,9 +103,9 @@ void PlayerController::resetInputState()
*/
bool PlayerController::action(PlayerAction action, int value, bool dry_run)
{
Log::info("action", "t %f action %d value %d val_l %d val_r %d val %d",
Log::info("action", "t %f action %d value %d val_l %d val_r %d val %d dryrun %d",
World::getWorld()->getTime(), action, value,
m_steer_val_l, m_steer_val_r, m_steer_val);
m_steer_val_l, m_steer_val_r, m_steer_val, dry_run);
/** If dry_run (parameter) is true, this macro tests if this action would
* trigger a state change in the specified variable (without actually
@ -302,7 +302,7 @@ void PlayerController::steer(float dt, int steer_val)
if(steer>0.0f) steer=0.0f;
} // if steer<=0.0f
} // no key is pressed
Log::info("steer", "Setting steer to %f", steer);
m_controls->setSteer(std::min(1.0f, std::max(-1.0f, steer)) );
} // steer

View File

@ -1248,22 +1248,21 @@ void Kart::update(float dt)
);
#endif
#undef DEBUG_TO_COMPARE_KART_PHYSICS
#define DEBUG_TO_COMPARE_KART_PHYSICS
#ifdef DEBUG_TO_COMPARE_KART_PHYSICS
// This information is useful when comparing kart physics, e.g. to
// see top speed, acceleration (i.e. time to top speed) etc.
Log::verbose("physics", "%s t %f %f xyz %f %f %f v %f %f %f sk %f %d %f %f %f st %f %f",
Log::verbose("physics", "%s t %f %f xyz(9-11) %f %f %f v(13-15) %f %f %f steerf(17) %f maxangle(19) %f speed(21) %f steering(23-24) %f %f clock %lf",
getIdent().c_str(),
World::getWorld()->getTime(), dt,
getXYZ().getX(), getXYZ().getY(), getXYZ().getZ(),
getVelocity().getX(), getVelocity().getY(), getVelocity().getZ(),
m_skidding->getSkidFactor(),
m_skidding->getSkidState(),
m_skidding->getSteeringFraction(),
getMaxSteerAngle(),
m_speed,
m_vehicle->getWheelInfo(0).m_steering,
m_vehicle->getWheelInfo(1).m_steering
getVelocity().getX(), getVelocity().getY(), getVelocity().getZ(), //13,14,15
m_skidding->getSteeringFraction(), //19
getMaxSteerAngle(), //20
m_speed, //21
m_vehicle->getWheelInfo(0).m_steering, //23
m_vehicle->getWheelInfo(1).m_steering, //24
StkTime::getRealTime()
);
#endif

View File

@ -628,7 +628,8 @@ void ClientLobby::startGame(Event* event)
// Triggers the world finite state machine to go from WAIT_FOR_SERVER_PHASE
// to READY_PHASE.
World::getWorld()->setReadyToRace();
Log::info("ClientLobby", "Starting new game");
Log::info("ClientLobby", "Starting new game at %lf",
StkTime::getRealTime());
} // startGame
//-----------------------------------------------------------------------------
@ -644,6 +645,8 @@ void ClientLobby::startingRaceNow()
NetworkString *ns = getNetworkString(2);
ns->addUInt8(LE_STARTED_RACE);
sendToServer(ns, /*reliable*/true);
Log::verbose("ClientLobby", "StartingRaceNow at %lf",
StkTime::getRealTime());
terminateLatencyProtocol();
} // startingRaceNow

View File

@ -128,11 +128,12 @@ void GameProtocol::controllerAction(int kart_id, PlayerAction action,
World::getWorld()->getTime() );
Log::info("GameProtocol", "Action at %f: %d value %d",
World::getWorld()->getTime(), action, value);
World::getWorld()->getTime(), action,
action==PlayerAction::PA_STEER_RIGHT ? -value : value);
} // controllerAction
// ----------------------------------------------------------------------------
/** Called when a controller event is receiver - either on the server from
/** Called when a controller event is received - either on the server from
* a client, or on a client from the server. It sorts the event into the
* RewindManager's network event queue. The server will also send this
* event immediately to all clients (except to the original sender).