RubyConf 2016 – Attention Rubyists: you can write video games by Cory Chamblin

so hey everybody my name is Cory Chamblin I am a programmer I write back-end software at a company called pager duty but today I’m not gonna talk about any of that stuff I’m gonna talk about something way sweeter I’m gonna talk about how to build video games in Ruby I don’t do this for my job but I like to write games and I think Ruby’s a good language to do it in so the github for the talk github comm / Chamberlin you can go there download the slides download all the code for the talk so first we’re gonna talk about kind of the reasons why you might want to make games or why you might try to get into this as like a hobby just something to do on the weekends we’re gonna talk about why ruby is a pretty good choice for forgetting started making games the second bit there the main chunk of the talk we’re going to talk about how games are structured and and pretty much every game framework out there we’re gonna talk about gosu which is an amazing little library in Ruby for building your own games and we’re gonna talk about how to write pieces of games that you might want to build by building a couple times using go soon and if we have a little bit of time at the end we’re gonna talk about a few resources for aspiring independent game developers so if you’re not an artist you can go get some open-source artwork or some soap and source music sound effects and and maybe some tools that you might use and building your own games so first of all why do I make games and why should you make games so I like to make games because it reminds me of when I very first started programming back in the day we would get these these giant books of basic programs and they were games and you would spend your whole afternoon typing this stupid program into your computer and you would get to the end and you would type run and if you were very lucky and you didn’t make any mistakes you would blow yourself away with a really bad game no but it was it was exciting in the sense I typed this thing in and something happened on my computer and that is a real visceral kind of creative feeling that I think all professional programmers need to find some way to get that the first time I hooked up an Arduino to my computer and I made the little light blink on it I wrote some code and do a thing and I press play and a thing that was not my computer did something else that was a similar feeling for me so I think I think you should try to write games if you don’t already have an outlet like this see if games are that for you and if not I highly encourage you to go find some way to creatively express yourself with your craft because it’s very important to grow as an engineer as a programmer that you can you can express yourself creatively so what about Ruby nobody considers Ruby a high-performance programming language so is Ruby the right tool for the job for is it the right tool to build games in so when I when I first became a professional programmer I first had some interest in writing games you know cuz a lot of people get into programming because of writing games and I think games are sweet so I was like okay well you know I can write stuff I have a computer science degree so what do I need to know to write games and I thought man okay well I need to go learn C++ I need to go learn half-a-dozen graphics libraries I need to know you know what SDL stands for like I felt like there was so much I had to learn to get out there to write games but none of that is actually true so almost every language out there every every language out there has some library where you can write really nice 2d independent style games very commercially popular these are the games I love to write I love to play and that’s that’s a tongue that kind of games Ruby is no exception we have gosu and Ruby and there’s plenty of power in Ruby to write write these simple games that are very full and very satisfying to write photographers often say that the best camera that that you can have is the one you have with you so if you want to make games don’t feel like okay well there’s just so much I need to know to do that you can make games today if you know how to write Ruby programs you can write games so go make your games with Ruby if you feel like later on okay well I’m feeling kind of hamstrung I need a little more performance the lessons you learned writing games in Ruby the lessons you learn writing games in gosu poor it’s very well to to the more commercial tools I poked around in unity I wrote a couple games using unity just having background writing games and gosu and the vocabulary the the semantics of writing games the structure of games is very similar across the board so you can get you can kind of get your sea legs writing games in Ruby and if you want to go do this professionally totally room to grow into those higher-end tools but for me I found out hey I love Ruby Ruby’s a great language and I’m not making a ton of money writing games so I’m gonna have fun doing it I’m gonna write my games at Ruby so let’s get into the the kind of meat of the talk here gosu games can just be one class so we inherit from a window class and go sue and you only have to implement three methods generally and these three methods you’re gonna see them all over in game development so you like every game framework literally I’ve ever used has had these three methods to be the primitives for for building games the first thing is the constructor of your game so this is responsible for doing things like setting up the window details like what’s the size of the window what’s the title on top of it is the game fullscreen what’s the resolution if so kind of the graphics setup of your game it’s responsible for loading assets from disk so things like your image files your sounds and your music files for reasons we’ll talk about in a second you don’t want to be reading those things off discs in the middle of the game you want quick access to them so the initialize the constructor is responsible for loading all those things into memory finally it’s responsible for setting up the initial game state so things like well I have three lives so the initial I says lives equals three it’s not very complicated level is one very simple stuff the state of the game as the game begins its responsible for that so this is called when your game first runs this is called the setup method in most game frameworks so after this gets done running the game enters into an infinite loop and that infinite loop is called the game loop and then we call the other two methods in sequence in that game loop over and over again the first of those methods is the update method and it’s responsible for detecting and responding to user input so did the user press the B button okay what do I do did the user press the right-arrow what do I do it’s also responsible for updating all of the state of the game so if the user press the B button I’m shooting a fireball if the user press the right-arrow I’m adjusting the players position five pixels to the right that kind of stuff finally the draw method it’s responsible for drawing the current state of the game to the screen so it doesn’t change anything about the game it just goes through say all of our image assets and says okay well based on the state of the game right now I’m gonna draw the hero right here I’m gonna put three hearts in the top right corner all this kind of stuff and so these are called in a loop the game loop and each time we go through that loop that’s called a frame and however fast were going through that loop that’s called the frame rate and ghost who tries to run games at 60 frames a second but obviously if you have a bunch of stuff in these two methods that can slow it down this is why we load images into memory because if you had to load all of your image files into memory on each frame if you try to do that 60 times a second your game is going to run really really slowly and you’re gonna turn your hard disk into a pile of slag so that helps us keep upper frame rate and that that’s basically at a very high level how games work so to demonstrate these concepts I wrote a really amazing game called winner winner chicken spinner and how this game works is the chicken there he spins until you press the spacebar and then when you press the spacebar the game ends it’s over and if he stops in the highlighted area you win if he stops outside the highlighted area you lose the game is over so the implementation of that game it goes like this so first we’re inheriting from gosu window at the bottom there where we’re instantiating our game and we’re calling the show method on it I don’t know why I named this game window that’s a terrible name it should have been winner winner chicken spinner window so so anyway here’s the implementation of initialize we have first we have the three responsibilities of initialized and I kind of made different code paragraphs for the responsibilities first it’s responsible for setting up the window it’s saying okay superclass make the window 480 by 480 it’s setting the title of the window to winner winner chicken spinner if the game were fullscreen we would set that up second it’s loading all of our assets into memory so the the way we do that is we just instantiate the image class we give it a path these are just PNG files there’s no fancy games only image format here just PNG files we have the chicken plate disk thing we have the arrow and then we have two different images at the end of the game if the player wins we’re gonna draw that fantastic win logo and if they lose the sad lose logo on top of everything the last bit there is setting up the initial state of the game so winner winner chicken spinner has really three pieces of state it has the current rotation of the chicken because each frame we’re gonna rotate that chicken a little bit so he starts spinning it has a game over flag so we know to stop spinning the chicken when the user presses the spacebar and it has a one flag so we can tell are we showing the win image or the lose image on the GAMEOVER screen the update function remember is responsible for checking for user input and it’s responsible for updating the state of the game so if if the game is over like the users press spacebar this function does nothing because the user can’t press spacebar again and they can’t cheat however if the game is not over we want to check to see if the user has pressed the spacebar in this frame so if they did we can we can use the button down method and it has a little constant called KB space all the keys on the keyboard have these constants they’re all in the gosu docs but if they press the spacebar we’re gonna set that game over flag we’re gonna set the one flag to whether or not we won and that just looks at the current angle of the chicken to figure that out and it was a lot of trial and error to come up with those numbers there were there was no trick there and if neither of those things are true we’re just going to rotate the chicken by 10 degrees by adding 10 to the chicken angle and that that is all update does the draw method remember all it’s doing is it’s saying I’m gonna render the state of the game to the screen whatever the game looks like right now I’m just gonna draw that so the arrow the little blue arrow that you saw we’re always going to draw that to the screen that’s at x equals 320 y equals 200 it’s important to note and gosu that the origin 0 0 is on the top left hand corner of the the game window not the bottom left-hand corner so as you go down your y-coordinate goes up some game frameworks like to do bottom left some like to do top left I don’t really know why but gosu is top left kind of framework the last number there is the z-index and if you do any web development you probably familiar with that it’s just the the draw order of the images the arrow will be on top of anything with the Z and X less than one and under anything with a Z and X greater than one the next bit is drawing the chicken plate so we’re going to use the draw our ot method because we want to rotate it it’s the same XYZ stuff there but we have the angle and degrees that we want to rotate the chicken you’ll note we’re not setting it or changing the angle we’re simply drawing the angle that the update method has set finally the B game over state so if the game is over we want to draw the game over screen and the game over screen depends on whether or not we won the game and if we won the game we’re going to draw the win image otherwise we’re gonna draw the lose image and we’re gonna draw it at z-index of two so it’s on top of all the other stuff on the screen and that’s actually all the code there is in winner winner chicken spinner but winner winner chicken spinner is a very very simple game and if you came to a talk about making games you probably have like ideas in your brain about games you want to build and they don’t look anything like that so we’re going to make another very simple game a toy game but it will have it’s a little platform game and that has a lot of important kind of mechanics pieces of games that you’ll you’ll will map to pretty much any kind of game you want to build so you don’t have to make that huge mental leap from winter winter chicken spinner to what do I actually want to do so let’s jump right into the code on this guy so first the idea is we have a little I and we want to be able to move him around on the ground just like a real platformer game and we wanted to to be able to jump so we’re gonna make a new game this one’s called running hero and we have two images right now the hero image and the background image we’re gonna load those into memory and then we’re just going to draw them statically on the screen you know how to do this from winter winter chickens spinner the next bit is we’re gonna make our guy be able to walk or at least be able to slide along the ground in an orderly fashion so in a platformer game the rules of movement are that the player can move to the left or the right but he can’t move up and down and if you want to build like your top-down like Zelda kind of game you just change the perspective and then the player can walk up and down to the same principles apply them so all we got to do to walk we’re gonna store the current position of the hero in an array with with the X and the y coordinate and in the update function remember update is going to check for that user input it’s also going to change the state of the game so when they press the right arrow we’re gonna want to update that position by by changing the x coordinate and when they press the left arrow we’re gonna want to subtract from that x coordinate so we wrote this little move function that does that it just adds or subtracts 5 to the to the x coordinate based on the speed thing which you can set and change to make your hero a little faster the only change I had to make to the draw function was just quit using quit using hard coded numbers and start using our position when we’re rendering our hero and that’s all there is to drawing the hero and make him making him be able to slide across the screen jumping is a little trickier and you kind of have to think about how jumping works in real life and then you sort of have to like dumb that down for games and I kind of just made this up for this talk so there’s probably some way better way to do this but this is a simple way and it made sense to me so how jumping works in running hero is you can only jump if you’re on the ground so there’s no double jumping antics but when you jump you get a certain amount of vertical velocity and then each frame the game’s gonna look does the does the hero have vertical velocity if so I’m gonna move their y-coordinate up by that number and then I’m gonna divide their vertical velocity by some some amount of gravity and then eventually they’re gonna they’re going to run out of vertical velocity they’re going to be at zero and then they’re gonna start falling so I’m gonna give them negative 1 vertical velocity and then each frame I’ll be multiplying that velocity times gravity so they’ll go faster and faster and faster until they hit the ground and then we can they can jump again so maybe some code is a better way to explain that so the implementation of that just in the update function if the user presses the spacebar we’re gonna call this jump function it just does nothing if the user is already in the air otherwise it’ll give them a vertical velocity of 30 pixels per frame the other change to the update function is we’re gonna call this this handle jump function which is going to do all that math we just described and updating the hero’s position and updating vertical velocity the implementation of that we have this gravity constant of 1.75 just has to be greater than 1 I just fiddled around until I found a good feeling number you will see that a lot in my game is just most of these numbers are just made up the ground level I can talk about that in a second it’s just the y-coordinate where the hero is standing on the ground because that is currently how we’re gonna find out that we’ve landed the next bit just subtracting the vertical velocity from the hero’s y-coordinate because remember the top of the screen is y equals 0 so as you go up your vertical velocity goes down and then when you have negative vertical velocity your y-coordinate will start going up again the next paragraph thing there is just changing the vertical velocity so if the vertical velocity is zero that means the hero is at the top of the jump and we need to start falling so we’ll give them a vertical velocity of negative one so on the next frame we’ll start falling if their vertical velocity is negative that means they are falling so we’re gonna multiply their vertical velocity times the the gravity constant so they’re falling a little faster on the next frame and if they’re going up then we want to divide the vertical velocity by the gravity constant so they go up a little less on the next frame the last bit they’re like I said so when we get back on the ground we need to know that we’re back on the ground otherwise we’re just gonna fall forever so how we’re doing that is our ground is a straight line so the hero is always at the same y-coordinate when he’s standing on the ground so we could just look at the y-coordinate if it’s at the ground level then we can stop jumping since it’s a platformer game eventually our gonna get to the point where you have platforms to jump on that kind of thing you know the logic will have to change you’ll have to use something like collision detection to know if you’re on the ground or not but that’s that’s actually all there is to jumping and to walking so now our guy he can walk and he can jump but he does look a little silly because he cannot look to the left which is sad and he also kind of just moves like a cutout paper doll and not not like a real hero you know it doesn’t feel like a game yet it feels like a toy so in this chunk we’re gonna animate the guy we’re gonna add a few poses to him and make him look like way better so to make the guy be able to look to the left we’re going to need to know which way is facing and that can change as the game changes so we need a new piece of state so we’re gonna store the direction he’s facing we’re gonna update that direction in our move function because that’s the only way currently that our player can be turned around to face the other way is that they start walking the other way and then we’re gonna do this little trick in the draw function so one way you could do this is that you have a left facing image for every image in the game but that tends to get a little unwieldly and it’s a little hacky so a better way to do it is that the the draw function on the image class has a scale X and a scale Y parameter and if you set those things to negative numbers it actually will mirror the image and make it face the other way on that axis so if you set if you set scale X to negative 1 it’s gonna flip the hero over back the other way and he’s going to be facing the other other direction back to back with his original position to compensate for the fact that we just move the hero to the to the left by his width we’re gonna add the width back to the x coordinate so now our hero can be standing in the same spot but he can turn around and can face the other way so pretty neat little trick there so now our guy can look to the left he can look to the right but now we need to animate him so animation in gosu is very simple and by simple I mean you’re on your own so so what you do is you get an array of images and each frame you just decide this is the one I’m gonna draw this frame so you load up you know all of your stuff into an array and then and then you pick based on the state of the game which of these am I gonna draw fortunately we have a really easy way to get a bunch of images into an array and that’s by using spreadsheets so sprite sheets are a very very common tool in games development you just basically take all of your images that you want you make them all the same size and then you put them all in a bigger image and then you load them into your into your game and you say all of my sub images are this size cut them out for me and it’ll do that for you this is usually done for complicated graphics card reasons but in running hero it’s done because it makes the code nicer that the thing there behind the blue wall is our our sprite sheet so we have seven poses for our hero we have the standing still and doing nothing pose we have three frames of animation for walking so if you play these in a loop it looks like walking it’s called a walk cycle the fifth the fifth image is the player kind of with his arms out going up I don’t like I don’t know why this is going up I’ve never jumped like that but that is what going up looks like for our hero for going down our heroes kind of looking down at the ground and then the last image there is like our our hero’s been hurt and he’s stunned or just very surprised so to to build all this animation all these poses into our game in the initialized function remember we load assets there we’re gonna we’re gonna use the load tiles class function on the image class we’re gonna give it our sprite sheet we’re gonna say our sprites are 64 by 64 so load those all into memory and this this will just return that array for us of regular images we also need to keep track of which image we’re going to show on this frame so we have this piece of state called the current hero image which update is gonna check or which update is gonna set and then draw hero a draw is going to draw so in an update we’re gonna look at the state of the game to figure out which frame to draw so if the hero is jumping that means they have a vertical velocity and based on that vertical velocity we’re going to decide to use the going up or coming down image if they have a positive vertical velocity will use the going up image if they have a negative vertical velocity will use the going down image otherwise if the hero is walking one of the weird things about this is that the hero can be jumping and walking at the same time so if the hero is walking then we will just use the one of these three images in the walk cycle and you don’t want to just loop through these like one per frame because your game runs at 60 frames a second and this animation looks ridiculous at 60 frames a second so you want to slow that way down without slowing down your whole game so how we do that is we can take the number of milliseconds since the game started divided by a hundred and that gives us ten frames a second so we just take that number modulo 3 and that gives us a loop you know 0 1 2 0 1 2 we add 1 to that and then we get the right offsets in the in the array for the hero image that we need to show this frame finally if the hero is neither jumping nor walking we’re gonna just set the current hero image to the the resting hero image the first hero image and the only change we had to make in the draw function was that we want to use the current hero image instead of that old static hero and shockingly that is all that it took to animate our guy and actually he looks a lot better right now and he’s feeling great about life however our game is missing a plot it’s missing drama and to have drama you need to have pain and you need to have suffering and in games in order to have pain and to have suffering you have to have collision detection and so we want our guy to be able to slam into things we want our guy to be able to get hurt and so we’re gonna add a bad guy who currently doesn’t do anything so he’s not really that bad he’s more of a painful obstacle but it’s gonna it’s gonna let us start building collision detection to our game so how does collision detection work well in our game we are going to put rectangles imaginary rectangles around our hero and around all the stuff that our hero can run into and then we’re gonna look for intersections of those rectangles and if there’s an intersection that means there’s a collision there are other ways to do this there’s so called pixel perfect collision detection which will tell you exactly which pixels overlapped between two things on the screen but basically every platform I ever played as a kid used rectangles and it’s very it feels great it feels good it’s also very conceptually simple it is you can run these in constant times so it doesn’t matter how big the the things are that you want to detect collisions are the collision detection is always just a very easy math and it’s it’s totally good enough for our game so this is what we’re gonna do so let’s draw our enemy into place so we we just have a static enemy image for now we are going to draw use this draw collision bodies method which I’m going to talk about in a second it just draws rectangles around the physics bodies in the game so you can see like where do your rectangles need to be we have a couple changes in the update method so first of all our hero can feel pain now so we have this hurt until timer thing so our hero can be hurt for a little bit but then we want him to recover so how this works is we’re gonna set if the hero gets hurt we’re gonna set hurt until to sometime in the future and then if that is set we’re gonna say okay the hero’s hurt once you get past that time you can unset it the the last bit there is we’re just gonna call this handle collisions function because we need something to detect and respond to collisions in our game and how is it going to respond so a couple a couple different modes of collision detection that can happen in our game first of all the hero can run into the enemy from the side like from the left or the right and when that happens that means the hero made a mistake so he should be he should be hurt and in order to hurt the hero we’re gonna knock him back 30 pixels and then we’re gonna you know stun him for a little bit however if we collide with the bottom of the hero that means the hero jumped on the enemies head and as we all know if you jump on the enemies head you did a good thing in the enemy should die so that so right now we don’t know how to kill an enemy so no we’re not gonna talk about that but we are going to give the hero a little bounce which is a very cheerful celebration of jumping on the enemy’s head so handle collisions is implemented like this the first third of the code there is just defining the rectangle around the player and around the enemy there are a billion ways to describe rectangles in code I chose the worst one which is to use a hash but it looks good on slides so that’s why I went with that in real life I probably would have used a struct or even just an array with the two corners specified it’s probably a superior way to specify a rectangle the the next bit there is we’re calling this check for collisions function which for now all you need to know is it takes two rectangles if there’s a collision between those two rectangles it’s going to return the direction of that collision relative to the hero so if the hero gets hit on the left side it’s gonna return the symbol left if the hero gets hit on the bottom side we’re gonna return bottom and then the logic for how to deal with those collisions the if you get hit on the left or the right that means you want to get knocked back by 30 pixels and we’re gonna set the hurt until timer to the current time plus 200 milliseconds which again just a magic number I made up because it felt it felt pretty good if you collide with the bottom of the hero however you want that little bounce so to bounce all you need to do is set that jumping flag to true and give the hero a vertical velocity of 10 pixels per frame the check for collisions function I just described so first you need to get the intersection of the two rectangles you were given so yeah this is very simple math if you had like three minutes and a piece of paper you could figure out how to get the intersection of two rectangles but I just got my answer off Stack Overflow and and if if there is an intersection we can use that intersection as a heuristic for figuring out the direction that the collision came from the reason we can do this is because okay so if the if the intersection is wider than it is tall so if it’s like a landscape style intersection we can know with high probability that the intersection came from the top or the bottom of the hero rectangle the reason for that is because the rules of the game don’t allow you to intersect very deeply with another rectangle like it’ll stop you it’ll knock you back 30 pixels or you’ll bounce off the enemies head so if if there if it’s wider than it is tall that means okay these rectangles aren’t very thin it’s probably a top bottom collision and otherwise it’s a left-right collision for the same reasons so knowing that we can look at the the top of the intersection and the top of the hero rectangle and decide if it’s a top collision by checking if they’re the same because if they’re the same that means the top of the heroes rectangle is pushing through the bottom of some other rectangle and if it’s a wide intersection and it’s not a top collision then it must be a bottom collision so the same kind of trick applies to the left/right thing if we know it’s a left-right collision we can look at the left of the intersection and the left of the hero rectangle and if they’re the same it’s a left collision otherwise it must be a right collision that was a lot of words and not very many diagrams so this is that draw draw collision bodies function I talked about you should definitely do this if you’re gonna write a game with collision detection because it’s very tricky to dial these numbers in without having some visual aid all it is is just drawing drawing four lines makes a rectangle goes who has built-in drawing functions draw line is a neat one so I set a debug flag whenever I want to draw the physics bodies in the game and that’s that’s all there is two collision detection so now our guy can get hurt he can bounce off the enemy and he can celebrate and triumph so the very last bit of the game so we we want to make it flesh it out a little more we want to be able to kill the enemy we want the enemy to be a little bit smarter and we want to be able to keep score so the first thing I did was I separated the enemy class out as its own entity because eventually your games just gonna get unwieldly if you leave it in one class forever so this is one way you can start moving out various entities in your game to have their own logic also maybe we want to make a bunch of enemies and so this is a neat way to do it so we implement a update a draw and a body method on the enemy class here the update and draw methods are just called on all enemies in the appropriate method in the game so every update call is gonna call update on all the enemies every draw call is gonna call draw on all the enemies and the enemies know how to draw themselves the enemies know how to update their state as the game progresses the body method just returns the rectangle for collision detection because the game itself is still going to be responsible for detecting those those collisions so here’s how we plug that in we have we’re gonna instantiate an enemy in our initialize function we’re giving it a sprite sheet now instead of just a static image you could make many enemies we’re just gonna make one for this the purposes of this talk in our update function we’re gonna call update on all of our enemies and our draw function we’re gonna call draw on all of our enemies and in our collision detection function we’re gonna loop through all of our enemies and we’re gonna check for collisions on all of them otherwise the logic remains the same and since we have that in place we can now implement the draw and update functions on the enemy to handle those bits so the draw function on the enemy the enemy only has two States he can either be alive which means he’s walking around or dead which means he’s so in our spreadsheet for enemy we have four frames of animation so we just do the same kind of thing we did with the hero with the the milliseconds trick to loop to slow down the animation and if the enemy is dead we have a little squashed enemy image there on the end the call to draw just uses some ternary stuff to figure out if the enemies facing the other way and if he is flip him over so he’s facing the right direction the update function is responsible for the brains of the enemies so if the enemies dead the enemy’s brain is no longer functioning so it doesn’t do anything otherwise we want to move the enemy five pixels in the direction he’s facing and if the enemy walks off the screen then we want to turn him around so he’s facing the other way so he starts walking back so besides AI and besides drawing the enemy we want to be able to keep score so we’re gonna have this new piece of score State it starts out at zero as one might expect we’re gonna load a font into memory this is just a TTF file nothing too fancy you give it a size you say it’s a 64 point font and load this file then in the draw function we’re just gonna say hey font draw the score in the top left corner of the screen and draw will happily oblige finally to get points we’re just going to update our update or handle collisions functions so when we have that bottom collision we’re gonna set the enemies alive flag to false and we’re gonna increment our score and that is the final product of running hero so you can see if we could jump on the enemies head we can get points we have drama and you can imagine how like going from here okay well you can make this a full game you could you could add an endless number of enemies coming at you that gets smarter and better you could add power-ups and and and weapons and and all kinds of stuff you could make platforms and levels and goals and hopefully you have a starting point where you could start thinking okay well that that’s how I would do that and go sue a couple of resources for your your game development career highly recommend open game art huge resource if you look at the game development community this is like the one everybody says use this the hero image and the enemy image both cc0 images I pulled off of open game art you can go there and build a collection of images for for a game idea you’ve got you can just go there for inspiration they have sound effects music tons of art just a great resource for tools for image manipulation you can use whatever you want you don’t need anything super fancy but if you got Photoshop you might as well I use paint and paint like tools I think I use Pinta on the Mac but also occasionally pico pixel which is a dedicated pixel editor all that stuff is free I highly recommend the tiled map editor so when you’re building a game you’re gonna start building up all these chunks of games like okay well I built this kind of enemy thing I built this kind of block and you’re gonna want to layout your levels your Maps you can load all of your stuff into tiled and then it’ll export JSON or XML you can parse that in excuse me you can parse that in your game and it makes it makes building levels so much nicer highly recommend that tool of course you can get gosu all the docs for goes to a really great tutorial on gosu from lib gosu org highly recommend it I check it out so I hope you all feel inspired to make your own games now I hope you feel at least a little more equipped to go make games now and I thanks for coming to my talk I think we have about a couple minutes if anybody has any questions so for testing okay so testing and gosu you can write unit tests that do things like send keystrokes to the game testing in games is really fidgety because there’s so much that can happen there’s a lot of state that has to be setup and so TDD in game development doesn’t seem like to be much of a thing but certainly like sanity checks and tests like that are a lot more appropriate in game development it’s a lot more experimental and like okay I did a thing how does it look how does it feel kind of kind of iterative development uh the most the most fun game i made with gosu man all my games are terrible okay so okay so the most terrible game I made with gosu I made a game that it was really just kind of this stupid art game but it has this little fly and he starts buzzing around on the screen and then you slap the fly and then more flies appear and then you killed more flies and and then eventually run out of time in the game ends and you just try to get as high a score as possible like I don’t have with me sorry but I’ll put on my github so so everybody can see how bad I am at this my github it’s on the first slide github.com slash Chamblin yeah there’s the link to the github all these slides and all the code for this talk will be on on that github do I think they’re gonna make a library to write VR games in Ruby I think it would be tough just because 3d is more computationally intensive it might be possible but I think it would be it would be very constrained by the performance of Ruby is there a 3d library I don’t know of one there there probably is but I’m not aware of one yeah so the question is the question is like why do you draw the the same images in every frame does that sum it up so my understanding of how it ends up working is that you sort of end up with a blank slate each frame and like for video memory reasons or whatever and so you’re actually just gonna redraw everything every frame anyway but if you think about if you think about games from the point of view of like regular application development it seems very weird that I have to keep drawing this thing all the time but under the covers your your graphics card has to redraw things every frame so this is just getting very explicit about that no more questions all right thanks everybody

As found on YouTube

Upgrade & Get 6 More Frameworks For: Sales Letters, Headlines, Bullet Points, Lead Capture, Webinar Registrations, And Facebook Ads. New Revolutionary Software That’s Designed To Help You Sell Anything! Here is a simple 4-step plan to make a living or at least supplement your income with the sales copies you can generate from VSLmaker in minutes.

Leave a Reply

Your email address will not be published. Required fields are marked *