Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University,...

13
Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013

Transcript of Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University,...

Page 1: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Angry Marblesphysics of the Angry Birds

Games Fundamentals© by Jarek FrancikKingston University, London

2013

Page 2: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Using Engines

For a Game Developer:

• There is no escape from programming– games don’t write themselves

• There is no escape from maths– engines can’t solve all problems!

• There is a kind of escape from physicsbut ...

Page 3: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Physics Engine

• You can easily do simple stuff• Physics engines are still complex

and your knowledge in physics will helpto master them

• You can hardly reach the full potential of the physics engine unless you understand physics

• Many less-trivial physical effects require significant additional effort from the developer and therefore – good understanding of physics

Page 4: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Physics and Employability

• Serious games companies are looking fordevelopers who can build sophisticatedphysical models!

• Understanding physicsenhances youremployability

Page 5: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• Open source• 2D physics engine• written by Erin Catto• zlib license• Productions:– Angry Birds, Crayon Physics, Limbo, Rolando

Tiny Wings, Happy Wheels, Little Cavemanand many more...

Page 6: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• World• Body• Shape• Fixture• Joint

Page 7: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• World– creates and destroys physical bodies– performs the simulation steps– provides gravitational field

• Body• Shape• Fixture• Joint

Page 8: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• World• Body– physical entity, subjects to simulation– detects collisions– responses to forces, impulses, torques etc.– provides position and rotation data

• Shape• Fixture• Joint

Page 9: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• World• Body• Shape– geometry provider:• polygons (incl. rectangles)• circles• edges and chains

• Fixture• Joint

Page 10: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• World• Body• Shape• Fixture– attaches a shape to a body– provides physical attributes:• density (necessary to calculate mass and inertia)• friction• restitution

• Joint

Page 11: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• World• Body• Shape• Fixture• Joint– provides joined or chained objects

like ragdolls, teeters and pulleys

Page 12: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Box2D

• Units:– meter– kilogram– second

• GFC implementation: 1 meter = 100 pixels• Scale matters!

Page 13: Angry Marbles physics of the Angry Birds Games Fundamentals © by Jarek Francik Kingston University, London 2013.

Demo:

Angry Marbles!