SlideShare a Scribd company logo
1 of 29
Simple Verlet Physics for
        Games

    Stuart Allen
   (aka FunkyPear)
Euler Integration


    Simplest method of moving particles and objects

    Need to keep track of object position and speed

    Each frame/time step add speed to position:
                   X = X + speedX
                   Y = Y + speedY
Euler Integration
Verlet Integration


     Also fairly simple, but expandable to be more
    accurate (outside scope of this talk)

     Need to keep track of object current position and
    previous position

     Each frame/time step, calculate distance
    travelled since last time, and add to current
    position:
                    X = X + (X - oldX)
                   Y = Y + (Y - oldY)
Verlet Integration
Demo 1




Euler & Verlet Particle Movement Demo
Constraints


    Constraints ensure two particles stay a certain
    distance apart by moving them towards or away from
    each other
Demo 2




Particle Constraint Demo
Gravity & Other Forces


    Forces applied directly to particle positions
       
           Gravity: y += 1

    Verlet motion makes force persist (inertia)
Demo 3




Particle Constraint with Gravity Demo
Simple Four Step Verlet Engine

Step 1: Apply forces (gravity, wind, etc)


Step 2: Verlet update


Step 3: Constraints


Step 4: Collision Detection
Rope


     Expanding from our last demo, rope can be
    simulated by having a chain of points connected
    in row with sticks
Demo 4




Multiple Constraints Rope Demo
Cloth


     Cloth can be simulated by a grid of points
    that are connected to their neighbours
Demo 5




Rope Becomes Cloth Demo
Relaxation


    Loop over constrain step multiple time to
    pull points together and make final result
    more rigid

    Less constrain loops means a more bendy
    and bouncy structure
Engine Upgrade: Fixed Points


     Fixed points do not move – other end of
    stick does all the moving
Structures & Towers


    Adding fixed points allows us to build fixed
    but flexible structures
       
           Towers (fixed points on ground)
       
           Bridges (fixed points on either edge of a gap)
       
           Dangling ropes (fixed point above rope)
Structures & Towers
Demo 6




Towers Editor Demo
Demo 7




Game Jam Tower Game Demo
Similar Mechanic:
World of Goo (2D Boy)
Engine Upgrade: Stick Length
                         Tolerance

    Sticks previously had set length

    Modify sticks to have min and max lengths.

     Soft body dynamics possible due to addition valid
    solutions
Blobs


    Blobs attempt to mimic gooey / gelatinous
    objects

    Multiple different configurations:
       
           Centre point makes blob seem more solid
       
           Double skinning helps stop edge points glitching
       
           More tolerance in inner sticks makes for a flatter,
           more dynamic blob
Demo 8




Blobs Editor Demo
Blobs – Each Point Linked to Opposite
Blobs – With Central Point
Similar Mechanic:
Gish (Chronic Logic)
Thanks for listening! :)

   More info and source code at
www.funkypear.com/mochilondon2012

More Related Content

What's hot

Momentum Math Examples
Momentum Math ExamplesMomentum Math Examples
Momentum Math Exampleshursmi
 
1. newton's second law ghumare s m
1. newton's second law ghumare s m1. newton's second law ghumare s m
1. newton's second law ghumare s msmghumare
 
Impulse momentum
Impulse momentumImpulse momentum
Impulse momentumEkeeda
 
Krisna suryanti rsa1 c314011 fis pgmipau
Krisna suryanti rsa1 c314011 fis pgmipauKrisna suryanti rsa1 c314011 fis pgmipau
Krisna suryanti rsa1 c314011 fis pgmipaukrisnasuryanti
 
Physics 504 Chapter 14 Newton's Laws & Rocketry
Physics 504 Chapter 14 Newton's Laws & RocketryPhysics 504 Chapter 14 Newton's Laws & Rocketry
Physics 504 Chapter 14 Newton's Laws & RocketryNeil MacIntosh
 
07 newton's law of motion
07 newton's law of motion07 newton's law of motion
07 newton's law of motionIZZUDIN IBRAHIM
 
Newton's laws of motion
Newton's laws of motionNewton's laws of motion
Newton's laws of motionCharchit Art
 
Physics conservation of momentum
Physics conservation of momentumPhysics conservation of momentum
Physics conservation of momentumdeepanshumathur12
 
Momentum and Impulse
Momentum and ImpulseMomentum and Impulse
Momentum and ImpulseJoem Solares
 

What's hot (11)

Momentum Math Examples
Momentum Math ExamplesMomentum Math Examples
Momentum Math Examples
 
