mono for game developers
play

Mono for Game Developers Miguel de Icaza - PowerPoint PPT Presentation

Mono for Game Developers Miguel de Icaza miguel@xamarin.com, @migueldeicaza Xamarin Inc Agenda Mono in Games Using Mono for Games Performance


  1. Mono ¡for ¡Game ¡Developers ¡ Miguel ¡de ¡Icaza ¡ miguel@xamarin.com, ¡@migueldeicaza ¡ ¡ Xamarin ¡Inc ¡

  2. Agenda ¡ • Mono ¡in ¡Games ¡ • Using ¡Mono ¡for ¡Games ¡ • Performance ¡ • Garbage ¡CollecKon ¡ • Co-­‑rouKnes, ¡Asynchronous ¡Programming ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  3. MONO ¡IN ¡GAMES ¡

  4. C# ¡ Java ¡ JavaScript ¡ Ruby ¡ Python ¡ Visual ¡Basic ¡ F# ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  5. C# ¡ Java ¡ JavaScript ¡ Ruby ¡ Python ¡ Visual ¡Basic ¡ F# ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  6. Sims ¡3 ¡ • Mixed ¡Code: ¡ – C/C++ ¡engine ¡ – C# ¡scripKng/AI ¡ – C# ¡high-­‑level ¡ • Visual ¡Studio ¡+ ¡Mono ¡ • X86, ¡PS3, ¡Xbox360 ¡ ¡ Credit: ¡ ¡www.thesims3facts.webs.com ¡

  7. BasKon ¡– ¡on ¡Google ¡Chrome ¡NaCl ¡ • C# ¡XNA ¡codebase ¡ • Originally ¡on ¡Xbox ¡ • Ported ¡to ¡NaKveClient ¡ – Mono ¡ – MonoGame ¡(XNA) ¡ • Mac, ¡Windows, ¡Linux ¡

  8. Pure ¡C# ¡-­‑ ¡SoulCra_ ¡ • DeltaEngine ¡ – Pure ¡C# ¡engine ¡ – Open ¡source ¡ – Android, ¡iOS, ¡Mac, ¡Win ¡

  9. Unity ¡3D ¡ • Unity ¡Engine ¡ – C/C++ ¡game ¡engine ¡ – Embedded ¡Mono ¡ • User ¡code ¡ – C# ¡or ¡UnityScript ¡ – Extends ¡Unity ¡itself ¡ ¡ ¡ Shadow ¡Gun, ¡built ¡with ¡Unity ¡

  10. SecondLife ¡ • Mono ¡on ¡the ¡server ¡ • Powers ¡LSL ¡scripts ¡ • Nice ¡200x ¡perf ¡boost ¡ • Code ¡InjecKon ¡

  11. Infinite ¡Flight ¡ • Subject ¡of ¡the ¡second ¡ part ¡of ¡this ¡session ¡

  12. WHY ¡MONO? ¡

  13. Because ¡Life ¡is ¡too ¡Short ¡ • To ¡debug ¡another ¡memory ¡leak ¡ • To ¡track ¡another ¡memory ¡corrupKon ¡bug ¡ • Because ¡you ¡deserve ¡be=er ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  14. The ¡Quest ¡for ¡ProducKvity ¡ System ¡Languages ¡ Scrip<ng ¡Languages ¡ Pros: ¡ Pros: ¡ • Low-­‑level ¡ • High-­‑level, ¡good ¡producKvity ¡ • Good ¡control ¡of ¡hardware ¡ • Easy ¡to ¡write ¡ • Typed ¡ • Safe, ¡prevent ¡crashes ¡ • Fast ¡code ¡ • Loosely ¡typed ¡ Cons: ¡ ¡ • Easy ¡to ¡corrupt ¡state ¡ Cons: ¡ • Low ¡producKvity ¡ • Poor ¡control ¡of ¡hardware ¡ • Crash ¡o_en ¡ • Slow ¡(interpreted) ¡ • Complex ¡for ¡newcomers ¡

  15. John ¡Ousterhout ¡ScripKng ¡Quest ¡ IEEE ¡1998 ¡Summary ¡Paper ¡ ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡ h=p://www.stanford.edu/~ouster/cgi-­‑bin/papers/scripKng.pdf ¡

  16. John ¡was ¡always ¡ahead ¡of ¡his ¡Kme ¡ • Professional ¡workstaKons ¡in ¡1998 ¡ – SPARC, ¡HP-­‑PA ¡ • Not ¡achievable ¡on ¡PCs ¡of ¡the ¡Kme ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  17. 2000 ¡– ¡Desktop ¡Development ¡ • Building ¡desktop ¡apps ¡with ¡C ¡and ¡C++ ¡ – Slow ¡progress, ¡error ¡prone, ¡frequent ¡crashes ¡ • Windows ¡2000 ¡Requirements: ¡ – 133 ¡Mhz ¡or ¡more ¡ – 64 ¡megs ¡for ¡desktop, ¡256 ¡for ¡server ¡ • Windows ¡XP ¡Requirements ¡(one ¡year ¡later) ¡ – 233Mhz ¡or ¡more ¡ – 128 ¡megs ¡for ¡desktop ¡ • Development ¡desktops ¡at ¡the ¡Kme: ¡ – ~1Ghz ¡speed ¡ – ~1 ¡GB ¡of ¡memory ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  18. C# ¡Introduced ¡in ¡2000 ¡ • C# ¡1.0 ¡was ¡a ¡Java-­‑like ¡system ¡ • With ¡many ¡design ¡fixes ¡ – 10 ¡years ¡of ¡experience ¡ – Change ¡defaults ¡(all ¡virtual, ¡vs ¡opt-­‑in ¡virtual) ¡ – Introduce ¡structs ¡(help ¡GC, ¡no ¡boxing) ¡ – Direct ¡access ¡to ¡naKve ¡libraries ¡(P/Invoke) ¡ – Delegates ¡(foundaKon ¡for ¡lambdas) ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  19. Language ¡Choices ¡ ¡ Fully ¡Dynamic ¡ Easy ¡ C#/Java ¡ ProducKvity ¡ C/C++ ¡ Assembly ¡Language ¡ Difficult ¡ Slow ¡ Performance ¡ Fast ¡

  20. Game ¡So_ware ¡Components ¡ . ¡ Display ¡ SimulaKon ¡ Game ¡Logic ¡ Support ¡ • Rendering ¡ • Physics ¡ • World ¡rules ¡ • Audio ¡ • Shading ¡ • Collision ¡ • Enemy ¡AI ¡ • Input ¡ • Scene ¡ • ParKcles ¡ • User ¡ • Networking ¡ • AnimaKon ¡ • Terrain ¡ control ¡ • Geometry ¡ • Camera ¡ • GUI ¡ • Behavior ¡

  21. The ¡Problem ¡ Games ¡are ¡real-­‑Kme ¡programs ¡ • 30 ¡to ¡60 ¡frames ¡per ¡second ¡(0.016 ¡seconds) ¡ Input ¡ AI ¡ Updates ¡ ¡ ¡ ¡ • User ¡control ¡ • Scripted, ¡slow ¡ • Render ¡Graphics ¡ • Network ¡ • React ¡to ¡ • Play ¡audio ¡ events ¡ change ¡ • Update ¡scene ¡

  22. Problem: ¡ ¡ScripKng ¡Is ¡A ¡Bo=leneck ¡ Gaming's ¡Achilles' ¡Heel ¡ Display ¡ SimulaKon ¡ Game ¡Logic ¡ Support ¡ • Rendering ¡ • Physics ¡ • World ¡rules ¡ • Audio ¡ • Shading ¡ • Collision ¡ • Enemy ¡AI ¡ • Input ¡ • Scene ¡ • ParKcles ¡ • User ¡ • Networking ¡ • AnimaKon ¡ • Terrain ¡ control ¡ • Geometry ¡ • Camera ¡ • GUI ¡ • Behavior ¡ C/C++ ¡ C/C++ ¡ Script ¡ C/C++ ¡

  23. Problem: ¡ ¡ScripKng ¡Is ¡A ¡Bo=leneck ¡ Gaming's ¡Achilles' ¡Heel ¡ Display ¡ SimulaKon ¡ Game ¡Logic ¡ Support ¡ • Rendering ¡ • Physics ¡ • World ¡rules ¡ • Audio ¡ • Shading ¡ • Collision ¡ • Enemy ¡AI ¡ • Input ¡ • Scene ¡ • ParKcles ¡ • User ¡ • Networking ¡ • AnimaKon ¡ • Terrain ¡ control ¡ • Geometry ¡ • Camera ¡ • GUI ¡ • Behavior ¡ C/C++ ¡ C/C++ ¡ Script ¡ C/C++ ¡ C# ¡

  24. What ¡C# ¡Offers ¡ • Close ¡to ¡naKve ¡performance ¡ – 50%-­‑90% ¡of ¡naKve ¡performance ¡ • Safe ¡ExecuKon ¡Environment ¡ – With ¡opKonal ¡support ¡to ¡shoot ¡yourself ¡in ¡the ¡ foot. ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  25. C# ¡-­‑ ¡An ¡Evolving ¡Language ¡ 2012 ¡ 5.0 ¡ Asynchronous ¡Programming ¡ 2010 ¡ 4.0 ¡ Dynamic ¡extensions ¡ 2007 ¡ Language ¡Integrated ¡Query, ¡FuncKonal ¡ 3.0 ¡ 2005 ¡ 2.0 ¡ Generics, ¡Iterators, ¡Lambdas ¡ 2002 ¡ 1.0 ¡ Managed ¡Code, ¡strongly ¡typed ¡

  26. USING ¡MONO ¡

  27. Designing ¡Mono ¡ApplicaKons ¡ • Provided: ¡ – C# ¡Language ¡ – Base ¡Class ¡Libraries ¡ • Not ¡Provided: ¡ – User ¡Interface, ¡Graphics, ¡Audio ¡ – These ¡are ¡all ¡plaqorm ¡specific ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  28. Code ¡Sharing ¡and ¡NaKve ¡Experience ¡ C# ¡ Core ¡Engine, ¡Shared ¡Logic, ¡Business ¡Logic ¡ Plus ¡ECMA ¡languages ¡ RunKme ¡ .NET ¡ Mono ¡ Windows ¡ OS ¡ Mac ¡ iOS ¡ Android ¡ Xbox ¡ WinPhone ¡ Not ¡a ¡comprehensive ¡list ¡

  29. Code ¡Sharing ¡and ¡NaKve ¡Experience ¡ NaKve ¡UI ¡ XAML ¡ MonoMac ¡ MonoDroid ¡ MonoTouch ¡ APIs ¡ XNA ¡ C# ¡ Core ¡Engine, ¡Shared ¡Logic, ¡Business ¡Logic ¡ Plus ¡ECMA ¡languages ¡ RunKme ¡ .NET ¡ Mono ¡ Windows ¡ OS ¡ Mac ¡ iOS ¡ Android ¡ Xbox ¡ WinPhone ¡ Not ¡a ¡comprehensive ¡list ¡

  30. Modes ¡of ¡Use ¡ • Drive ¡the ¡applicaKon ¡ • ScripKng ¡engine ¡ – Sandboxed ¡ – Full ¡access ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  31. Run ¡on ¡Mono ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

  32. Run ¡on ¡Mono ¡ Game ¡– ¡Your ¡C# ¡Code ¡ C#/.NET ¡Libraries ¡ Mono ¡ RunKme ¡ MonoGame ¡ OpenTK ¡ Physics ¡ OperaKng ¡ System ¡ OpenAL ¡ OpenGL ¡ Networking ¡ Mono ¡for ¡Game ¡Developers ¡– ¡AltDevConf ¡2012 ¡ h=p://www.xamarin.com ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend