5

Forgetting Tick

In this chapter we are going to explore the topic of tick (an event or process that is called every frame), why using it can cause frame-rate issues for our game projects, and two approaches to building systems without using tick, reducing the impact of systems on the CPU. We will consider the example of a guard tower in an RTS game, with a searchlight rotating back and forth. If the player’s unit is seen by the searchlight, it will stop its rotation. We will start with the Update pattern introduced in the previous chapter and iteratively improve from there, reducing our reliance on the Update pattern by using Timers, Timelines, and event-driven solutions instead. At each step, we will measure code efficiency, using execution ...

Get Game Development Patterns with Unreal Engine 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.