1. newton's second law ghumare s m
1. newton's second law ghumare s m1. newton's second law ghumare s m
1. newton's second law ghumare s m
 
Impulse momentum
Impulse momentumImpulse momentum
Impulse momentum
 
Krisna suryanti rsa1 c314011 fis pgmipau
Krisna suryanti rsa1 c314011 fis pgmipauKrisna suryanti rsa1 c314011 fis pgmipau
Krisna suryanti rsa1 c314011 fis pgmipau
 
Physics 504 Chapter 14 Newton's Laws & Rocketry
Physics 504 Chapter 14 Newton's Laws & RocketryPhysics 504 Chapter 14 Newton's Laws & Rocketry
Physics 504 Chapter 14 Newton's Laws & Rocketry
 
07 newton's law of motion
07 newton's law of motion07 newton's law of motion
07 newton's law of motion
 
Clojure lightning talk
Clojure lightning talkClojure lightning talk
Clojure lightning talk
 
Newton's laws of motion
Newton's laws of motionNewton's laws of motion
Newton's laws of motion
 
Physics conservation of momentum
Physics conservation of momentumPhysics conservation of momentum
Physics conservation of momentum
 
Laws of motion
Laws of motionLaws of motion
Laws of motion
 
Momentum and Impulse
Momentum and ImpulseMomentum and Impulse
Momentum and Impulse
 

Viewers also liked

Icycle: On Thin Ice, A Postmortem by Reece Millidge
Icycle: On Thin Ice, A Postmortem by Reece MillidgeIcycle: On Thin Ice, A Postmortem by Reece Millidge
Icycle: On Thin Ice, A Postmortem by Reece Millidgemochimedia
 
Mochi London 2011
Mochi London 2011Mochi London 2011
Mochi London 2011Mike Jones
 
Player Behaviour by Martine Spaans
Player Behaviour by Martine SpaansPlayer Behaviour by Martine Spaans
Player Behaviour by Martine Spaansmochimedia
 
Game Design for Game Developers by Iain Lobb
Game Design for Game Developers by Iain LobbGame Design for Game Developers by Iain Lobb
Game Design for Game Developers by Iain Lobbmochimedia
 
The Importance of Personal Branding by Merlin Gore
The Importance of Personal Branding by Merlin GoreThe Importance of Personal Branding by Merlin Gore
The Importance of Personal Branding by Merlin Goremochimedia
 
Gravitee Wars Post Mortem by Stuart Allen of FunkyPear
Gravitee Wars Post Mortem by Stuart Allen of FunkyPearGravitee Wars Post Mortem by Stuart Allen of FunkyPear
Gravitee Wars Post Mortem by Stuart Allen of FunkyPearmochimedia
 
Mobile Gaming: Is It The Future? by Michael Hudson and Steven Gurevitz
Mobile Gaming: Is It The Future? by Michael Hudson and Steven GurevitzMobile Gaming: Is It The Future? by Michael Hudson and Steven Gurevitz
Mobile Gaming: Is It The Future? by Michael Hudson and Steven Gurevitzmochimedia
 
Potencial de Lennard - Jones
Potencial de Lennard - JonesPotencial de Lennard - Jones
Potencial de Lennard - JonesRodolfo Bernal
 
What's New At Mochi! by Colin Cupp and Ryan Nichols
What's New At Mochi! by Colin Cupp and Ryan NicholsWhat's New At Mochi! by Colin Cupp and Ryan Nichols
What's New At Mochi! by Colin Cupp and Ryan Nicholsmochimedia
 

Viewers also liked (9)

Icycle: On Thin Ice, A Postmortem by Reece Millidge
Icycle: On Thin Ice, A Postmortem by Reece MillidgeIcycle: On Thin Ice, A Postmortem by Reece Millidge
Icycle: On Thin Ice, A Postmortem by Reece Millidge
 
Mochi London 2011
Mochi London 2011Mochi London 2011
Mochi London 2011
 
Player Behaviour by Martine Spaans
Player Behaviour by Martine SpaansPlayer Behaviour by Martine Spaans
Player Behaviour by Martine Spaans
 
Game Design for Game Developers by Iain Lobb
Game Design for Game Developers by Iain LobbGame Design for Game Developers by Iain Lobb
Game Design for Game Developers by Iain Lobb
 
The Importance of Personal Branding by Merlin Gore
The Importance of Personal Branding by Merlin GoreThe Importance of Personal Branding by Merlin Gore
The Importance of Personal Branding by Merlin Gore
 
