2. What Are Mathematical Models?
• Definition: A mathematical model is a description of a
system using mathematical concepts like equations,
functions, and algorithms.
• These models help developers understand, test, and adjust
how a game behaves.
• Example: A formula to calculate how damage is dealt in a
combat system.
3. Why Use Mathematical Models in
Games?
• - Ensure gameplay is balanced and fair.
• - Predict and control difficulty curves.
• - Analyze player behavior and game economies.
• - Create scalable systems for complex games.
• - Help designers iterate quickly and efficiently.
4. Types of Mathematical Models in
Games
• - Deterministic Models: No randomness; same input always
gives the same output.
• - Probabilistic Models: Include elements of chance.
• - Discrete Models: Change at specific intervals (turn-based).
• - Continuous Models: Change constantly over time (real-time
physics).
5. Deterministic Models
• Definition: Models that produce the same result every time
for a given input.
• Use Case: Puzzle games, strategic board games like Chess.
• Benefits: Predictability, allows for deep strategy and
planning.
6. Probabilistic Models
• Definition: Models that use randomness or probability to
determine outcomes.
• Use Case: Card draws, dice rolls, critical hits in RPGs.
• Benefits: Adds variability and excitement to gameplay.
7. Discrete vs. Continuous Models
• Discrete: Game world updates in steps (e.g., turn-based
games).
• Continuous: Game world updates smoothly over time (e.g.,
physics-based simulations).
• Example: Chess is discrete; a car driving simulation is
continuous.
8. Common Game Systems Modeled
Mathematically
• - Health and Damage Systems
• - Resource Management
• - Movement and Physics
• - AI and Decision Making
• - Game Economy
• - Player Progression
9. Modeling Health and Damage
• Linear or non-linear equations can define how much
damage a player takes.
• Consider variables: player health, enemy attack power,
defense levels.
• Helps developers balance combat difficulty.
10. Example: Damage Model
• Formula: Remaining_HP = Initial_HP - (Damage × (1 -
Defense/100))
• Use Case: Allows tuning of game balance and enemy
strength.
• Adjustment: Modify defense effectiveness to make the game
easier or harder.
11. Modeling Game Economy
• Track how players earn and spend currency.
• Balance income (e.g., rewards) with expenses (e.g.,
upgrades).
• Prevent currency inflation or scarcity.
12. Example: In-Game Currency Model
• Formula: Net_Currency = (Earnings_per_minute × Play_Time)
- Total_Spend
• Analyze to ensure players can afford necessary upgrades.
• Adjust based on playtest feedback.
13. Modeling Player Behavior
• Predict likely choices using game theory.
• Model motivations and tendencies (e.g., risk vs. reward).
• Helps design systems players enjoy and engage with.
14. Game Theory Basics
• Definition: Study of mathematical models of strategic
interaction.
• Use Payoff Matrices to analyze player decisions.
• Identify dominant strategies and adjust game rules
accordingly.
15. Using Graphs in Game Models
• Graphs represent states (nodes) and transitions (edges).
• Useful in pathfinding, AI logic, and level design.
• Example: A graph to model enemy patrol routes.
16. Finite State Machines (FSM)
• Break down behavior into defined states.
• Use transitions triggered by conditions.
• Widely used in AI and cutscene scripting.
17. FSM Example: Enemy AI
• States: Patrol Chase Attack Flee
→ → →
• Transitions: Based on player distance or AI health.
• Allows structured and understandable AI behavior.
18. Probabilistic FSM
• Adds randomness to FSM transitions.
• Makes AI less predictable.
• Example: 70% chance to attack, 30% chance to flee.
19. Introduction to Simulation
• Definition: Use of models to imitate game behavior over
time.
• Allows developers to test ideas without full implementation.
• Helps discover balance issues early.
20. Types of Simulations in Games
• - Real-Time: Updates continuously (e.g., physics).
• - Turn-Based: Step-by-step updates (e.g., strategy).
• - Monte Carlo: Random sampling to simulate many possible
outcomes.
21. Real-Time Simulation
• Used for real-time physics, vehicle dynamics, weather.
• Requires optimization for performance.
• Must be consistent and deterministic for multiplayer games.
22. Turn-Based Simulation
• Ideal for games where players take actions one at a time.
• Easier to simulate and debug.
• Example: Simulating a battle in a strategy game.
23. Monte Carlo Simulation
• Run simulations with random variables many times.
• Collect statistics to determine likely outcomes.
• Used in RNG tuning and statistical balancing.
24. Example: Monte Carlo for Loot Drops
• Simulate 10,000 loot rolls.
• Analyze drop rates for each item.
• Adjust probabilities to ensure fairness.
25. Agent-Based Simulation
• Simulate multiple agents with rules (e.g., NPCs, animals).
• Observe emergent behavior.
• Used in crowd systems and ecological simulations.
26. Physics Simulations
• Models using laws of motion and force.
• Implemented with rigid body dynamics.
• Adds realism to movement, collisions, and object
interactions.
27. Collision Detection Algorithms
• Bounding Box: Fast, rough estimate.
• Bounding Sphere: Useful for circular objects.
• SAT: More precise for complex shapes.
28. Performance Optimization via
Simulation
• Run stress tests to evaluate game performance.
• Simulate worst-case AI or player scenarios.
• Identify and fix performance bottlenecks.
29. Simulation Tools and Libraries
• - Unity Physics Engine
• - Box2D, Bullet Physics
• - MATLAB/Simulink for academic prototyping
• - Python for scripting and testing logic
30. Game Balancing through Simulation
• Test different character builds.
• Simulate multiple matchups.
• Use results to tweak stats and rules.
31. Workflow for Simulation Analysis
• 1. Define the system and variables.
• 2. Run controlled simulations.
• 3. Record outcomes.
• 4. Visualize data.
• 5. Adjust and re-test.
32. Data Visualization in Simulation
• Translate results into visual formats:
• - Line Graphs: Show progression.
• - Bar Charts: Compare outcomes.
• - Heatmaps: Show density/frequency.
33. Tools for Data Visualization
• - Excel/Google Sheets: Quick graphs.
• - Python Libraries: Matplotlib, Seaborn.
• - Unity Analytics: Built-in for game metrics.
34. Case Study: Combat Simulation in RPG
• Simulate hundreds of battles.
• Compare class builds (e.g., warrior vs. mage).
• Determine which build is overpowered or underpowered.
35. Case Study: Traffic Simulation in Racing
Game
• Simulate AI vehicle movement.
• Observe collisions, overtaking behavior.
• Optimize road width and AI parameters.
36. Case Study: Economic Simulation in
Strategy Game
• Track trade between cities.
• Adjust taxes and resource prices.
• Use simulation to prevent resource hoarding or inflation.
37. Risks of Poor Modeling
• - Unintended player exploits
• - One strategy becomes dominant
• - Game becomes too easy or too difficult
• - Poor user retention
38. Summary
• Mathematical models represent and control game systems.
• Simulations allow testing and refinement.
• Together, they lead to better game design, balance, and
performance.
39. Class Activity
• Choose a game mechanic (e.g., damage, resource
collection).
• Create a simple formula or FSM.
• Share and get peer feedback.
40. Group Discussion
• What math models exist in your favorite game?
• Can you find flaws or exploits?
• How would you simulate and fix them?