Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Games for Science by Jessica Hamrick

PyCon 2014
April 12, 2014
470

Games for Science by Jessica Hamrick

PyCon 2014

April 12, 2014
Tweet

Transcript

  1. Games for Science! Interactive psychology experiments in Python with Panda3D

    Jessica Hamrick (@jhamrick) [email protected] Peter Battaglia [email protected] http://www.jesshamrick.com/ http://web.mit.edu/~pbatt/www/ Follow along: jhamrick.github.io/pycon-2014-talk
  2. The rise of games -- , May 2012 (emphasis added)

    Angry Birds games had so far been played a total of 200,000 years, with 300 million minutes of playing time daily. TNW Blog 300 million minutes = 5 million hours = 208,000 days = 570 years ... per day! What if we could leverage the popularity of games to do science?
  3. Outline 1. The question: How do people reason about the

    physical world? 2. The hypothesis 3. The experiments
  4. Brain as a computer Computational cognitive science software (i.e., mind)

    Computational neuroscience hardware (i.e., brain)
  5. “The physics engine in your head” Approximate simulations are not

    exact Probabilistic simulations have some randomness
  6. Why a physics engine? Effective Simulations are sufficiently realistic Efficient

    Created to run in realtime General-purpose Applies to many situations
  7. Outline 1. The question: How do people reason about the

    physical world? 2. The hypothesis: "The physics engine in your head" 3. The experiments
  8. Ok, so how do we test this? We use video

    game tools as our theories, and in our experiments. Create a computational model using video game physics (e.g., ) Generate stimuli using a 3D modeling program (e.g., ) Run experiments using a video game framework (e.g., ) (All open source, and all with Python bindings!) Perform data analysis using other Python tools: NumPy, SciPy, pandas, IPython, matplotlib, etc. Bullet Blender Panda3D
  9. More information about the research I am just going to

    focus on the experiments, but if you're interested in the research, check out these links: Project page: PNAS journal article: Scientific American article: Fast Company article: http://web.mit.edu/~pbatt/www/PNAS2013/user.html http://www.pnas.org/content/110/45/18327.abstract http://www.scientificamerican.com/article/the-video-game-engine-in-your- head http://www.fastcodesign.com/3022236/evidence/how-our-brains-play- angry-birds-with-the-world
  10. How does it work? 1. Create graphics models to depict

    the objects 2. Display the models with a rendering engine 3. Add physical dynamics with a physics engine 4. Link graphics and physics together We'll go through a conceptual overview of these steps. If you want to learn how to actually code it, you can find the code here: Panda3D also has a great "Hello, world!" tutorial here: https://github.com/jhamrick/pycon-2014-talk/blob/master/demos/tutorial.py https://www.panda3d.org/manual/index.php/A_Panda3D_Hello_World_Tutorial
  11. Step 1: Create a graphics model 3D objects are typically

    created in a modeling program like (which is Python scriptable!) Blender
  12. Step 2: Set up graphics Panda3D is a C++ game

    library with Python bindings
  13. Step 3: Set up physics is a mature C++ physics

    engine. Panda3d includes bindings to it, and it can be controlled through Python. To simulate physics, you need a B u l l e t W o r l d Keeps track of all the physics objects Computes new positions Handles collisions Physics objects consist of a shape (collisions) and a body (dynamics) Bullet
  14. Conclusion Question: How do people reason about the physical world?

    Hypothesis: "The physics engine in your head" Tools: Blender, Panda3D, and Bullet
  15. Looking forward... -- , May 2012 (emphasis added) Angry Birds

    games had so far been played a total of 200,000 years, with 300 million minutes of playing time daily. TNW Blog Think how much we could learn if people participated in psychology experiments at that scale! With engaging and interactive physics experiments, it doesn't seem impossible.
  16. Thanks! People Josh Tenenbaum Tom Griffiths Computational Cognitive Science Lab

    @ MIT Computational Cognitive Science Lab @ Berkeley Tools Python Panda3D, Blender, and Bullet IPython, NumPy, and the rest of the SciPy stack Slides created with IPython notebook and reveal.js
  17. Links Slides and demo code: Project page: SceneSim library: PNAS:

    Scientific American: Fast Company: https://github.com/jhamrick/pycon-2014-talk http://web.mit.edu/~pbatt/www/PNAS2013/user.html http://scenesim.org/ http://www.pnas.org/content/110/45/18327.abstract http://www.scientificamerican.com/article/the-video-game-engine-in-your- head http://www.fastcodesign.com/3022236/evidence/how-our-brains-play- angry-birds-with-the-world