Gravitee Wars Post Mortem by Stuart Allen of FunkyPear
Gravitee Wars Post Mortem by Stuart Allen of FunkyPearGravitee Wars Post Mortem by Stuart Allen of FunkyPear
Gravitee Wars Post Mortem by Stuart Allen of FunkyPear
 
Mobile Gaming: Is It The Future? by Michael Hudson and Steven Gurevitz
Mobile Gaming: Is It The Future? by Michael Hudson and Steven GurevitzMobile Gaming: Is It The Future? by Michael Hudson and Steven Gurevitz
Mobile Gaming: Is It The Future? by Michael Hudson and Steven Gurevitz
 
Potencial de Lennard - Jones
Potencial de Lennard - JonesPotencial de Lennard - Jones
Potencial de Lennard - Jones
 
What's New At Mochi! by Colin Cupp and Ryan Nichols
What's New At Mochi! by Colin Cupp and Ryan NicholsWhat's New At Mochi! by Colin Cupp and Ryan Nichols
What's New At Mochi! by Colin Cupp and Ryan Nichols
 

More from mochimedia

What's New at Mochi! (2013 Edition) by Colin Cupp & Chris Jankos
What's New at Mochi! (2013 Edition) by Colin Cupp & Chris JankosWhat's New at Mochi! (2013 Edition) by Colin Cupp & Chris Jankos
What's New at Mochi! (2013 Edition) by Colin Cupp & Chris Jankosmochimedia
 
2012 Flash Games Market Survey Results
2012 Flash Games Market Survey Results2012 Flash Games Market Survey Results
2012 Flash Games Market Survey Resultsmochimedia
 
What's New at Mochi by Colin Cupp
What's New at Mochi by Colin CuppWhat's New at Mochi by Colin Cupp
What's New at Mochi by Colin Cuppmochimedia
 
Who Are You Trying to Impress? by ChrisJeff and Jay Armstrong
Who Are You Trying to Impress? by ChrisJeff and Jay ArmstrongWho Are You Trying to Impress? by ChrisJeff and Jay Armstrong
Who Are You Trying to Impress? by ChrisJeff and Jay Armstrongmochimedia
 
Screenplay by Tom Vian
Screenplay by Tom VianScreenplay by Tom Vian
Screenplay by Tom Vianmochimedia
 
Adobe Gaming Solutions by Tom Krcha
Adobe Gaming Solutions by Tom KrchaAdobe Gaming Solutions by Tom Krcha
Adobe Gaming Solutions by Tom Krchamochimedia
 
Beat the Post-Launch Blues by Rob Davis (Playniac)
Beat the Post-Launch Blues by Rob Davis (Playniac)Beat the Post-Launch Blues by Rob Davis (Playniac)
Beat the Post-Launch Blues by Rob Davis (Playniac)mochimedia
 
Game Aesthetics & Branding by James Pearmain (Jimp)
Game Aesthetics & Branding by James Pearmain (Jimp)Game Aesthetics & Branding by James Pearmain (Jimp)
Game Aesthetics & Branding by James Pearmain (Jimp)mochimedia
 
Super Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain LobbSuper Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain Lobbmochimedia
 
Bad Eggs Online: Our Experiences with Multiplayer by Rob & Jon Donkin
Bad Eggs Online: Our Experiences with Multiplayer by Rob & Jon DonkinBad Eggs Online: Our Experiences with Multiplayer by Rob & Jon Donkin
Bad Eggs Online: Our Experiences with Multiplayer by Rob & Jon Donkinmochimedia
 
Combining Action and Strategy in One Game: The Making of Automech Tower Defen...
Combining Action and Strategy in One Game: The Making of Automech Tower Defen...Combining Action and Strategy in One Game: The Making of Automech Tower Defen...
Combining Action and Strategy in One Game: The Making of Automech Tower Defen...mochimedia
 
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenz
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy SaenzDriving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenz
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenzmochimedia
 
Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...
Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...
Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...mochimedia
 
Getting Some Perspective: Away 3D 4.0 & Friends by Rob Bateman
Getting Some Perspective: Away 3D 4.0 & Friends by Rob BatemanGetting Some Perspective: Away 3D 4.0 & Friends by Rob Bateman
Getting Some Perspective: Away 3D 4.0 & Friends by Rob Batemanmochimedia
 
Screenplay by Tom Vian
Screenplay by Tom VianScreenplay by Tom Vian
Screenplay by Tom Vianmochimedia
 
Winning With Audio by Selcuk Bor
Winning With Audio by Selcuk BorWinning With Audio by Selcuk Bor
Winning With Audio by Selcuk Bormochimedia
 
