SlideShare a Scribd company logo
1 of 37
Cross-platform physics
games
Using MonoGame and
Farseer Physics
Rune Andreas Grimstad @runegri
Capgemini Norge
What to expect
• Lots of code!
• Intoduction to MonoGame and Farseer
• Playable demos
• Code on GitHub for you to play with :-)
What NOT to expect
• Deep dive into the features
• That would take days...
• 3D games
• Visit Richard Garside’s talk tomorrow at 11:40
• A complete game
Who am I?
• Rune Andreas Grimstad
• Lives in Trondheim
• Works for Cagemini
• Focus on .Net and anything mobile
• Programming since I was 8 years old...
Why games programming?
• Not my job!
• Fun
• Learning
• Becoming a billionaire after creating the next Angry
Birds Flappy Bird!
MonoGame
• Open Source implementation of XNA 4
• Runs everywhere
• C# / .Net
• Xamarin
Fez
Bastion
Draw a Stickman Epic
Transistor
MonoGame – getting it
• Download from monogame.net
• Clone from GitHub
• NuGet
MonoGame – features
• Supports all features of XNA4 (more or less)
• 2D
• 3D
• Content pipeline
• Input
• Sound and music
• Networking
• It’s a bare-bones framework…
Enough background!
How MonoGame works
- The Game Loop
Initialize and load
content
Update
game state
Draw
everything
Unload content
How MonoGame works
- Creating content
• Most file types are supported
• Either use an XNA content project
• Requires XNA Game Studio, so Windows only
• Create a MonoGame Content project
• Or use the MonoGame Content Builder
• Runs everywhere
• Not 100% done yet, but getting close
How MonoGame works
- Loading content
• Using the ContentManager.Load method
• Usually Content.Load<Texture2D>("spaceship");
• You can also load other resources this way
• SpriteFont, SoundEffect, Song, and so on
• Store the files in the Content folder in your project
• Build Action – Content
• Copy to Output Directory – Copy if newer
How MonoGame works
- Drawing stuff
• Use the SpriteBatch class
• Start with SpriteBatch.Begin
• Do your SpriteBatch.Draw calls
• End with SpriteBatch.End
• Try to limit how many SpriteBatches you use
Demo 1
• The basics
• Draw a sprite on screen
• Content
• Animation
• Camera, pan & zoom
• Input
Demo 1 – What did we learn?
• Game loop
• Content
• SpriteBatch
• Texture atlas
• Camera
• Input
All that from this little guy!
But there is more
Farseer physics
Farseer Physics Engine is a
collision detection system
with realistic physics
responses.
Farseer physics
• 2D Physics simulation
• Collision detection
• Objects with any shape
• Friction and restitution
• Joints
• Gravity
... and more
Farseer physics – getting it
• NuGet
• Download from
https://farseerphysics.codeplex.com/
• Build from sources
• The easiest way to combine with MonoGame?
One thing to be aware of
• Farseer uses the KMS system (Kilo, Meters,
Seconds)
• Use the ConvertUnits class
• Init with SetDisplayUnitToSimUnitRatio
• Use ToDisplayUnits and ToSimUnits
Your screen
Display coordinates: 1920 x 1080 pixels
Farseer coordinates: 19.2 x 10.8 meters
Demo 2 – more Bubble Bobble!
• A simple platformer
• Simulates a world
• Sprites are bodies in the world
• Collision detection
• Movement
Bubbles!
Demo 2 – what did we learn?
• Using Farseer!
• Worlds
• Bodies
• World and display coordinates
More features of Farseer Physics
• Polygon shapes
• Turning an image into a polygon in the game world
• Complex objects
• Combining many shapes into a single object
• Joints
• Attaching bodies to each other
Demo 3 – Exploring the cave
• Stupid game with lots of physics
• Polygon objects
• Complex objects
• Disabling gravity
• Attaching objects
Polygon shapes
Turn this... ... into this
MAGIC!
Polygon shapes
Complex objects
• Add many shapes to one body
Complex objects
• Join bodies using joints
• Revolute joints can be used to create a chain or rope
• Use the RopeJoint to set the length of the rope
• The possibilities are endless!
Finally
• There is much more to MonoGame!
• 3D – Richard Garside will talk about this tomorrow!
• Pixel shaders and effects
• Sound and music
• Use the SoundEffect and Song classes
• Input beyond the keyboard
• Mouse
• Touch
• Joystick
Finally finally
• Find my code samples on GitHub
• github.com/runegri
• And my slides on SlideShare
• slideshare.net/runegri
Get in touch
• I’m here for the rest of the conference
• Twitter: @runegri
• Email: rag@rag.no

