Inhibit Input

erre
erre
Hi,

In our game, when a goal is detected we want to wait some seconds and then reset characters and ball positions.
When we do this, we also disable all input for characters.

Unfourtunately, when we move all positions, input coming from previous frames is applied and characters are moved before the new kick off.

(Reset and kick off always occurs in safe tick)

Is there a way to "inhibit" input? Something like:

TrueSyncManager.InhibitInput();
that do something like this:


TrueSyncManager::InhibitInput()
{
m_InputEnabled = false;
}
.
.
.
TrueSyncManager::OnStepUpdate()
{
.
.
.
if ( i_AllInputData != null )
{
for (int index = 0; index < i_AllInputData.Lenght; ++index)
{
InputData inputData = i_AllInputData[index];

if (m_BehavioursPerPlayer.ContainsKey ( inputData.ownerId ))
{
TrueSyncInput.CurrentSimulationData = (m_InputEnabled) ? inputData : null;
.
.
.
}
}
}
}

Actually the problem with this solution is that if CurrentSimulationData is null and anyone try to call:

TrueSyncInput.Get ( byte ) ;

the game throw an exception. Is it possible to return a default value instead?
Or do you have planned any workaround for this?

Thank you.

Best regards,
Andrea.

P.S. Obviously InhibitInput function should be call just in safe tick frame.

Comments

  • Hello @erre,

    Did you try to send a "stop" message on TrueSyncInput? You could use that to reset the position then send some "start" message to start the game again. I think you undertood what I mean, did you try something like that? ( you should avoid change much the TrueSyncManager )