Unleash Your Potential - Namagunga Girls Coding Club
Core mechanics
1. FUNDAMENTALS OF GAME DESIGN
CORE MECHANICS
Sayed Ahmed
BSc. Eng. in CSc. & Eng. (BUET)
MSc. in CSc. (U of Manitoba)
http://sayed.justetc.net
http://www.justETC.net
sayed@justetc.netWww.JustETC.net
Presented at the University of Winnipeg, Canada
Just E.T.C for Business, Education, and Technology Solutions
1
2. CORE MECHANICS
Core Mechanics
Determine how a game actually operates
What are the rules of the game
How the player interacts with them
Defines the game play
3. TOPICS
Understanding Core-Mechanics
Designing Core Mechanics
Explain the role of core mechanics in providing
entertainment
How core-mechanics differ between real time and turn
based games
How core mechanics are related to level design
Key elements of core-mechanics
Resources, entities, and mechanics
How you may use them to define rules precisely
Specific implementation of core mechanics
In the internal economy of games
A set of mechanics that governs the flow of quantities
How designers use mechanics
To create game play (challenges and actions)
4. TOPICS
How to design core mechanics
By reexamining early design work
Render it specific and concrete
Discuss random numbers
How to use them in Games
5. FUNCTIONS OF THE CORE MECHANICS IN OPERATION
Operate the internal economy of the game
Present active challenges
Accept player actions
Deter victory or loss
Operate the Artificial Intelligence
Switch the game from mode to mode
Transmit triggers to the storytelling engine
6. FUNCTIONS OF THE CORE MECHANICS IN OPERATION
Operate the internal economy of the game
Most important role of the core mechanics
Specifies
how the game or player creates, distributes, and uses up the goods on
which the game bases its economy
Present active challenges
To the player via the user interface
Active: governed by the core mechanics
Passive: A chasm that the player must jump over
Accept player actions
From the user interface
Implement the effect on the game world
On other players as well
Detect victory or loss
Detect condition for victory, loss, termination
Detect success or failure in all challenges
and apply consequences
7. FUNCTIONS OF THE CORE MECHANICS IN OPERATION
Operate the Artificial Intelligence
Operate the NPCs and artificial opponents
Switch the game from mode to mode
Keep tracks of modes
Changes game play mode
Signal User Interface engine to update UI
Transmit triggers to the storytelling engine
Trigger story telling engine to weave story
8. REAL-TIME GAMES VS. TURN-BASED GAMES
Real-Time Games
Most games operate in real time
The game advances with time
All players simultaneously play the game
In multiplayer games
Turn-Based
Players Take Turns
Real-Time
Core mechanics specify the parameters of a real world that
operates on its own whether the player acts or not
Processes operate continuously
NPCs do and act what they are supposed to do
Banks collect interest
One shot event – may happen at players action only
9. REAL-TIME GAMES VS. TURN-BASED GAMES
Turn-Based
Usually no NPC
The core-mechanics do nothing until a player take his
turn
Once a player is done the core mechanics can compute
the effect
Then core mechanics remain idle until the next player
takes his turn
You may define processes
But will only work in between players turn
10. CORE-MECHANICS AND LEVEL DESIGN
Level design
What challenges each level will contain
Core-mechanics
How challenges work in general
But not exactly which challenges each level will contain
But sometimes you may cooperate with level designers
11. KEY CONCEPTS
To design core mechanics
You must document the different components that
define how your game works
Find out the relationship among them
Resources
Entities
Simple Entities
Compound Entities
Unique Entities
Attributes of Entities
Mechanics
12. KEY CONCEPTS
Resources
Types of objects or materials the game can move or
exchange
The game handles as numeric quantities
May be also water – not countable
Does not refer to specific instances of these objects
But the type itself
Core mechanics define the processes by which the game
creates, uses, trades, and destroys resources
Rules by which
Specific instances of resources
Can legally be moved from place to place
Owner to owner
Can come into and go out of the game
Non-physical concepts
Popularity, resistance to poison as resources
Try to quantify them as numbers so that you can manipulate them
13. KEY CONCEPTS
Entities
Particular Instance of a resource
State of some element – light – symbolic value
Building, character, animal
State of a traffic light
Simple Entities
Specified by single value
Score, state of a light
Identify simple entities and define them in core mechanics
Compound Entities
More than one data value to describe an entity
Wind – speed and direction
Each value = an attribute
Avatar
A compound entity with another compound entity as attributes
14. KEY CONCEPTS
Entities
Unique Entities
Only one entity of a particular type
Avatar for example
Attributes of Entities
An attribute is an entity that belongs to, and therefore
helps to describe, another entity
Defining Entities for Your Game
Find out all entities in the game
Define how to keep track of them
Define how to represent them through user interface
Programmers will use these entities
15. KEY CONCEPTS
Mechanics
Document how the game world and everything in it behaves
State
the relationships among entities
The events and processes that take place among the resources
and entities of the game
The conditions that trigger events and processes
Describe
The overall rules of the game
Behavior of particular entities
Operate throughout the game
Apply only in particular gameplay modes
Global Mechanic
Example: governs when the game changes from mode to mode
(with help of entities that record what modes it is in)
16. RELATIONSHIPS AMONG ENTITIES
The value of one entity depends on the value of
another entity
They have a relationship
Define it in your core-mechanics
Numeric-entities: express mathematically
Character levels
Experience points earned
Character level = exp. Points * 1000
Events and Processes
You state that something happens
A change occurs
Event
A specific change that happens once when triggered by a
condition
17. KEY CONCEPTS
Events and Processes
Process
A sequence of activities that once initiated continues until
stopped
Conditions
To define what causes an event to occur
What causes a process to start or stop
Conditional statements
Define conditions in negative terms
Exception to general rules
Entities with their own mechanics
Describe in terms of OOP
18. RELATIONSHIPS
Numeric
Relationship is defined in terms of numbers and
arithmetic operations
A bakery can bake 50 loaves of bread from one sack of
flour and four buckets of water
Probability of an injury is directly proportional to the
weight and speed of the athletes
Need familiarity with algebra and arithmetic
Symbolic
What happens when a NPC sees the traffic light to be
Red, green, or yellow
19. INTEGRATION: NUMERIC AND SYMBOLIC RELATIONSHIPS
Your game may need to change the state of
symbolic entities based on numeric entities
20. THE INTERNAL ECONOMY
An economy is a system in which resources and entities
are produced, consumed, and exchanged in quantifiable
amounts
Game designers: design and tune the game’s economy
Components
Source
Drains
Converters
Traders
Production Mechanisms
Tangible and intangible resources
Feedback loops, Mutual Dependencies, and Deadlocks
Static and Dynamic Equilibrium
21. THE INTERNAL ECONOMY
Source
A resource or entity can come into the game world where it was not before
The mechanics by which it arrives is called source
Enemies at the start, enemies spawn at different points
Each spawn point maintained by a mechanic
Production rate
Global mechanics
Limited or Unlimited
Drains
A mechanic that determines the consumption of resources
Permanent drop out
Shooting draining ammunition
Being hit by enemy
Consume, decay
show a cause for draining
Converters
Mechanic or entity
Turns one or more resources into another type
Production rate, input to output ratio
Settlers: grain into flour, rate: one to one (bag) + 20 seconds
22. THE INTERNAL ECONOMY
Traders
Mechanic that trades goods
Stock trading game – financial construct, sword trader
Production Mechanisms
A class of mechanics that makes a resource conveniently
available to a player
Sources that bring the resource directly into player’s hand
Characters to perform production
Command & conquer
Tangible and intangible resources
Tangible: Require physical space
Intangible: No physical space required
23. THE INTERNAL ECONOMY
Feedback loops, Mutual Dependencies, and
Deadlocks
Need some input resources to produce something
Think about deadlock
Static and Dynamic Equilibrium
24. CORE MECHANICS AND GAME PLAY
Challenges and the core mechanics
Passive challenges
Not presented by core-mechanics – already there
Can implement the actions, detection, and offer reward
Active challenges
Offered by the core-mechanics
A puzzle to open the door
Define rules, actions, outcome
Actions and the Core Mechanics
Player Actions Trigger Mechanics
Must specify a mechanic that implements each action in each gameplay
mode
Initiate an event, start or stop processes
Press a button, UI triggers a mechanic that implements the action,
mechanic – change the posture of the avatar – a symbolic attribute,
determine and assign head position from ground
Actions Accompanied by Data
Manipulation or storage of data
Event mechanic and entity
25. CORE MECHANICS DESIGN
Goals of Core Mechanics Design
Strive for Simplicity and Elegance
Look for Patterns, then Generalize
Don’t try to get everything perfect on paper
Find the right level of detail
Revisit your earlier design work
Answer questions such as what is the player going to do?
List your Entities and Resources
Add the Mechanics
Think About your resources
Study your entities
Analyze challenges and Actions
Look for global mechanics
26. CORE MECHANICS DESIGN
Goals of Core Mechanics Design
Strive for Simplicity and Elegance
Look for Patterns, then Generalize
Don’t try to get everything perfect on paper
Find the right level of detail
Revisit your earlier design work
Answer questions such as what is the player going to do?
List your Entities and Resources
Add the Mechanics
Think About your resources
Study your entities
Analyze challenges and Actions
Look for global mechanics
27. RANDOM NUMBERS AND THE GAUSSIAN CURVE
Games use random numbers extensively
Random numbers are usually generated as
>= 0 and < 1
In Statistics
Probabilities are always calculated between 0 and 1
You can use probabilities to
Generate events randomly
Fix number of enemies
Example: 10% times an event will happen
Generate a random number, if that’s <= 0.1
Execute the event
Weapon successful hit rating 80% (0.8) – to the aimed target
Generate a random number, if that’s <= 0.8
Hit the target
28. PSEUDO-RANDOM NUMBERS
Random number generators (algorithms) usually use a
seed
If the seed is the same the sequence of the numbers will be
the same
If a game always uses the same seed, the generated
numbers and the sequence will be the same all the time
Such numbers are called pseudo random numbers
Useful for testing games
Bug fixing – can prevent bugs happening by chance
Identify that changing the mechanics has affected the game or not
– fine tune core mechanics
However, players play the game
Pseudo random numbers are not used
Rather the seed is changed (current time), so that the sequence of
random numbers changes at each play
29. MONTE CARLO SIMULATION
You can test a system with two or few inputs easily
Some direct mathematical relation may exist
But system that are dependent on too many factors
May be hard to test
Defining mathematical relationship can be difficult
Still, using the mathematical relations to understand and
test the system may be difficult
Rather you can take random input, and execute the
system, check the output
Try to justify that the output makes sense or not
If the output is logical or not
If not, then you should work on more fine tuning
30. MONTE CARLO SIMULATION
A game tournament with 20 teams
Difficult and time consuming
To make people play the game
Test if the algorithms resemble fairness or not
Rather automate the game playing
Select random inputs
Analyze the output
Think if the output made sense?
Did the weak team defeat the strong team?
Did that happen very frequently –
if so the game mechanics is not reasonable/fair – needs fine
tuning
If it happened rarely – the game can be assumed to be fair
31. UNIFORM DISTRIBUTION
Random numbers are generally generated with
uniform distribution
The chance of getting any one number is exactly
equal to getting any other number
Uniformly distributed die rolls
Die roll = (random number * number of faces on the die)
+ 1
32. NON UNIFORM DISTRIBUTION
You may want that
Some values will be generated more frequently than others
For example,
You are designing a game: olympic shooting
A player who came to play in olympics
Most of the times will hit a very close area
• Than he will hit an area far from the center
An artificial player needs to be implemented that most of the
times he hits a point close to the center
So the random number generation algorithm should
Generate numbers where some numbers (the middle ones)
• Will show up more frequently than others
Can be implemented as the sum of the numbers as generated
from
Two or three dice rolls (at once)
From two dice rolls: only one combination yields 2 but six
combinations (six possible ways) yield 7
34. THE GAUSSIAN CURVE
Most things lie somewhere in the middle
Rare things lie in the extremes
35. SUMMARY
By this time, you have a clear understanding of
What core mechanics are
What they do in games
Mechanics consists of
Algorithms and data
That governs the way the game is played
How to document core-mechanics
In terms of
Resources, simple and compound entities
Mechanics composed of
Events, processes, and conditions
Internal economy of games
To define the movement of resources from
Place to place
Owner to owner
Governed by mechnics