More Related Content

Viewers also liked

Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...SanaChoudary
 
EastBay.NET - Introduction to MonoTouch
EastBay.NET - Introduction to MonoTouchEastBay.NET - Introduction to MonoTouch
EastBay.NET - Introduction to MonoTouchmobiweave
 
Introduction to CocosSharp
Introduction to CocosSharpIntroduction to CocosSharp
Introduction to CocosSharpJames Montemagno
 
Generative Art Hands On with F#
Generative Art Hands On with F#Generative Art Hands On with F#
Generative Art Hands On with F#Phillip Trelford
 
Monogame and xna
Monogame and xnaMonogame and xna
Monogame and xnaLee Stott
 
Intro to Gaming- MonoGame/CocosSharp/UrhoSharp
Intro to Gaming- MonoGame/CocosSharp/UrhoSharpIntro to Gaming- MonoGame/CocosSharp/UrhoSharp
Intro to Gaming- MonoGame/CocosSharp/UrhoSharpVidyasagar Machupalli
 
Tips & Tricks that every game developer should know
Tips & Tricks that every game developer should knowTips & Tricks that every game developer should know
Tips & Tricks that every game developer should knowGorm Lai
 
Flappy bird game in c#
Flappy bird game in c#Flappy bird game in c#
Flappy bird game in c#Comstas
 
Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015Phillip Trelford
 
UniteKorea2014 - Making flappy bird workshop
UniteKorea2014 - Making flappy bird workshopUniteKorea2014 - Making flappy bird workshop
UniteKorea2014 - Making flappy bird workshopGukHwan Ji
 
Smyowl - desenvolvimento games win8
Smyowl - desenvolvimento games win8Smyowl - desenvolvimento games win8
Smyowl - desenvolvimento games win8Mauricio Alegretti
 
Desenvolvendo Jogos 2D em HTML5 - Cocos2d-x
Desenvolvendo Jogos 2D em HTML5 - Cocos2d-xDesenvolvendo Jogos 2D em HTML5 - Cocos2d-x
Desenvolvendo Jogos 2D em HTML5 - Cocos2d-xPedro Kayatt
 
Final project report of a game
Final project report of a gameFinal project report of a game
Final project report of a gameNadia Nahar
 

Viewers also liked (17)

Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
Road to Success (July 1st) - Mobile Game Development Alternatives - Andrew Bu...
 
EastBay.NET - Introduction to MonoTouch
EastBay.NET - Introduction to MonoTouchEastBay.NET - Introduction to MonoTouch
EastBay.NET - Introduction to MonoTouch
 
Introduction to CocosSharp
Introduction to CocosSharpIntroduction to CocosSharp
Introduction to CocosSharp
 
Gaming in Csharp
Gaming in CsharpGaming in Csharp
Gaming in Csharp
 
Generative Art Hands On with F#
Generative Art Hands On with F#Generative Art Hands On with F#
Generative Art Hands On with F#
 
Monogame and xna
Monogame and xnaMonogame and xna
Monogame and xna
 
Intro to Gaming- MonoGame/CocosSharp/UrhoSharp
Intro to Gaming- MonoGame/CocosSharp/UrhoSharpIntro to Gaming- MonoGame/CocosSharp/UrhoSharp
Intro to Gaming- MonoGame/CocosSharp/UrhoSharp
 
