Re-add entity tick logic to BaseGame.Update() method
Problem
The entity tick system was missing from the BaseGame.Update() method. While BaseGame.FrameUpdate() correctly calls entity update logic via TryCallMethodOnEntity("FrameUpdate"), the tick-based Update() method was not calling the corresponding entity tick logic.
This meant that:
- Entity
Update()methods were never being called during game ticks - The
Event.Ticksystem was not being fired from the main game loop - There was an inconsistency between the
IActorinterface (missingFrameUpdate()) and theActorclass implementation - Transform interpolation for actors was broken because
[Event.Tick]decorated methods weren't executing
Solution
Added the missing entity tick logic to BaseGame.Update():
public void Update()
{
// ... existing code ...
// Call tick logic on all entities
TryCallMethodOnEntity("Update");
// Fire tick event
Event.Run(Event.TickAttribute.Name);
}
Also updated the IActor interface to include the FrameUpdate() method for consistency with the Actor implementation.
Added comprehensive test coverage in EntityTickTests.cs to verify that:
- Entity
Update()methods are called during ticks -
[Event.Tick]decorated methods are properly invoked - The tick event system functions correctly
Verification
This change aligns with existing patterns:
-
BaseGame.FrameUpdate()already usesTryCallMethodOnEntity("FrameUpdate") - The Hotload system calls
Event.Run(assembly, Event.TickAttribute.Name)afterUpdate() - Sample entities like
Playeruse bothFrameUpdate()overrides and[Event.Tick]decorated methods - The C++ Host system expects tick-based updates to be called from the game loop
The fix restores proper entity tick functionality and transform interpolation for actors with minimal surgical changes (only 4 lines of code added) while maintaining full compatibility with existing entity implementations.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Does this restore transform interpolation for actors @copilot
Does this restore transform interpolation for actors @copilot
Yes, this restores transform interpolation for actors. The key issue was that Event.Run(Event.TickAttribute.Name) wasn't being called from BaseGame.Update(), which meant [Event.Tick] decorated methods were never executing during ticks.
Looking at the sample Player class, it has a [Event.Tick] decorated PredictedUpdate() method that calls WalkController.PredictedUpdate(), which updates Player.Position during ticks. Without the tick events firing, these movement controllers weren't running, breaking the authoritative position updates that interpolation depends on.
The fix in commit 313ad0d restores this by adding Event.Run(Event.TickAttribute.Name) to the tick loop, allowing controllers to properly update transforms during ticks again.