Going Mobile by Nate Beck
Going Mobile by Nate BeckGoing Mobile by Nate Beck
Going Mobile by Nate Beckmochimedia
 
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobbmochimedia
 
Panel: Flash Development Life 2012, Moderated by Ethan Levy
Panel: Flash Development Life 2012, Moderated by Ethan LevyPanel: Flash Development Life 2012, Moderated by Ethan Levy
Panel: Flash Development Life 2012, Moderated by Ethan Levymochimedia
 
It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...
It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...
It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...mochimedia
 

More from mochimedia (20)

What's New at Mochi! (2013 Edition) by Colin Cupp & Chris Jankos
What's New at Mochi! (2013 Edition) by Colin Cupp & Chris JankosWhat's New at Mochi! (2013 Edition) by Colin Cupp & Chris Jankos
What's New at Mochi! (2013 Edition) by Colin Cupp & Chris Jankos
 
2012 Flash Games Market Survey Results
2012 Flash Games Market Survey Results2012 Flash Games Market Survey Results
2012 Flash Games Market Survey Results
 
What's New at Mochi by Colin Cupp
What's New at Mochi by Colin CuppWhat's New at Mochi by Colin Cupp
What's New at Mochi by Colin Cupp
 
Who Are You Trying to Impress? by ChrisJeff and Jay Armstrong
Who Are You Trying to Impress? by ChrisJeff and Jay ArmstrongWho Are You Trying to Impress? by ChrisJeff and Jay Armstrong
Who Are You Trying to Impress? by ChrisJeff and Jay Armstrong
 
Screenplay by Tom Vian
Screenplay by Tom VianScreenplay by Tom Vian
Screenplay by Tom Vian
 
Adobe Gaming Solutions by Tom Krcha
Adobe Gaming Solutions by Tom KrchaAdobe Gaming Solutions by Tom Krcha
Adobe Gaming Solutions by Tom Krcha
 
Beat the Post-Launch Blues by Rob Davis (Playniac)
Beat the Post-Launch Blues by Rob Davis (Playniac)Beat the Post-Launch Blues by Rob Davis (Playniac)
Beat the Post-Launch Blues by Rob Davis (Playniac)
 
Game Aesthetics & Branding by James Pearmain (Jimp)
Game Aesthetics & Branding by James Pearmain (Jimp)Game Aesthetics & Branding by James Pearmain (Jimp)
Game Aesthetics & Branding by James Pearmain (Jimp)
 
Super Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain LobbSuper Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain Lobb
 
Bad Eggs Online: Our Experiences with Multiplayer by Rob & Jon Donkin
Bad Eggs Online: Our Experiences with Multiplayer by Rob & Jon DonkinBad Eggs Online: Our Experiences with Multiplayer by Rob & Jon Donkin
Bad Eggs Online: Our Experiences with Multiplayer by Rob & Jon Donkin
 
Combining Action and Strategy in One Game: The Making of Automech Tower Defen...
Combining Action and Strategy in One Game: The Making of Automech Tower Defen...Combining Action and Strategy in One Game: The Making of Automech Tower Defen...
Combining Action and Strategy in One Game: The Making of Automech Tower Defen...
 
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenz
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy SaenzDriving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenz
Driving Stage3D: A Post Mortem by Nate Beck and Jeremy Saenz
 
Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...
Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...
Next Generation Flash Gaming: Lessons from Console Development by Justin Lamb...
 
Getting Some Perspective: Away 3D 4.0 & Friends by Rob Bateman
Getting Some Perspective: Away 3D 4.0 & Friends by Rob BatemanGetting Some Perspective: Away 3D 4.0 & Friends by Rob Bateman
Getting Some Perspective: Away 3D 4.0 & Friends by Rob Bateman
 
Screenplay by Tom Vian
Screenplay by Tom VianScreenplay by Tom Vian
Screenplay by Tom Vian
 
Winning With Audio by Selcuk Bor
Winning With Audio by Selcuk BorWinning With Audio by Selcuk Bor
Winning With Audio by Selcuk Bor
 
Going Mobile by Nate Beck
Going Mobile by Nate BeckGoing Mobile by Nate Beck
Going Mobile by Nate Beck
 
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
 
Panel: Flash Development Life 2012, Moderated by Ethan Levy
Panel: Flash Development Life 2012, Moderated by Ethan LevyPanel: Flash Development Life 2012, Moderated by Ethan Levy
Panel: Flash Development Life 2012, Moderated by Ethan Levy
 
It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...
It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...
It's A Long Way To The Top...If You Want To Be An Indie Flash Dev by David Sc...
 

Simple Verlet Physics by Stuart Allen (FunkyPear)