Tips & Tricks that every game developer should know
Tips & Tricks that every game developer should knowTips & Tricks that every game developer should know
Tips & Tricks that every game developer should know
 
Flappy bird game in c#
Flappy bird game in c#Flappy bird game in c#
Flappy bird game in c#
 
Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015Ready, steady, cross platform games - ProgNet 2015
Ready, steady, cross platform games - ProgNet 2015
 
Building a game in a day
Building a game in a dayBuilding a game in a day
Building a game in a day
 
Mobile F#un
Mobile F#unMobile F#un
Mobile F#un
 
UniteKorea2014 - Making flappy bird workshop
UniteKorea2014 - Making flappy bird workshopUniteKorea2014 - Making flappy bird workshop
UniteKorea2014 - Making flappy bird workshop
 
Smyowl - desenvolvimento games win8
Smyowl - desenvolvimento games win8Smyowl - desenvolvimento games win8
Smyowl - desenvolvimento games win8
 
Desenvolvendo Jogos 2D em HTML5 - Cocos2d-x
Desenvolvendo Jogos 2D em HTML5 - Cocos2d-xDesenvolvendo Jogos 2D em HTML5 - Cocos2d-x
Desenvolvendo Jogos 2D em HTML5 - Cocos2d-x
 
Final project report of a game
Final project report of a gameFinal project report of a game
Final project report of a game
 
Snake game
Snake gameSnake game
Snake game
 

Similar to Cross platform physics games - NDC 2014

So You Finally Got Your Job at GameDev. What's next?
So You Finally Got Your Job at GameDev. What's next?So You Finally Got Your Job at GameDev. What's next?
So You Finally Got Your Job at GameDev. What's next?Taras Leskiv
 
Eating Fruit - Combining Robots & Apps
Eating Fruit - Combining Robots & AppsEating Fruit - Combining Robots & Apps
Eating Fruit - Combining Robots & AppsRobotGrrl
 
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
 
Enabling Creativity: Software that encourages creation and exploration
Enabling Creativity: Software that encourages creation and explorationEnabling Creativity: Software that encourages creation and exploration
Enabling Creativity: Software that encourages creation and explorationKevin Lawver
 
nunuStudio Geometrix 2017
nunuStudio Geometrix 2017nunuStudio Geometrix 2017
nunuStudio Geometrix 2017José Ferrão
 
The raspberry pi – building an internet radio
The raspberry pi – building an internet radioThe raspberry pi – building an internet radio
The raspberry pi – building an internet radioGibraltar Software
 
Building an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPIBuilding an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPIGary Short
 
Game tech using kodu adarsha
Game tech using kodu adarshaGame tech using kodu adarsha
Game tech using kodu adarshaAdarsha Datta
 
A Brief Game Jam Survival Guide
A Brief Game Jam Survival GuideA Brief Game Jam Survival Guide
A Brief Game Jam Survival GuideLuca Galli
 
Best Practices for Fast Game Design in Unity
Best Practices for Fast Game Design in UnityBest Practices for Fast Game Design in Unity
Best Practices for Fast Game Design in UnityUnity Technologies
 
TiConf 2014 Game Dev with Titanium and Platino 5/10/14
TiConf 2014 Game Dev with Titanium and Platino 5/10/14TiConf 2014 Game Dev with Titanium and Platino 5/10/14
TiConf 2014 Game Dev with Titanium and Platino 5/10/14gouldjw13
 
Making HTML5 Games with Phaser
Making HTML5 Games with PhaserMaking HTML5 Games with Phaser
Making HTML5 Games with PhaserIndieOutpost
 
Horizon Zero Dawn: The Early Days
Horizon Zero Dawn: The Early DaysHorizon Zero Dawn: The Early Days
Horizon Zero Dawn: The Early DaysDevGAMM Conference
 
Gamemaker - Intro and Core Objects
Gamemaker - Intro and Core ObjectsGamemaker - Intro and Core Objects
Gamemaker - Intro and Core ObjectsJoe Healy
 
