Component of Modern Game: game objects
dynamic game object: objects with action and animations
static game object: houses, static model
environment: terrain, vegetation, sky (could still be interactive)
other game objects: like trigger
Game objects have properties (variables) and behavior (functions)
Note that
UObject
is not game object, but a wrapper onC
's object.
There are two types of ticking.
They are usually asynchronous and can be spread to more than two threads.
Traditionally, we code interaction within game objects to search for related game objects and call game objects functions.
But event-based interactions are easier to code with.
However, if event is sent to every game objects, then the cost is high.
However, if the grid is crowded, then the cost is still high.
Bounding Volume Hierarchies: merging bounding box of objects.
when we throw away objects that is outside of our canvas.
when we calculate collision
You need to choose a scene management method that is suit to your game. For enclosed scene with minimal objects that can move, BSP or Potentially Visible Sets (PVS) would be good. However, BVH has low cost and is more suited for moving scenes.
Imagine a situration: in one tick
One way physics can interact with animation is that we blend physical impact (slam face) with animated impact so that the interaction looks natural.
In above example, the animation will change multiple time in one tick.
The order of ticks matters! Imagine a situration: using event system, in the same tick, a character is shot by a bullet and the character is healed by his teammate. Since those two events were sent in the same tick, it is ambiguous whether after the tick, the character is alive. If we only process event in order of reception time, then deterministic input (sending the command in the same tick) can result nondeterministic result (died or alive).
pre-tick
, post-tick
is used to solve the order of events.
Recursive dependency will result in game lag within one or two ticks.
Things to keep in mind in design:
you send event based on the same tick as current tick or the previous tick
do you wait for one tick to react when an object received an event or do it in the same tick
When a tick takes too long to compute:
Logic will run 1 tick ahead. Swaping frame buffer delays the display another tick... So we need to optimize how many ticks has passed from input to screen outcome. There are many tricks to put into minimize tick delay to optimize hitfeel.
Table of Content