Fun With Ruby And Gosu Javier Ramirez

5,544 views

Published on

Slides for javier ramirez's talk at EuRuKo 2009

Published in: Technology

Fun With Ruby And Gosu Javier Ramirez

  1. 1. EuRuKo presents Javier Ramírez (javier@formatinternet.com) * in * Fun with Ruby (and without r***s) Program your own games with Gosu
  2. 2. the characters Ruby ................. as The Damsel Hardware ............ as The Villain Gosu ...................... as The Hero Chipmunk ........ as The Scientist Rubyscript2exe ........ as Himself
  3. 3. why games work rest play sleep improve, have fun
  4. 4. why ruby because i can! less code, less clutter easy to try out
  5. 5. why me HTML PASCAL / BASIC C/C++ JAVA RUBY ASP DBase LOGO SQL PHP VBasic JavaScript Assembler
  6. 6. Non-technical considerations concept ● game specs / core design ● gameplay/game mechanics ● balance ● look and feel ● More at “Game Architecture and Design: A New Edition” by Andrew Rollings & David Morris
  7. 7. Part I what's in a game? (game development 101)
  8. 8. Web Development Abstraction
  9. 9. One ring to rule them all
  10. 10. Game Development Abstraction 3D games are the same, just harder
  11. 11. Game Development Components
  12. 12. the living game
  13. 13. Development Components main loop / event loop ● game logic: levels, collisions, AI ... ● stateless images (tiles / models) ● stateful images (sprites / models) ● sound FX and music ●
  14. 14. Part II when Ruby met Gosu
  15. 15. about by Julian Raschke and Jan Lücker Gosu ( 고수 ): High Hand - Leader C++ + Ruby Bindings http://code.google.com/p/gosu/ (http://tinyurl.com/euruko-gosu)
  16. 16. design rationale Bloatfree: Gosu aims to contain everything that is necessary to write a game in clean C++ or Ruby code, yet not much more. Reality-driven: Everything in Gosu exists for the same single reason: It was necessary for an existing project. Nothing was, and will ever be, added out of boredom.
  17. 17. game demo
  18. 18. source code http://tinyurl.com/euruko-games http://code.google.com/p/eurukuest (http://tinyurl.com/eurukuest)
  19. 19. Gosu::Window
  20. 20. Gosu::Image load individually or tiled drawing can be rotated / scaled supports z-index can use Rmagick objects
  21. 21. Gosu::Sample & Gosu::Song full playback control volume, speed, pause, resume, stop, pan looping supported midi are better if converted to XM
  22. 22. Gosu::Font can be a system font or a file easy to check the real width supports rotation and scaling
  23. 23. code walkthrough
  24. 24. about by Scott Lembcke A 2D rigid body physics library, designed with 2D video games in mind. http://code.google.com/p/chipmunk-physics (http://tinyurl.com/euruko-chipmunk)
  25. 25. about
  26. 26. about
  27. 27. chipmunk basics Space Body Shape Vect Joint
  28. 28. Part III your 15 minutes of fame
  29. 29. doing it is just half the fun
  30. 30. tar2rubyscript by Erik Veenstra RBA file: init.rb => tar + base64 + comments
  31. 31. rubyscript2exe by Erik Veenstra packages ruby, the script and all dependencies together into an executable file. works on windows, linux, OSx
  32. 32. rubyscript2exe First Step: it runs the application, checking for all the required gems and scripts, creating a list of dependencies to include in the executable
  33. 33. rubyscript2exe The “Environment Embedding Executable” gzips all the dependencies and attaches the file to a copy of eee
  34. 34. muhahahahaha! http://formatinternet.com javier@formatinternet.com http://twitter.com/supercoco9 http://www.workingwithrails.com/ person/5987-javier-ramirez

×