Gustavo Pezzi – 2D Game Physics Programming
Description Of 2D Game Physics Programming
This 2D Game Physics Programming course is a gentle introduction into the world of 2D game physics! We’ll review all the beautiful math that provides the foundation for most physics engines, starting with a strong review of vectors, matrices, basic trigonometry, rigid-body collision, and touching a little bit of calculus as well.
The lectures are designed to teach all concepts from first principles. In our journey, we’ll review several topics from physics, like velocity, acceleration, integration, mass, forces, gravity, drag, friction, rigid body dynamics, collision detection, constraints, etc.
We’ll also put theory into practice by coding a very simple 2D physics engine from scratch using the C++ programming language.
We’ll start by writing a simulation of particle physics, which is a good start for us to address concepts like movement, forces, displacement, and integration.
We’ll then proceed to work with rigid bodies by adding shapes to our objects, like circles, rectangles, and polygons. We’ll also learn how to code the collision detection and collision resolution between these rigid bodies.
We’ll conclude our C++ implementation by adding constraints to our physics engine, which will help us add different types of objects to our engine, like joints and ragdolls. Ultimately, constraints will help us improve the stability of our engine, and they are a great opportunity for us to discuss some interesting ideas from calculus.
The tools you’ll need
All you really need is a simple code editor and a C++ compiler. We’ll use a cross-platform library called SDL to display our graphics, and since we can find a C++ compiler for virtually any operating system, you can follow along on either Windows, macOS, or Linux!
Also, make sure you have pen and paper ready for the lectures. This course will probably be a little bit different than other programming courses you took before. We will take our sweet time and make sure we understand every formula we find along the way!
Is this 2D Game Physics Programming course for you?
This is a self-contained course with no formal prerequisites. However, you will probably get the most out of it if you already know the basics of coding (if-else, loops, functions).
We will explore some very interesting math along the way, but all you really need is to know some simple algebra. If you know how to solve the equation below for x, then you should be able to follow along and have fun like everyone else!
And finally, if you never programmed in C++ before… don’t worry! Many successful students come from different languages like Java, Python, JavaScript, Swift, and others. We’ll go over the ugly parts of C++ together.
How is this 2D Game Physics Programming course different?
This 2D Game Physics Programming course is not just a simple tutorial on how to use a physics engine like Box2D or Bullet. This 2D Game Physics Programming course focus on the foundation of what makes physics engines tick, including a comprehensive review of the beautiful math that comes with it.
While you can find other resources on game physics out there, most of them are either too theoretical or overwhelmingly complex. This 2D Game Physics Programming course is a beginner-friendly introduction to the world of game physics, providing a mix between the theory we’ll see in the lectures with the practical examples we’ll write using C++.
So, if you ever wanted to understand what happens under the hood of a physics engine, then get ready and buckle up! This is going to be a 35-hour journey of pure nerd fun.
What you’ll learn in 2D Game Physics Programming
Course content
1. Introduction
- Introduction and Motivations
- How to Take this Course?
- What is Game Physics?
- A Quick Review of Vector Math
2. Vectors
- Scalar and Vector Quantities
- Intro to the P5js Web Editor
- Coding the Vec2 Class
- Quiz: Scalars and Vectors
3. Vector Operations
- Vector Magnitude
- Vector Addition
- Vector Subtraction
- Examples of Vector Addition and Subtraction
- Vector Equality
- Scaling Vectors
- Quiz: Vector Arithmetic
4. Dot Product & Cross Product
- Dot Product
- Is the Dot Product Commutative?
- Quiz: Dot Product
- Cross Product
- Coding the Cross Product Method
- Exercise: Perpendicular 2D Vectors
- Exercise: Vec3 Class
- Examples of Dot Product and Cross Product
- Quiz: Cross Product
5. Vectors Normalization
- Vector Normalization
- Coding the Vec2.Normalize Method
6. Vector Transformations
- Scaling, Translating, and Rotating Vectors
- Review of Sine, Cosine, and Tangent
- Vector Rotation Proof (x)
- Vector Rotation Proof (y)
- Coding the Vec2 Rotate Method
- Quiz: Vector Transformations
- Concluding our JavaScript Vec2 Class
7. Vectors in C++
- Vec2 C++ Header File
- A Review of the C++ Syntax for Vec2
- Vec2 Operator Overloading
8. Starting our C++ Project
- Libraries and Dependencies
- Project Folder Structure
- Initial Project Files
- Compiling our Project on Linux
- Compiling our Project on macOS
- Makefiles
- Configuring Visual Studio on Windows
9. Particle Physics
- Introduction to Particle Physics
- Particle Class
- Particle Velocity
- Exercise: Operator + to Add Vectors
- Controlling our Framerate
- Framerate Independent Movement
- Variable Delta Time
- A Discussion About Determinism
- Quiz: Framerate and Delta Time
- Moving in a Constant Velocity
- What About Mass?
- Changing Particle’s Velocity
- Keeping Particles Inside the Window
10. Simulating Movement
- Constant Acceleration
- Discrete vs. Continuous
- Integration & Simulation of Movement
- Different Notations for Differentation
- Integrals as Continuous Sum
- Different Integration Techniques
- Particle Integrate Function
- Quiz: Integration
11. Applying Forces to Particles
- Applying Forces to Particles
- Kinematics vs. Kinetics
- Function to Add Forces
- Particles with Different Mass
- Weight Force
- Inverse of Mass
- Quiz: Forces and Mass
- Exercise: Applying Forces on Key Press
12. Drag Force and Friction Force
- Drag Force
- Function to Apply Drag
- Handling Mouse Clicks with SDL
- Friction Force
- Function to Apply Friction
- Examples of Forces in Games
- Quiz: Drag and Friction
13. Gravitational Attraction
- Gravitational Attraction Force
- Coding the Gravitational Attraction Force
- Quiz: Gravitational Attraction Force
14. Spring Forces
- Spring Force
- Spring Force Function
- Exercise: Spring Forces
- Chain of Objects with Springs
- Soft Body with Springs
- A Discussion on Verlet Integration
15. Rigid Body Physics
- Rigid Bodies
- Different Rigid Body Shapes
- Shape Parent Class
- Circle Shape
- Angular Velocity
- Angular Acceleration
- Torque and Moment of Inertia
- Angular Motion for the Circle Shape
- Exercise: Coding Torque and Moment of Inertia
- Direction of the Angular Velocity
- Quiz: Angular Motion
16. Polygons and Vertices
- Box Ve
- rtices
- Local Space vs. World Space
- Body Update Function
- Quiz: Local Space and World Space
17. Colliding Circles
- Circle-Circle Collision Detection
- Collision Detection Class
- Collision Contact Information
- Coding the Circle-Circle Collision Information
- Broad Phase and Narrow Phase
- The Projection Method
- Objects with Infinite Mass
- Floating-Point Comparison
- Quiz: Circle-Circle Collision Detection
18. Impulse and Momentum
- Impulse Method and Momentum
- Impulse
- Deriving the Linear Impulse Formula
- Coding the Linear Impulse Function
- Is Linear Collision Resolution Good Enough?
- Quiz: Linear Collision Resolution
19. Colliding Boxes
- AABB Collision
- SAT: Separating Axis Theorem
- Different SAT Approaches
- Finding the Minimum Separation with SAT
- Polygon-Polygon Collision Code
- What are Support Points?
- Finding Collision Information with SAT
- Quiz: SAT
20. Angular Collision Resolution
- Linear and Angular Velocity at a Point
- Post-Collision Velocity at a Point
- Computing the Linear & Angular Velocity at a Point
- Collision Distance Vectors ra and rb
- 2D Cross Product Simplification
- Impulse Along the Normal Vector
- Exercise: Impulse Along the Tangent Vector
- Friction Along the Tangent Vector
- Discussing Collision Resolution in 3D
21. Circle-Polygon Collision
- Circle-Polygon Collision Detection
- Finding Polygon’s Nearest Edge with Circle
- Exercise: Computing Circle-Polygon Edge Regions
- Exercise: Polygons with More than 4 Vertices
- Quiz: Circle-Polygon Collision
22. Displaying Textures
- Loading SDL Textures
- Rendering Circle Texture
- Rigid Body Textures
23. The World Class
- Creating a World Class
- Coding the World Functions
24. Engine Collision Instability
- Refactoring Function to Update Vertices
- Local Solvers vs. Global Solvers
- A Naive Iterative Solution to Positional Correction
- Quiz: Local Solvers vs. Global Solvers
25. Constraints
- Constrained Rigid Body Physics
- Position Constraint vs. Velocity Constraint
- Example of Velocity Constraint and Bias Factor
- Force Constraint & Constrained Movement
- Force-Based vs. Impulse-Based Constraints
- Coding the Constraint Parent Class
- Quiz: Constraints
26. Matrices and Systems
- VecN Class
- VecN Functions
- Coding VecN Operator Overloading
- Matrices
- MatMN Class
- MatMN Functions
- Matrix Transpose
- Matrix Multiplication Function
- Exercise: Seeing Beyond the Matrix
27. Distance Constraint
- Generalized Velocity Constraint
- Solving Violated Velocity Constraint
- Constraint Class Inheritance
- Distance Constraint
- Joint Constraint Class
- Joint Constraint vs. Distance Constraint
- Exercise: Converting from World Space to Local Space
- Inverse Rotation Matrix
- Deriving the Distance Jacobian
- Solving the System of Equations (Ax=b)
- The Gauss-Seidel Method
- Constrained Pendulum
- Quiz: Distance Constraints
28. System of Constraints
- Solving System of Constraints Iteratively
- Warm Starting
- Adding a Bias Term
- Exercise: Ragdoll
- Quiz: System of Constraints
29. Penetration Constraint
- Penetration Constraint
- Deriving the Penetration Jacobian
- Coding the Penetration Constraint Class
- Solving Penetration Constraints
- Linear Complementary Problem
- Penetration Warm Starting
- Quiz: Penetration Constraint
- Penetration Constraint Friction
- Clamping Friction Values
30. Stack of Boxes
- Unstable Stack of Boxes
- Allowing for Multiple Contact Points
- Reference Edge and Incident Edge
- Finding the Incident Edge
- Clipping
- Coding the Clipping Function
- Testing Multiple Objects and Multiple Constraints
- Quiz: Stack of Boxes
31. Optimization Options
- Contact Caching
- Continuous Collision Detection
- Computing the Moment of Inertia of Polygons
- Split Between Broad Phase and Narrow Phase
32. Conclusion & Next Steps
About Gustavo Pezzi
Gustavo Pezzi is a university lecturer in London, UK. He has won multiple education awards as a teacher and is also the founder of pikuma.com.
Gustavo Pezzi teaches fundamentals of computer science and mathematics; his academic path includes institutions such as Pittsburg State University, City University of London, and University of Oxford.
More courses from the same author: Gustavo Pezzi
Share Tool - Group Buy Tools and Premium WordPress From $1DELIVERY POLICY:
When will I receive my course?
You will receive a link to download your course immediately or within 1 to 21 days. It depends on the product you buy, so please read the short description of the product carefully before making a purchase.
How is my course delivered?
We share courses through Google Drive, so once your order is complete, you’ll receive an invitation to view the course in your email.
To avoid any delay in delivery, please provide an Gmail and enter your email address correctly in the Checkout Page.
In case you submit a wrong email address, please contact us to resend the course to the correct email.
How do I check status of my order?
Please log in to CourseAMZ account then go to Order Page. You will find all your orders includes number, date, status and total price.
If the status is Processing: Your course is being uploaded. Please be patient and wait for us to complete your order. If your order has multiple courses and one of them has not been updated with the download link, the status of the order is also Processing.
If the status is Completed: Your course is ready for immediate download. Click “VIEW” to view details and download the course.
Where can I find my course?
Once your order is complete, a link to download the course will automatically be sent to your email.
You can also get the download link by logging into your CourseAMZ account then going to Downloads Page.
You may also like:
- See more Meditation courses
- See more Fitness courses
- See more Trauma Healing courses
- See more Self Hypnosis courses
- See more Behavioral Health courses
- See more Mindvalley courses
- See more TheShiftNetwork courses
- See more PESI courses
- See more Yoga courses
- See more Massage courses
- See more Weight Loss courses
- See more Qigong courses
- See more Gym courses
- See more Detox courses
- See more Athlean X courses
- See more Beachbody courses
- See more Cognitive Behavioral courses
- See more Positive Psychology courses
- See more Neuro-linguistic programming courses
- See more Ericksonian Hypnotherapy courses
- See more Self Hypnosis courses
- See more Talmadge Harper courses
- See more NICABM courses
- See more Seduction courses
- See more Sex Tips courses
- See more Dirty Talk courses
- See more Body Language courses
- See more Gabrielle Moore courses
- See more 2 Girls Teach Sex courses
Reviews
There are no reviews yet.