wxyz-abcd/node-haxball

Some events occur multiple times

Closed this issue · 1 comments

These events all happen inside game loop and they occur around 3-10 times whenever they are trying to occur only once.

  • onInputChange
  • onPlayerBallKick
  • onTeamGoal
  • onKickOff
  • collision events
    Need to find a robust way of handling this. It is wrong to use a boolean to check old occurrance here, because some of these events might even happen simultenously. Maybe that's why basro decided not to expose the collision events, because it looks hard to get this to work correctly. We will see.

Event logic happens in 2 different places. The first is T.C(1), where the original physics engine is running one step at a time. The second one is inside Sf function, the extrapolation logic. The solution was to filter the extrapolated object, and use only the original object. Basro created lots of callbacks for this. I commented them out before, but now I see that the solution was in front of me the whole time. Events are running perfectly now.