Development and Optimization of GearVR games using Unreal Engine
Development and Optimization of GearVR games using Unreal EngineDevelopment and Optimization of GearVR games using Unreal Engine
Development and Optimization of GearVR games using Unreal EngineVinicius Vecchi
 
Casual and Social Games with Unity
Casual and Social Games with UnityCasual and Social Games with Unity
Casual and Social Games with UnityTadej Gregorcic
 

Similar to Cross platform physics games - NDC 2014 (20)

So You Finally Got Your Job at GameDev. What's next?
So You Finally Got Your Job at GameDev. What's next?So You Finally Got Your Job at GameDev. What's next?
So You Finally Got Your Job at GameDev. What's next?
 
Eating Fruit - Combining Robots & Apps
Eating Fruit - Combining Robots & AppsEating Fruit - Combining Robots & Apps
Eating Fruit - Combining Robots & Apps
 
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
 
Enabling Creativity: Software that encourages creation and exploration
Enabling Creativity: Software that encourages creation and explorationEnabling Creativity: Software that encourages creation and exploration
Enabling Creativity: Software that encourages creation and exploration
 
nunuStudio Geometrix 2017
nunuStudio Geometrix 2017nunuStudio Geometrix 2017
nunuStudio Geometrix 2017
 
Games withflare3d
Games withflare3dGames withflare3d
Games withflare3d
 
The raspberry pi – building an internet radio
The raspberry pi – building an internet radioThe raspberry pi – building an internet radio
The raspberry pi – building an internet radio
 
Building an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPIBuilding an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPI
 
Game tech using kodu adarsha
Game tech using kodu adarshaGame tech using kodu adarsha
Game tech using kodu adarsha
 
A Brief Game Jam Survival Guide
A Brief Game Jam Survival GuideA Brief Game Jam Survival Guide
A Brief Game Jam Survival Guide
 
Best Practices for Fast Game Design in Unity
Best Practices for Fast Game Design in UnityBest Practices for Fast Game Design in Unity
Best Practices for Fast Game Design in Unity
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
TiConf 2014 Game Dev with Titanium and Platino 5/10/14
TiConf 2014 Game Dev with Titanium and Platino 5/10/14TiConf 2014 Game Dev with Titanium and Platino 5/10/14
TiConf 2014 Game Dev with Titanium and Platino 5/10/14
 
XNA in a Day
XNA in a DayXNA in a Day
XNA in a Day
 
From Web to Mobile with Stage 3D
From Web to Mobile with Stage 3DFrom Web to Mobile with Stage 3D
From Web to Mobile with Stage 3D
 
Making HTML5 Games with Phaser
Making HTML5 Games with PhaserMaking HTML5 Games with Phaser
Making HTML5 Games with Phaser
 
Horizon Zero Dawn: The Early Days
Horizon Zero Dawn: The Early DaysHorizon Zero Dawn: The Early Days
Horizon Zero Dawn: The Early Days
 
Gamemaker - Intro and Core Objects
Gamemaker - Intro and Core ObjectsGamemaker - Intro and Core Objects
Gamemaker - Intro and Core Objects
 
Development and Optimization of GearVR games using Unreal Engine
Development and Optimization of GearVR games using Unreal EngineDevelopment and Optimization of GearVR games using Unreal Engine
Development and Optimization of GearVR games using Unreal Engine
 
Casual and Social Games with Unity
Casual and Social Games with UnityCasual and Social Games with Unity
Casual and Social Games with Unity
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

