Talks

Summarized using AI

Game Development - The Ruby Way

Jain Rishi • October 01, 2015 • Ghent, Belgium

The video "Game Development - The Ruby Way" presented by Jain Rishi at ArrrrCamp 2015 explores the exciting world of game development using the Ruby programming language and the Gosu library. Rishi, who hails from India, begins by sharing his enthusiastic journey into programming and highlights the importance of open-source contributions in the Ruby community.

Key Points Discussed:
- Introduction to Game Development: Rishi emphasizes the joy of creating games, comparing it to the thrill of playing them. He humorously identifies himself as a full stack senior game programmer due to his experience in developing multiple games.
- History of Gaming: The talk touches on the evolution of games from early arcade classics like Pinball and Pong to modern gaming experiences, reflecting on how these games laid the groundwork for contemporary gaming.
- Game Creation Experience: Rishi discusses his personal journey with video games, mentioning popular titles he enjoys, such as Contra and FIFA, and what motivated him to start building games.
- Introduction to Gosu: The presenter introduces Gosu, a 2D game development library for Ruby, explaining its installation requirements and highlighting its cross-platform compatibility with Mac, Windows, and Linux.
- Basic Structure of Game Development: He outlines the fundamental cycle of a game: initializing objects, drawing them, and updating their state, explaining how Gosu simplifies this with methods like initialize(), draw(), and update().
- Practical Demonstrations: Rishi showcases games he has built using Gosu, such as a dragon egg game and a typing game. He engages audience volunteers to demonstrate gameplay mechanics live, providing an interactive experience.
- Game Mechanics Explained: Rishi explains how variables, collision detection, movement, and user input work within the games he creates. He discusses the importance of managing game states and the creative process involved in game design, emphasizing how easy it is to create games in Ruby compared to traditional programming languages.
- Resources for Developers: Rishi provides links to free image and sound resources and encourages utilizing creative commons resources for game assets.

In conclusion, Rishi's talk demystifies game development with Ruby and underscores that with the right tools and mindset, anyone can get started on building games, turning their ideas into interactive experiences. He encourages participants to explore their creativity and dive into game programming, emphasizing the enjoyment that comes with the process of game development.

Game Development - The Ruby Way
Jain Rishi • October 01, 2015 • Ghent, Belgium

Playing games is fun, but building one is even more fun! Add Ruby to the game development mix and it just cannot get more awesome. Gosu is the rock star library which is used for 2D game development. But you’ll need to know more than just your rubies to built a game. Rishi promises to show some cool examples built entirely using Ruby.

Help us caption & translate this video!

http://amara.org/v/H496/

ArrrrCamp 2015

