FIT CTU
Adam Vesecký
vesecky.adam@gmail.com
Course Summary
Computer Application
Computer game
Emergence
Progression
Gameplay
Mechanics
System
Level
Simulation
Bot
Agent
Mob
NPC
Mechanics
Story
Aesthetics
Technology
Goals
Space
Objects
Actions
Rules










Initialization process
Game Loop process

Fixed time step
Variable time step
Adaptive time step
Object A reads previous state of Object B and Object B reads previous state of Object C
Scene Graph
Scene Manager
Detects input events from devices
Atomic events
Compound events
Special events



Receiving the state of the device
Devices
Dead zone
Normalization
Normalized input
Custom allocators
Bucket allocator
Heap allocator
Level loading
Air locks
World streams
Scripted callbacks
Scripted components
Script-driven game
Script-driven engine

Everything that is specific to a game (and not to an engine).
Any piece of data which is in a format that can be used by the game engine.
All visual elements that are presented to the user and protected by copyright.
JPEG
PNG
TGA
SVG




Types
Formats

Diffuse

Displacement

Normal

Volumetric

Tileable

Sprite atlas
Sprite
Spritesheet
Sprite atlas


Game model is a model of a domain in which the simulated world takes place.
Entity
Attribute
Property
Component
System
By modifying the container object's state
By direct calls
By using a message broker
Unicast
Multicast
Broadcast

implementation


Individual units

Battle formation
| 1 | const getPlayer(scene: Scene) => scene.findObjectByName('player'); |
| 2 | |
| 3 | const getAllUnits(scene: Scene) => scene.findObjectsByTag('unit_basic'); |
| 4 | |
| 5 | const getAllUnitsWithinRadius(scene: Scene, pos: Vector, radius: number) => { |
| 6 | return getAllUnits(scene).filter(unit => unit.pos.distance(pos) <= radius); |
| 7 | } |
| 8 | |
| 9 | const getAllExits(scene: Scene) => { |
| 10 | const doors = scene.findObjectsByTag('door'); |
| 11 | return doors.filter(door => !door.locked); |
| 12 | } |

| 1 | // stateless, the creature will jump each frame |
| 2 | updateCreature() { |
| 3 | if(eventSystem.isPressed(KeyCode.UP)) { |
| 4 | this.creature.jump(); |
| 5 | } |
| 6 | } |
| 7 | |
| 8 | // introduction of a state |
| 9 | updateCreature() { |
| 10 | if(eventSystem.isPressed(KeyCode.UP) && this.creature.state !== STATE_JUMPING) { |
| 11 | this.creature.changeState(STATE_JUMPING); |
| 12 | this.creature.jump(); |
| 13 | } |
| 14 | } |

| 1 | class Builder { |
| 2 | private _position: Vector; |
| 3 | private _scale: Vector; |
| 4 | |
| 5 | position(pos: Vector) { |
| 6 | this.position = pos; |
| 7 | return this; |
| 8 | } |
| 9 | |
| 10 | scale(scale: Vector) { |
| 11 | this.scale = scale; |
| 12 | return this; |
| 13 | } |
| 14 | |
| 15 | build() { |
| 16 | return new GameObject(this._position, this._scale); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | new Builder().position(new Vector(12, 54)).scale(new Vector(2, 1)).build(); |

Prefabs in Unity
| 1 | class UnitFactory { |
| 2 | |
| 3 | private pikemanBuilder: Builder; // preconfigured to build pikemans |
| 4 | private musketeerBuilder: Builder; // preconfigured to build musketeers |
| 5 | private archerBuilder: Builder; // preconfigured to build archers |
| 6 | |
| 7 | public spawnPikeman(position: Vector, faction: FactionType): GameObject { |
| 8 | return this.pikeman.position(position).faction(faction).build(); |
| 9 | } |
| 10 | |
| 11 | public spawnMusketeer(position: Vector, faction: FactionType): GameObject { |
| 12 | return this.musketeerBuilder.position(position).faction(faction).build(); |
| 13 | } |
| 14 | |
| 15 | public spawnArcher(position: Vector, faction: FactionType): GameObject { |
| 16 | return this.archerBuilder.position(position).faction(faction).build(); |
| 17 | } |
| 18 | } |

Assets
Asset categories
Dynamics
Features
Attenuation
Occlusion
Obstruction

Uniform distribution
Gaussian (normal) distribution
Uniform distribution
Gaussian distribution
Seed
Loot
Spinning
Rarity Slotting
Random encounter

Perlin Noise

Simplex Noise

Worley Noise
Addition and subtraction
Vector addition and subtraction
Magnitude
Magnitude of a vector
Normalization
Normal vector
Dot product
Dot Product
Cross product
Euler angles
Axis + angle
Quaternions
Bounding volume
Spatial data structure
Implementations
Oct-tree
Grid-based
Uniformed graph searches
Cost-based graph searches

Improvements

Projectile motion
Slope motion (no friction)
Explicit method
Improved method
Implicit method
Seek
Flee
Arrive
Pursuit
Evade
Wander
Path follow
Body
Rigid Body
Soft body
Shape
Fixture

Constraint
Sensor/Phantom
Rag doll
Destructible object
rope
revolute
prismatic
cone-twist
Applications
Basic model


Sphere
Capsule
AABB
OBB
k-DOP
Convex volume
SAT (separating axis theorem)
Other methods
Stepped world
Continuous Collision Detection (CCD)

Model Space
World Space
View/Camera Space
Clip Space
View/Screen Space
Perspective projection
Orthographic projection
Applications
Main methods
Vertex
Fragment
Texture
Occlusion

Z-Fighting
Culling
Vertex shader
Geometry shader (optional)
Tessellation shader (optional)
Pixel (fragment) shader
Compute shader
LOD
Texture mapping
Baking




Game AI features and limits
Game AI properties
| 1 | // Doom 2: find player to chase |
| 2 | void A_Look (mobj_t* actor) { |
| 3 | mobj_t* targ; |
| 4 | actor->threshold = 0; // any shot will wake up |
| 5 | targ = actor->subsector->sector->soundtarget; |
| 6 | if (actor->flags & MF_AMBUSH){ |
| 7 | if (P_CheckSight (actor, actor->target)) |
| 8 | goto seeyou; |
| 9 | } else goto seeyou; |
| 10 | |
| 11 | if (!P_LookForPlayers (actor, false)) return; |
| 12 | // go into chase state |
| 13 | seeyou: |
| 14 | P_ChasePlayer(); |
| 15 | } |




| Node Type | Success | Failure | Running |
|---|---|---|---|
| Selector | If one child succeeds | If all children fail | If one child is running |
| Sequence | If all children succeed | If one child fails | If one child is running |
| Decorator | It depends | It depends | It depends |
| Parallel | If N children succeed | If M-N children succeed | If all children are running |
| Action | When completed | Upon an error | During completion |
| Condition | If true | If false | Never |

Main elements
Other features
Resource Control
Tech tree
Build order (opening)
Fog of war
Micromanagement
Tactics
Strategy

Stream
Snapshot
Command
Action
Procedure Call
Connection messages
Beacon
switch(actionType) {
case OBJECT_CREATED:
int objectType = reader->ReadDWord();
auto factory = creatorManager->FindObjectFactory(objectType);
auto newInstance = factory->CreateInstance(reader); // parse parameters
objects.push_back(newInstance);
break;
case OBJECT_DELETED:
int objectId = reader->ReadDWord();
sceneManager->removeObjectById(objectId);
...
}
Source engine's solution

Wrong

Correct
Time dilation
Deterministic prediction
Dead reckoning
Server-side rewind