Cross platform physics games - NDC 2014

  • 1. Cross-platform physics games Using MonoGame and Farseer Physics Rune Andreas Grimstad @runegri Capgemini Norge
  • 2. What to expect • Lots of code! • Intoduction to MonoGame and Farseer • Playable demos • Code on GitHub for you to play with :-)
  • 3. What NOT to expect • Deep dive into the features • That would take days... • 3D games • Visit Richard Garside’s talk tomorrow at 11:40 • A complete game
  • 4. Who am I? • Rune Andreas Grimstad • Lives in Trondheim • Works for Cagemini • Focus on .Net and anything mobile • Programming since I was 8 years old...
  • 5. Why games programming? • Not my job! • Fun • Learning • Becoming a billionaire after creating the next Angry Birds Flappy Bird!
  • 6.
  • 7. MonoGame • Open Source implementation of XNA 4 • Runs everywhere • C# / .Net • Xamarin
  • 8. Fez
  • 12. MonoGame – getting it • Download from monogame.net • Clone from GitHub • NuGet
  • 13. MonoGame – features • Supports all features of XNA4 (more or less) • 2D • 3D • Content pipeline • Input • Sound and music • Networking • It’s a bare-bones framework…
  • 15. How MonoGame works - The Game Loop Initialize and load content Update game state Draw everything Unload content
  • 16. How MonoGame works - Creating content • Most file types are supported • Either use an XNA content project • Requires XNA Game Studio, so Windows only • Create a MonoGame Content project • Or use the MonoGame Content Builder • Runs everywhere • Not 100% done yet, but getting close
  • 17. How MonoGame works - Loading content • Using the ContentManager.Load method • Usually Content.Load<Texture2D>("spaceship"); • You can also load other resources this way • SpriteFont, SoundEffect, Song, and so on • Store the files in the Content folder in your project • Build Action – Content • Copy to Output Directory – Copy if newer
  • 18. How MonoGame works - Drawing stuff • Use the SpriteBatch class • Start with SpriteBatch.Begin • Do your SpriteBatch.Draw calls • End with SpriteBatch.End • Try to limit how many SpriteBatches you use
  • 19. Demo 1 • The basics • Draw a sprite on screen • Content • Animation • Camera, pan & zoom • Input
  • 20. Demo 1 – What did we learn? • Game loop • Content • SpriteBatch • Texture atlas • Camera • Input
  • 21. All that from this little guy!
  • 22. But there is more
  • 23. Farseer physics Farseer Physics Engine is a collision detection system with realistic physics responses.
  • 24. Farseer physics • 2D Physics simulation • Collision detection • Objects with any shape • Friction and restitution • Joints • Gravity ... and more
  • 25. Farseer physics – getting it • NuGet • Download from https://farseerphysics.codeplex.com/ • Build from sources • The easiest way to combine with MonoGame?
  • 26. One thing to be aware of • Farseer uses the KMS system (Kilo, Meters, Seconds) • Use the ConvertUnits class • Init with SetDisplayUnitToSimUnitRatio • Use ToDisplayUnits and ToSimUnits Your screen Display coordinates: 1920 x 1080 pixels Farseer coordinates: 19.2 x 10.8 meters
  • 27. Demo 2 – more Bubble Bobble! • A simple platformer • Simulates a world • Sprites are bodies in the world • Collision detection • Movement Bubbles!
  • 28. Demo 2 – what did we learn? • Using Farseer! • Worlds • Bodies • World and display coordinates
  • 29. More features of Farseer Physics • Polygon shapes • Turning an image into a polygon in the game world • Complex objects • Combining many shapes into a single object • Joints • Attaching bodies to each other
  • 30. Demo 3 – Exploring the cave • Stupid game with lots of physics • Polygon objects • Complex objects • Disabling gravity • Attaching objects
  • 31. Polygon shapes Turn this... ... into this MAGIC!
  • 33. Complex objects • Add many shapes to one body
  • 34. Complex objects • Join bodies using joints • Revolute joints can be used to create a chain or rope • Use the RopeJoint to set the length of the rope • The possibilities are endless!
  • 35. Finally • There is much more to MonoGame! • 3D – Richard Garside will talk about this tomorrow! • Pixel shaders and effects • Sound and music • Use the SoundEffect and Song classes • Input beyond the keyboard • Mouse • Touch • Joystick
  • 36. Finally finally • Find my code samples on GitHub • github.com/runegri • And my slides on SlideShare • slideshare.net/runegri
  • 37. Get in touch • I’m here for the rest of the conference • Twitter: @runegri • Email: rag@rag.no