00:00:07.910 I'm Rishi Jain and I am here to talk about game development the Ruby way. I am all the way from India. I know it's a long way from home; it has taken me one bus ride, two changes of flights, and a change of trains to finally reach Kent.
00:00:14.300 I work for a company called Josh Software, and 'Josh' is a Hindi word that means enthusiasm. A lot of people read it as Josh Software, but it's actually pronounced 'Josh' Software. We believe programming is an art, and we are not just about work. Since a lot of our work depends on the open source community, we believe in contributing back to the community in whatever way is possible, by doing open source contributions, writing gems and libraries, or organizing RubyConf India. We have been doing that for the past five years now.
00:00:31.590 Personally, I love conferences not only because I get to meet new people but also because it takes me to different places and allows me to learn about different cultures. This is very important to me. When I received a wonderful email from the ArrrrCamp organizers stating that my talk had been selected, I asked myself what I really know about Belgium and what are some of the things I could relate to. The first thing that came to mind was Belgium's football players. I love football; I've been playing and watching it for so long. So, are there any football fans in the house right now? I see some hands! It's clear that not everybody in Belgium loves football, which is something I've heard—a lot of people do love it, but not everyone.
00:01:19.830 Another thing that almost everyone in the world can relate to is Belgian chocolate. When I mentioned to my friends that I would be going to Belgium, they would always bring up chocolates. So, I promised them I would get some chocolates for them. Now, let’s talk about games. How many of you are passionate gamers who play every night? Some hands there! Cool! How many of you don’t mind playing games while traveling or during a meeting? I see some hands raised. How many have built a game from scratch? All right, some of you have! That’s great to hear.
00:02:24.560 When it comes to gaming, I consider myself a full-stack senior game programmer. Let me explain this—every job opening I see these days emphasizes the need for full-stack developers, someone who can come in on day one and start solving some of the greatest problems in computer science. So I see myself as a full-stack developer. I also consider myself senior because most of you haven’t written a game, but I have written like 23 small games, so I guess I am a senior game programmer. It’s only fair that we start with the history of gaming.
00:03:56.329 I think the history of gaming started with a few key games. The first game that impacted gaming history, in my opinion, is pinball. I was very fortunate to have a computer at a young age, and I used to play this game on a Windows machine. The game wasn’t complicated but produced different sounds every time the ball hits an object, and I loved it. Have any of you played pinball on Windows or on an actual board? Some of you have, that’s great! The next important game in this history is Pong. Engineers built this game, and it was a multiplayer game played on arcade boxes with a couple of joysticks.
00:04:34.740 This was a great vision back then because it recognized that people love playing games together, but it didn’t hit it off commercially because it was quite difficult to find someone to play with. As a result, gaming was considered a bit niche. To solve this problem, Steve Wozniak and his friends created Breakout, a single-player game where you break bricks all day long. It became popular because it didn’t require another player to enjoy it.
00:05:12.330 These few games are critically important in the history of gaming, but what about my personal history with games? I can divide my life span so far into three different games that I have played at different ages. Here’s what we’re going to do: I’m going to play the soundtrack of each game, and you all have to identify which game it is, okay? Here comes the first soundtrack.
00:06:12.630 Alright, let’s see if anyone can guess it. Yes, you're right! It’s Contra! I've played this game throughout my childhood and absolutely love it. The original plan was to give away t-shirts when someone answered, but I managed to leave my bag of t-shirts at the first transit airport, so I apologize for that.
00:06:35.490 Now, let’s move on to the second game. It’s an easy one; I know you all will get it. Most of you have probably played this game. Personally, I didn't like it so much because everywhere I went to birthday parties, at school, or on playgrounds, kids were always talking about this game, and I felt left out of the conversation. So I thought, during summer holidays, I need to beat this Mario guy and play the game. Eventually, I played it during one summer holiday and got quite close to finishing it—just don’t ask my sister, or she’ll say I’m lying!
00:07:52.320 Moving on to the last game, which I absolutely love. It's very hard to identify, only true fans would guess it. Anyone with any guesses? Alright, it’s FIFA! I’ve been playing FIFA since FIFA 07, and I still play it today. In fact, I even set up my PS3 in the office so that whenever I need a break, or someone else does, they can jump on and play FIFA. Amid all this, I’ve always had the desire to build a game. You might ask why, since playing games is fun. The first reason is that games are like an ever-expanding universe.
00:08:46.930 Consider this: you’re playing a game, and you’re the good guy with a gun. A bad guy shows up, and you shoot him. You might think it’s your decision to shoot, but I believe that it’s the game programmer's choice to make you shoot the bad guy. It’s like a puppet show, and I would love to be the person controlling the strings. Essentially, I want to build a game because I want to feel like a god for a couple of hours. The second reason is that building games is just plain fun. So, let's start coding a game in our favorite language, which is not C++ or Objective-C, but Ruby!
00:09:58.750 Before we dive into coding though, let’s explore what kinds of games we can create using Gosu. I’ll demonstrate a few games that can be built using this awesome library.
00:10:30.760 So, I've been playing a particular game for so long that I got a bit bored with it. Can I get a volunteer from the front row to come up and play this game for us? Anyone? Thank you for volunteering!
00:10:51.600 Let me explain the rules of the game. It’s similar to the egg game on Flash. The objective is to drop the dragon egg, which starts at the top, into a basket at the bottom. To drop the egg, you need to press the spacebar. Once you press the spacebar, you cannot move the egg left or right. You’ll have 10 eggs to drop, and the best score so far is six. Let’s see how well you can do!
00:11:45.139 Alright, let’s begin! Oh, sounds like they have done quite well. Thank you so much for demonstrating that game!
00:12:11.320 Moving on to the next game, I need another volunteer! Come on, people! Alright, thank you for stepping up!
00:12:36.139 The purpose of this game is straightforward—you have to type in the word that you see on the screen. As you keep typing correctly, the level of difficulty increases, along with the speed at which the words appear. One of the rules is that you cannot press the delete key once you start typing the word. To submit a word, you press Enter, and to continue onto the next word, you also hit Enter.
00:13:00.500 Let’s start from scratch... Here’s the first word! Remember, don’t press the delete key! And there you go! Once you manage to type it, the speed will increase even more. Thank you for playing! Moving on to the next game, which can be introduced now.
00:14:11.740 Before I show you this game, let me just turn it off for a moment. This was our dragon egg game. I like drawing and visualizing what my game will look like. Here’s a rough sketch of how my game should appear—it’s not great, but it provides a general idea.
00:14:43.890 The next game I’m about to show you is not one I’ve written; rather, I found this while researching various options, and it’s compelling. In this game, you have to shoot aliens to survive. You have four lives, and the aim is to shoot as many aliens as possible. It’s a fun challenge! Moving on, I will show you another game called Captain Ruby, which comes packaged with Gosu. I’m not very good at it, but let’s see how it goes.
00:15:48.250 Let me start it over again—oh, no! Okay, let’s give it one more shot. Alright, now that we’ve seen the different types of games that can be made with Gosu, let’s discuss what Gosu actually is. It's a 2D game development library for the Ruby and C++ programming languages. It's available for macOS, Windows, and Linux. It works seamlessly with MRI Ruby, Mac Ruby, and Rubinius, but not so well with JRuby.
00:16:57.610 If you’re working on a Mac, I recommend switching to system Ruby instead of using RVM, as Gosu doesn’t work well with RVM. I spent hours trying to make both work together, which wasn’t fun at all. The main reason I wanted to use Gosu was to have fun writing a game—not fighting to make them work together, so I switched to system Ruby. This is the official website where you can find more information, and that’s the official game board link where you can provide access to your game code database or links showcasing your game.
00:18:03.519 Game development might seem like you need to read many big books and understand complex theories, but that’s not true. You only need to know one simple concept: the flow chart, which consists of initializing all elements, drawing everything, and constantly updating the state. It’s a continuous cycle: draw, update, draw, update—that's all you need to understand. With Gosu, we can easily implement these three methods: initialize, draw, and update.
00:19:21.030 If I need a background image in my game window, I’ll initialize it first. For any sound tracks, I will initiate those at the beginning as well. Let’s break down how to create the Dragon Eggs game. It had a game window, images, sounds (I call them 'headaches'), and it had the main object which are the eggs and baskets. Collisions were crucial, as we needed to determine whether an egg had fallen into a basket.
00:21:23.320 To set up the game window, you open a file in your favorite editor—like I use Vim all the time—and require Gosu. You create a new class called Game and inherit from the Gosu window class. In the initialization method, you would describe parameters such as the width, height, and a caption for the game window. After initializing, you create a new instance of your Game class and call show on it to run the game.
00:22:09.010 Continuing from where we left off, the top left corner of the window is the origin point (0,0). The x-coordinate increases as you move right, while the y-coordinate increases downwards, which is the opposite of traditional graph coordinates. This is an important consideration while writing your game, especially for functions like those that close the game, which added the functionality of pressing a specific key like 'Escape' to exit.
00:22:55.670 Many developers add sounds and images to the end of their game-making process, but I prefer to incorporate them from the start. This helps me visualize the game better and understand how everything is coming together. To draw an image using Gosu, I use my initialize method to load the background image and the sound palette. I'll indicate that the image should be drawn at the 0-0 position (the top left corner).
00:23:47.420 Drawing the background image and applying the soundtrack needs to be defined in the methods we created earlier. If you maintain the aspect ratio of your background and other images, they will display correctly without visual distortion. We also need to manage multiple egg objects, as one won’t suffice for a proper game experience. That means we can create classes that hold attributes for the eggs, and initialize them in a way that benefits the overall flow of questions in the game.
00:24:35.940 Next, controlling the movement of the egg via user inputs like arrow keys and space requires careful setup so that the egg can 'free fall' when the space bar is pressed. We’ll prepare methods aimed at detecting which button was pressed and ensuring the egg moves accordingly. Maintaining the idea that the visual flows smoothly as we draw new components helps to create an engaging user experience.
00:25:36.590 When the top boundary is reached, we generate random eggs in varying locations, updating their positions appropriately in the code so they can fall into the baskets. This leads to complex functions like collision detection between the eggs and baskets. You can use provided methods to determine the clamp and collision between two objects, implementing a counter that tracks scores based on successful egg drops.
00:26:35.710 This process of identifying the score led to considerations on the parameters involved, like ensuring the different coordinates of the egg and basket are reasonably defined so that they have to be near each other to be considered a successful capture. The essentials—idea, images, sounds, and fonts—are important building blocks in becoming successful in game development, and it’s necessary to build upon these concepts as you lay out the groundwork for your game.
00:27:51.590 I encourage everyone to think of games they’ve played in their youth or games that inspire them currently. Additionally, as you build your game, utilize resources from reliable free image and sound repositories to assist you in creating a polished, final product. Be cautious with licensing restrictions when using images from platforms like Flickr, and research sound effects that fit into your gaming environment.
00:28:39.300 In closing, I hope you all find game development enjoyable. I want to share a final YouTube link to Mike Murray's talk, which I mentioned earlier; it's a fantastic resource and a source of inspiration on this topic. Thank you for your time, and let’s dive into building something amazing together!
Explore all talks recorded at ArrrrCamp 2015
+14