00:00:15.679
so uh game development in Ruby is my talk my name is Andrew Nordman but
00:00:21.840
unless you either birthed me married me or I owe you substantial amounts of money you probably know know me as CAD
00:00:28.359
or Kwan uh I talk on Twitter at about code beer and my kid at Kwan and I ship
00:00:35.320
a lot of code at Kwan or I try and release just about everything that we make at Agora games under the Agora
00:00:42.079
games repository uh speaking of Agora games my day job I work at Agora games which is a
00:00:50.000
game Services platform for game development Studios the big thing that we do is we create uh middleware for
00:00:57.000
major game development Studios and independent game studios alike to create uh things that they don't generally have
00:01:02.719
time for or want to offload across multi-title things for example leaderboards matchmaking uh Community
00:01:09.479
sites statistical analysis things of that nature we've worked on a lot of really cool projects uh some of the more
00:01:14.759
notable ones included Saints R III Mortal Kombat uh Guitar Hero uh all
00:01:21.159
sorts of cool stuff additionally Agora games is part of Major League Gaming which is an Esports company we do a lot
00:01:28.280
of really cool uh online and live event uh games and uh in particular if you're
00:01:34.360
interested in Starcraft 2 Halo Call of Duty Black Ops or Tekken or Mortal Kombat right now we're actually going
00:01:40.520
through one of our six live events of the year at MLG Dallas so if you're bored tonight feel free to go to majorly
00:01:46.200
gaming.com and check it out however uh my company didn't pay me to come to this event so that's the last that you're
00:01:52.680
going to hear about my day job instead I want to talk about how I
00:01:57.840
accidentally left text on my no I actually want to talk about a little bit of history of why I wanted to
00:02:03.240
do this talk uh I have a rather complicated relationship with the Unreal
00:02:09.000
Engine series uh yes I started out working with it uh back in the Unreal
00:02:14.480
Tournament days uh the original not 2003 2004 at the time where they released the
00:02:19.680
unreal editor and it was a great opportunity for someone who wanted to start working in game engine uh game
00:02:24.920
development but didn't want to have to deal with the lower level complexities of games uh dealing with renderers game
00:02:30.640
Loops all that that craziness so perfect for someone in high school who wants to do something other than sleep in class
00:02:36.599
um it was a great tool set but the problem that I had at that time was that I was running on a terrible 2000
00:02:42.840
computer and it had some rather stability some major stability issues um
00:02:48.200
generally I would end up having to load up the engine go take a shower come back and the computer had finally decided to
00:02:54.360
load up the environment so that I could start working only for me to open up the the level that I was working on and go
00:02:59.959
do something else for another five minutes as a result I got to make some really interesting stuff with the level
00:03:06.440
leveled designer and start working with scripting but ultimately I just had to
00:03:11.560
walk away from it because of the fact that you when you can only do so much with the stability of an environment uh
00:03:17.640
eventually you're going to find other things and so I did find other uh game development related stuff to do and I
00:03:23.480
tried uh I stayed away from the unreal series for a while until uh epic games came out with the Unreal Tournament 2003
00:03:29.959
2004 and completely revamped the unreal editor engine to 2.0 but most importantly created the make something
00:03:36.640
unreal contest I don't know if any of you are familiar with that but what it was is epic games decided that they
00:03:42.080
really wanted to bring up more modding capabilities and bring in more excitement for their new engine so they
00:03:47.360
created a contest where they would give away thousands of dollars wor worth of prizes and Monies to uh poror saps that
00:03:55.000
want to deal with modding and uh bring in more promotions and being someone was eating ramen noodles very frequently I
00:04:01.760
decided hey I should come back to this engine so I jumped back in I had also
00:04:08.680
gotten through and replaced my terrible 2000 with something much faster so that I could actually load the thing up and
00:04:15.120
started diving in and that is when I realized that the Ed the editor itself
00:04:21.799
while having stability issues wasn't necessarily my problem the problem is that the Unreal Engine is split up into
00:04:28.560
two components the first component is unreal Ed and what it's focuses on is on level design the event trigger system
00:04:35.440
particle event management effectively all of the things what I like to call the non-technical technical aspects of
00:04:41.840
game development anything where you don't necessarily need to do a whole lot of uh programming to and you can U
00:04:47.240
through a guy editor uh in particular it was very useful from a mod perspective because you could within one click load
00:04:53.919
in an instance of whatever you were working on and that was the great stuff that was what I loved working with uh it
00:05:00.039
was very straightforward and quite nice and then there was the other side of it
00:05:05.960
unreal script unreal script uh was the core component that glued everything
00:05:11.199
together so that you wouldn't have to go down to the C++ level and it was designed by epic games and inspired by
00:05:18.520
Java it was it's it's a rather verbose scripting language which has some rather
00:05:23.759
awkward oo principles I'm going to bring up a a script a sample here and there were a lot of language components that
00:05:30.199
they just kind of threw out of the way like Constructors and destructors gone who who cares about that sort of thing
00:05:36.720
uh and I generally found that my main problem was in dealing with this scripting language but I didn't really
00:05:43.319
find much better than it so I ended up working with it anyway so here's an example of some some basic unreal script
00:05:49.560
code this by no means exemplifies all the problems that I have with how unreal
00:05:54.639
script is structured but if you look on the left uh the first SE slide actually deals with uh describing your mod and
00:06:01.840
you end up comp packaging everything out into into sepal subcomponents and you see the extension in order to handle
00:06:08.599
bringing down your other stuff but its definition of default properties is how
00:06:14.440
you would essentially Define all of everything is going to be structured without having to create an initializer
00:06:19.680
because destu Constructors don't exist and you'll notice that there's no
00:06:25.599
semicolons no commas no method of I'm not even really sure what it is that
00:06:30.840
they're trying to accomplish by not having any sort it doesn't make sense the default properties doesn't really
00:06:37.000
make a whole lot of sense other than I'm going to list out a lot of variables moving on to the right this is an example of a pawn object which within
00:06:44.759
the unreal system is essentially a person or an entity that's moving around within a given level um in in this
00:06:53.080
instance I'm creating my own version of a pawn which I'm going to be using for a sid scroller which I in order to do a
00:06:59.599
side scroller you don't want people to be going around in a complete uh XYZ system so we've extended it and you'll
00:07:07.639
notice a really weird thing about the def the definition of the class first of all uh one file is one class and there's
00:07:15.479
no form of wrapping because you'll notice on the first line at the end is a semicolon and nothing braces it all
00:07:21.720
together which already was a little weird but extends UD pawn udn pawn and
00:07:27.400
depends on udn Pawn that's a little confusing what is actually happening
00:07:32.560
here is that you're pulling in the udn pawn for extension from The Inheritance
00:07:38.000
perspective however if you want to override another method with your own definition while still having access to
00:07:44.280
the parent method you have to depend on it otherwise super doesn't exist uh yeah interesting so you'll
00:07:52.000
notice the the simulated function tick is the method that I'm trying to override here and off the bat super
00:07:59.720
looks weird because super is no longer a definition of the method the parent method that you're trying to call but
00:08:05.479
the parent class so now you have to refer to the individual method even though you're in that particular method
00:08:12.400
um and again you see your default properties of silliness so I'm not really a fan of
00:08:20.159
this I didn't really like this and at the same time I was also uh working in school for building my own game engines
00:08:26.800
and using with the torque engine provided by garage games so again I walked away from the Unreal
00:08:32.519
Engine going you're good but I got to deal with something else and then later this year for work
00:08:39.560
related things I decided to jump back into the latest version of the unreal development kit and what was interesting
00:08:46.279
about the unreal development kit is that it ended up extracting a little bit away from the modding community and focusing
00:08:52.000
more on building games using the Unreal Engine and import more importantly being able to use them outside of just PC
00:08:58.800
games you can use udk in order to create mobile games as well and since that's
00:09:05.560
relevant to my work interests I decided hey I like pain let's see if anything
00:09:10.760
has really changed and they've done some great things with the Unreal Engine uh major un improvements to the unreal Ed
00:09:17.839
side but unreal script mostly changed and so if I was going to end up working on this with a regularity I felt like I
00:09:24.680
needed to create something that decreased this pain like I had worked in other languages I'd worked on the lower
00:09:31.360
end I've worked a lot with Ruby maybe I could find some sort of way to correct
00:09:37.440
this pain so I got the idea after working with a lot of uh coffee script maybe I could write a cross compiler so
00:09:45.240
that I could write Ruby code run it and then convert it into unreal script which
00:09:52.279
udk would pull in so I thought yeah this is a good idea I talked to some people they like yeah this would be a great
00:09:58.120
opportunity so I created unreal RB uh written in Ruby Ruby code in unreal script out felt
00:10:06.560
great started work on it and uh you'll notice that if you try and Google unreal RB you won't find it anywhere and the
00:10:13.519
reason for that is this was a terrible idea the biggest problem that you have
00:10:19.160
with trying to build this construct that I was running into aside from poor performance was that I was trying to
00:10:25.279
build something that was not that was completely changing how unreal script worked with the engine you couldn't T
00:10:31.680
get down to the lower levels of C++ with the unreal with udk because that
00:10:36.959
required a game engine license rather than just access to udk and while I'm no longer eating ramen noodles 5 days a
00:10:43.720
week my discretionary income of throwing around3 or $4,000 in order to get access to the engine not really high on my
00:10:50.519
priority list so what ended up happening was it really just evolved into a really primitive DSL built on top of unreal
00:10:57.000
script it functioned but it didn't all it really did was just rearrange some code Shuffle it around and uh didn't
00:11:04.160
really function the way that I was hoping for so saddened by it I I threw it away and I just resigned myself to
00:11:10.200
writing on real script but the reason why I talk about all this is it got me to thinking that Ruby is a really great
00:11:16.839
language in the game for for things that are being used in the game industry and
00:11:21.959
there has to be some way to be able to compose the Ruby the great components of Ruby into game engines and games
00:11:29.000
themselves so I started looking into how we could Ser we could solve this
00:11:34.600
problem so let's shove all of these things together so there's really three
00:11:40.399
paths in game development that I want to talk about today the first is using Game libraries as a means of building games
00:11:46.240
in Ruby that's um the intro that most people if you're interested in uh or
00:11:52.279
Googling game development in Ruby or Ruby games you'll start down that path the next is trying to use existing
00:11:59.800
engines uh that already are out there in a scripting fashion to how to uh add
00:12:07.279
inject Ruby in and the third is just building an entire game engine using Ruby or with components of Ruby built
00:12:15.040
in so we're going to first talk about game libraries game libraries are
00:12:20.600
designed to abstract low-level game internals uh the main components there therefore is to not have to worry about
00:12:27.320
input collection rendering and uh the iteration timing the the main goal of it
00:12:33.199
is that you don't really want to know about how you do the low internals of
00:12:38.800
starting an event Loop uh pulling in the inputs triggering all of that stuff you just want to start making games this
00:12:44.639
focuses on ignoring engines entirely and you get to focus on building a game you
00:12:50.760
got a game idea let's start jumping in so these are your minimum requirements
00:12:55.839
those three pieces there have a a main game Loop Handler have a graphics render and an input
00:13:03.000
Handler and most Ruby game libraries are built on one of two either Ruby game or
00:13:08.079
go Su and there are a lot of uh extensions and
00:13:15.240
derivatives the most prominent one and the reason why a lot of people will Google Ruby games or Ruby game
00:13:20.839
development and then promptly stop looking uh is Ruby game Ruby game is the
00:13:26.199
easiest one to pick up because it's Ruby and game in the name however it's not not actively maintained the last time that commits went to it was over 2 years
00:13:32.360
ago so people see that there's nothing really going on with it and they go wow that's not
00:13:37.560
great but it did do some rather interesting stuff because it did a purely Ruby implementation it uses the
00:13:44.760
sdl library for being able to handle the lower level components and uh it focuses on everything in Ruby
00:13:52.279
all the time conversely and the one that is more actively maintained and I would recommend if you're interested in trying
00:13:58.480
to make some Gam and get into Ruby game development is gosu it is actually a C++
00:14:04.040
library that uses Ruby a ruby rapper with Swig and also is accessible on uh
00:14:09.920
doing M iOS applications it uses opengl for rendering and it's actually been a
00:14:15.680
lot of interesting work that has been uh that has gone into it of late so let's take a look at the anatomy of a game
00:14:20.959
within gosu you we've already talked we've got those three core components that a game Library needs to have in
00:14:27.199
order to be really effective so when you're dealing with GSU you need to create a subclass to the GSU window and
00:14:33.160
you can only use one instance of this subass and for the the reason being that at a lower level in order to be able to
00:14:40.639
handle rendering you need a device context in order to be able to send out your your rendering commands and GSU has
00:14:46.399
tightly bound this in with a concept of the G individual game so you only ever have one window and you need to uh act
00:14:52.800
accordingly and it implements these three methods so here is the barebones of a g Su application you you need those
00:14:59.440
three methods that handles it you add your game logic you add in your rendering logic and a single button down
00:15:05.240
event which operates kind of conversely from what you might expect in that you're not looking for when an event
00:15:11.320
happens this is more of an event triggered a button somewhere has been pressed here's the idea of the
00:15:17.279
particular button that's been pressed figure out what you want to do with it so uh when looking into gosu I
00:15:24.279
decided to make a really primitive blackjack game if anyone has actually played blackjack you'll know that this is a poor implementation because you
00:15:29.959
can't split erases you can't double down and there's no benefit to winning but it does help us examplify
00:15:38.079
some of the problems with using Game libraries uh outside of its convenience so first we're going to take a look at
00:15:43.839
the initialized method in blackjack and you'll notice that there's a whole lot of resource rendering it's just a lot of
00:15:51.199
initialization of G through images you need to goes to font in order to write anything out to the screen and that self is actually a reference that is
00:15:58.079
necessary in order for the image to be rendered because it's taking that Hardware
00:16:03.199
context that is bound Within game W go through window and this is really uh rather
00:16:09.720
primitive for a game not a whole lot of resources are going into here I have extracted out the 52 other card
00:16:17.199
initializations here for the sake of putting it on the screen but I almost considered not just because it
00:16:23.600
emphasizes one of the main problems you have which is that resource management is not a core component within gosu so
00:16:31.720
what a resource manager really is is it handles the creation and deletion of resource handles so that you don't have
00:16:37.240
to care is there an instance of this currently in existence in memory uh how
00:16:42.720
do I need to handle the implementation details it's an abstraction layer in order to say I need this I need to
00:16:48.120
render this I don't really care if it exists right now in memory just just do it and this is really uh an important
00:16:55.959
component that isn't really represented so here's an example of a primitive resource manager using the
00:17:01.600
same resources we had before we've created our resource manager class it handles uh registering all of the inform
00:17:07.959
all of the particular resources that could ever be used in the game uh and then all you're using in order to handle
00:17:14.199
it in the game Loop is call resourc manager. Image pulls in uh whatever the
00:17:19.640
basic handle is and now you're just focusing on calling your draw methods so looking over into the update
00:17:26.160
and and button down methods the other two methods that are required in order to make a game you start to see within
00:17:33.320
update we're starting to do a lot of conditionals for game State because at its core Blackjack you got two aspects
00:17:40.160
you're either playing or you're not that's a fairly simplified version compared to some additional complexities
00:17:46.280
so we're only using ifs but now what if we had a third option what if we decided we wanted to add a cashier or if we
00:17:52.039
wanted to add in a nice menu system or start adding in a view for high score or
00:17:58.640
what what have you we would start adding a lot of complexity into the the single update method and conversely our input
00:18:04.919
Handler is also something that is going to be toggled based on our particular game state so that's going to get even
00:18:10.679
bigger and you can see here we've got two states or do we have a game in progress or is the game over then do one
00:18:16.120
otherwise do the other in terms of button handling so we really need to abstract that out so that is the uh EI even further
00:18:24.159
emphasized when you take a look at the draw method uh for rendering we've got a lot of if game if player. standand we're
00:18:30.360
changing up what the rendering context is based on the state of the game and this is where the addition of a game
00:18:35.960
State manager is really necessary it contains all of your game elements your game logic your UI elements all of that
00:18:41.360
stuff and it contains it so that it can say all right I want to create I'm at this point in the game this is all of my
00:18:47.440
my relevant information let's load it on it and that is something that is definitely lacking Within Me many of the
00:18:54.520
game libraries that are out there so this is really what that's that's looking like you've got your primary game Loop which interfaces with your
00:19:00.799
game State manager you have multiple game states that are containing this game logic rendering and input handling
00:19:06.240
and the resource manager that's handling uh spreading that across all of the game States and that's more of the ideal
00:19:12.919
scenario for these types of games and looking at Blackjack which is rather small we've already started running into
00:19:18.200
all of this additional boiler plate that's not fun to have to write for every single game so what I want to get into now
00:19:25.840
before we expand further is the idea of entities and that's the idea that everything within your game needs to be
00:19:32.039
represented in some interactable faction and they are really the building blocks
00:19:37.280
of the game anything that's going to ever interact anywhere is going to have to be represented as an entity somewhere
00:19:42.919
and the in traditional engines this is really more of the Base Class of anything that's in there so the reason I
00:19:49.559
start with that is because there's been an excellent Library by the name of gamebox that built on top of gosu which
00:19:55.240
handles these exact things it brings in the con concept of a gosu window is
00:20:01.159
really more of a stage and you're you're showing a play your entities are being represented as actor objects which
00:20:07.440
handle all of your interactions within a particular scene which holds your game states you have a single stage manager
00:20:14.840
that controls all of the individual scenes coordinating the actors and handling all of these particular
00:20:20.840
managers and then finally you have a stage manager that micromanages all of the subcomponents these subcomponents
00:20:27.280
include uh re physics Resource Management input handling configurations
00:20:33.159
anything that you would really need in order to handle that uh abstraction layer and it's been a really interesting project that has tried to get rid of
00:20:40.280
that boiler plate by considering it more as a a play that you're is being put out in front of you that you're interacting
00:20:46.240
with so here are these uh stage hands so in in summation the the game
00:20:53.280
Library component they're really great starting points for game developers and people that are interested in game development the there's a lot of
00:20:59.000
boilerplate that gets in put into them because they're designed to be so primitive they're designed to be easy to get into and you don't need to know much
00:21:05.159
about game development in order to get them going but they're also not very performant because of that fact that
00:21:10.440
they've abstracted out all of those core components so much so if game libraries are a great starting point uh where can
00:21:16.240
we go next so let's build Ruby games with engines that are fully end end in Ruby
00:21:24.559
game engines they're allowing the developers to focus on game specific log not low-level internals but they're
00:21:30.679
definitely more isolated components and are closer to the operating system they're handling the low-level
00:21:36.760
interfacing so that you can build more in uh higher abstractions so the first one that we're
00:21:43.240
going to take a look at is slick 2D which is a great Java Library you can access through J Ruby uh there's been a lot of development on it and one of the
00:21:49.440
nice aspects about it is because it's a Java Library you can package it up easily into a jar file and be able to
00:21:55.960
transmit your your stuff uh from person to person a game that I made with that is
00:22:02.000
called breakout which was actually just an extension of the Slick 2D pong application that Peter Cooper did he had
00:22:08.080
made an excellent article about video game development with J Ruby I took the stuff and said hey um this is almost
00:22:14.200
breakout and I wanted to start introducing some additional Concepts into there one of the new some of the new components that were added with
00:22:19.760
breakout from pong is that now you've got multiple levels going on the pong was just the single level so you've got
00:22:25.320
more Pro problems you've got more physics calculations and you've got a lot more rendering you've got a lot more
00:22:30.760
components that are going on because youve got individual handles of all the individual blocks the other aspect that's different
00:22:37.320
from on slick Tutti side versus uh say gosu is that there are more internals
00:22:42.960
that are directly exposed instead of having just a G having the gosu window that combines your game State and your
00:22:49.760
your window handling you've they've split those out and you have your game instance as well as your game container
00:22:55.120
also the input Handler is part of that game container so now you can do more interesting things with uh input
00:23:01.400
handling like Mouse events for example or being able to trigger uh whether
00:23:06.840
buttons have been held down or not uh you also have more access to the renderer object before the only way that
00:23:12.440
you could really handle it is uh have your context and a particular object that handles whether or not you could
00:23:18.760
output anything to the screen so you're getting a lot more of that individual subcomponent uh functionality that is
00:23:25.159
necessary if you're going to start adding more complexity and games complex really fast another alternative is the
00:23:31.799
jmke engine which is if you wanted to move into the 3D aspect all of these previous ones were 2D game engines this
00:23:37.880
is more 3D this is also built more towards the traditional game engine that allows that splits out every
00:23:44.960
subcomponent out into its individual class and it's up to you to start interfacing with those classes however
00:23:51.360
of late they've imple instituted a component called the simple application which is actually closer to a game
00:23:56.440
Library which is nice for people that want to eventually expand their capabilities but start out with
00:24:01.600
something small that game libraries have which as you can see this is really just
00:24:06.760
three methods that closely affect what gosu already has and the other aspect
00:24:12.440
that's nice is multi-threading via thread pools very easily in your initialization you can start pulling in
00:24:18.360
multi-threading and that is going to be necessary I'll be talking more about one of the problems that we have with game
00:24:23.720
engines is that concurrency is a big deal so let's build a game engine with
00:24:30.000
Ruby what what is a game engine a game engine is a component library that consists of all of these internals and
00:24:35.880
it allows the non-game specific work to be offloaded for game developers and it
00:24:41.880
provides all the hooks that are necessary if a game needs to drop down into the engine
00:24:47.240
level over there that's a list of all of the major components of a game engine if you're going to build anything
00:24:52.640
substantial you need engine set up you've got your main game Loop your input Handler and your rendering you can see that everything we've Ted talk about
00:24:58.720
it's started to handle that component those components and it's a close representation of game engines but you
00:25:04.159
need more if you're going to build anything of substantial uh sizing so what are the challenges with
00:25:10.840
building a ruby engine because as far as I'm aware no one's ever really done a full end to-end
00:25:17.480
engine from the ground up in Ruby the big ones are concurrency
00:25:23.159
crossplatform support Library interfacing support memory management and code compilation so let's talk about each of these individually concurrency
00:25:30.840
there's been a lot of discussions at this conference about concurrency and possible opportunities when game game development
00:25:38.399
you have a lot of components that need to work in concurrent for example the renderer you can never really allow the
00:25:43.720
renderer by itself to be blocked by other components for the simple fact that you your frame rates will drop and
00:25:49.600
the user experience will be very poor uh conversely you need to be able to not have your renderer blocking everything
00:25:55.720
else that you're working on so you need to address the issue of concurrency so
00:26:00.760
the first thing that people go is hey threads we can do threads threads are great spin up some threads start put
00:26:06.360
rendering in one thread put the other components in another thread and we'll just have the game Loop negotiate the discussions between all of those
00:26:13.320
well that only works to an extent first up Gil Global interpreter lock Bad News
00:26:19.600
Bears for games uh even if you manage to have mult multi- threading going on you still need uh the ability to have IO
00:26:26.399
going on and you have a lot of different components that need to that will be invoking the global interpreter lock frequently fortunately we have some
00:26:33.279
implementations that don't have that problem uh J Ruby rubinius and Mac Ruby uh the easiest one of that being J Ruby
00:26:39.279
given the fact that its uh multi-threading and its thread pools are a lot more a lot easier to uh interface
00:26:45.480
with and customize crossplatform Sports this is the one thing that out of
00:26:54.240
not looking at it from a game engine perspective is what I would consider a big flaw within Ruby's development is
00:27:00.080
that our support for Windows is that it's gotten better but it's still bad
00:27:05.880
trying to interface with uh with Windows just based on the fact that yeah it's Windows great we we all know that there
00:27:12.840
are some problems with dealing with it with Windows as a whole but we shouldn't be just discarding Windows as something
00:27:18.640
that is just too much of a pain to deal with there are a lot of issues with some of the core libraries and standard
00:27:25.360
libraries within Ruby for Windows support um we already know that okay forking is not allowed but uh just
00:27:32.360
trying to deal with a low-level internals uh have caused some rather interesting problems with libraries that have tried to address this issue for
00:27:38.520
example openg GFI is a great opportunity to try and Abstract out all of the openg
00:27:45.000
calls across languages however to date Windows support is basically non-existent as a result of a lot of
00:27:50.919
problems within the Ruby Ruby core there have been some interesting uh attempts at trying to resolve it however
00:27:56.679
ultimately that language has basically been that library has basically stagnated over the last couple of months as a result of it and that makes it even
00:28:03.640
harder for trying to be able to come up with game engine because you don't necessarily want to build an engine that only runs in one particular operating
00:28:09.840
system of your choice uh jvm helps mitigate these issues by running on uh J Ruby through
00:28:17.519
the jvm helps mitigate some of these issues but I would like to see something other than J Ruby be an option I I like
00:28:24.399
the the the project there but I get bored of trying to say throughout this spee that that J Ruby is uh the answer
00:28:30.440
to some of these problems so one of the ideas that was proposed when I was talking to people
00:28:36.399
about this problem is could we pick our Ruby implementation based on the operating system so for example the
00:28:42.200
engine when you're compiling it or uh trying to build your game on top of it as you're installing detects okay what
00:28:49.240
what operating system is this designed for and what are we releasing it as and use the relevant Ruby implementation you
00:28:55.200
could be using Mac Ruby for OSX you could be using uh iron Ruby for Windows
00:29:01.000
of for Windows in that particular situation and at this point I don't think that that's necessarily viable
00:29:06.679
given the fact that there's a lot of gotches between implementations due to the fact that there's not a strict
00:29:12.559
adherence of uh Ruby spec for example if we had everybody running 100% on Ruby
00:29:17.960
spec then this wouldn't necessarily be as big a problem the next part is operating system input interfacing uh if
00:29:24.039
you've ever tried directly through Ruby dealing with mouse events uh I encourage you to not try because it isn't fun
00:29:31.279
trying to get the idea of mouse movement positionally against the screen as well as the idea of holding down a mouse and
00:29:37.159
and rotations is uh a rather Big Challenge and that's kind of important for a lot
00:29:42.480
of different game types um you can use some C and C++ extensions in order to
00:29:47.559
get down to the lower levels in order to try and bypass that but if we're talking trying to create a purely Ruby game
00:29:53.399
engine this is a challenge and something that will need to be overcome within the language in order to make that happen uh
00:29:59.919
but J Ruby can interface with it I've managed to get a mouse to be able to to detect it properly but that mostly has to do with uh being able to interface
00:30:06.399
with jvm and Mac Ruby can do it as well memory management the big problem
00:30:13.159
that that we have going on right now in particular with MRI is that the garbage collector isn't real well authorized for really long running processes and a lot
00:30:20.320
of creation and destruction as you're going through espec especially as you're going into the 3D area there's a lot of
00:30:27.480
Destruction due to occlusion calling and the concept of objects being uh rendered
00:30:33.320
based on your position in a given location so you need the ability to start tuning the performance of your of
00:30:40.720
the garbage collector and the ability to have all of these things running a particular time because when it comes to
00:30:46.159
game development the creation of resources is a really expensive component
00:30:52.240
so that is a big problem that we're going to have though J Ruby has some great tools for performance tuning and run runtime GC
00:31:00.120
um this is one of the things that we're going to have to deal with if we want to deal create a real Ruby pure Ruby engine
00:31:06.919
and finally this is big for if you're trying to do any sort of commercial game develop game releases and that's code OB
00:31:13.840
fation there is a bad deal if you're trying to create a really good game your
00:31:18.880
code's exposed free game don't have to worry so much about piracy when your
00:31:24.639
code is all completely out there and that's not that's great if you want to build free game for people but when you're trying to make some money off of
00:31:30.720
it that isn't so good which means that adoption in the game industry is going to be minimal so we need to deal with
00:31:36.360
how we can obus skate the code while still being able to compile it uh while still being able to run it easily
00:31:42.320
um J Ruby can mitigate this by you by packaging it through warbl but that doesn't really eliminate the problem
00:31:47.840
because you're still being able to uh open up the the jars and if you understand how it's working be able to
00:31:54.080
pull out the code I think that for most people that would be enough however if we're looking for larger adoption in the
00:31:59.639
game industry that's not going to be sufficient so new tools for that are going to need to be built so with all
00:32:06.720
those problems a game engine doesn't feel like something that we can really do in Ruby that's a lot to have to overcome I would
00:32:13.320
love to see the potential there but I just don't think that we're at a point yet where a pure Ruby engine can be
00:32:19.399
built so let's go back to that original idea of what we were doing with unreal
00:32:25.480
script and unreal RB which is that Ruby's great for trying to handle this higher level
00:32:31.480
uh scripting option but the main problem we had with with dealing with unreal is
00:32:37.240
that we were trying to cram Ruby into something that was not designed to be constructed that way but what if we took
00:32:45.440
it as a candidate as we were building a game engine in something other than Ruby
00:32:51.480
what if we designed our engine so that Ruby is fundamentally a core component
00:32:57.159
of the engine as our scripting language so that way we can ignore some of the main challenges that we had we don't
00:33:02.880
have to worry about our crossplatform situation because our other lower level languages are going to be able to handle
00:33:08.519
that and we focus more on the higher abstractions that the engine itself are creating for
00:33:13.840
us so some of the benefits that we have here is that we get to start using some of the great opportunities of Ruby
00:33:19.440
features for DSL creation it's a lot easier for modders because now we're dealing with something closer to natural
00:33:25.200
language and it's less complicated which means that the people that are focusing more on creating levels creating mods
00:33:31.360
and creating new interesting cont that don't necessarily have programming
00:33:36.600
backgrounds now have an easier level of getting adding into it plus there are a lot of components with logic mixins that
00:33:42.519
would be a great Boon for people that are building games and modifying games simply
00:33:48.039
because there's a tradition within the game industry that everything seems to deal directly with subclassing and
00:33:54.519
looking at the tree hierarchy of a particular entity results in some
00:33:59.880
massively Tangled code classing being able to switch that over more towards a
00:34:05.279
mixed in state and uh being able to inject some of the the game State into objects in a more Ruby fashion would uh
00:34:13.000
help benefit some of the creation and allow a lot less of the the technical hurdles and dependency conflicts it also
00:34:19.919
allows a lot more isolation for particular scripting languages and we also have just removed that Cod ofation
00:34:26.560
problem because dealing with it at a scripting level we now don't have to worry so much about our extensibility
00:34:33.040
and the the hidden aspects of it it's still a a bit of an issue but nothing nearly as bad as trying to build an
00:34:39.040
entire engine from scratch but the challenges that we have with it are performance because looking
00:34:45.879
at Ruby it isn't designed to be super small and super compact if you're running Ruby as a scripting language
00:34:52.040
inside of another L another language now you have to embed that entire runtime in there with which is rather rather large
00:34:59.839
and if you're already dealing with performance problems from the game engines perspective and trying to C clean up memory usage and CPU usage as
00:35:07.359
much as possible you're now having to worry about an additional overhead so that
00:35:12.960
would make it in even harder barrier for people and finally Windows support still sucks for Ruby so you're still having
00:35:18.800
that particular problem enter M Ruby and the thing that I have absolutely loved over the last
00:35:25.839
couple of months in working with and research uh M rubies and if you haven't figured it out already is a lightweight
00:35:32.440
footprint smaller scale implementation of Ruby designed to be embedded it's like screams use this as a for this
00:35:41.079
particular subset uh it does not have a full implementation of Ruby and it is easily bridged with c and C++ and also
00:35:48.040
with other languages though I haven't done it myself and it doesn't make an assumption about an operating system so
00:35:54.000
across uh platform problems that are inherent within Ruby are now mitigated now the downside to that is that Ruby is
00:36:01.520
not a Mr Ruby is not a full Ruby implementation several things that you would expect a ruby implementation to
00:36:08.319
have for example require doesn't exist because it doesn't assume a file system so you have some special
00:36:15.079
challenges dealing with Ruby because you don't have everything that are necessarily there but I would argue that that is a better place to be at when
00:36:21.760
dealing with a scripting engine than to have an overly large and bulky version of of Ruby in order to have to deal with
00:36:28.920
in terms of memory management now some people have already started adding in some of these features and I want to
00:36:34.440
talk about two in particular one is a fork of M Ruby that has started to add a
00:36:39.599
lot of the critical components that you would be able to you you would want to have that for something on an operating
00:36:44.680
system uh this particular Fork ends up having uh as in the kernel requires so you can actually start bringing in other
00:36:50.839
files it adds in the option of IO and uh also for communic stocket communications
00:36:56.440
which is important if you want to deal with any sort of networking multiplayer capabilities additionally another side
00:37:03.640
that'll that I think will eventually get put into M Ruby uh trunk is mrb gems
00:37:10.359
there's a poll request currently out on M Ruby M Ruby that's adds a library manager for C and Ruby extensions to M
00:37:17.000
Ruby that actually at compile time when you're bundling up all of M Ruby it will
00:37:23.040
start pulling in your sub gems and compiling them in and it has actually been rather interesting at its memory
00:37:30.160
footprint because it is only increased by a few kilobytes just by adding this component in which means that now we
00:37:36.280
don't have to worry about additional overhead with gems but the big thing despite the fact that the name is similar to ruby gems mrb gems is not
00:37:44.000
ruby gems it is not designed to at the runtime start pulling in libraries
00:37:49.280
instead it is designed as a manager to start pulling in compiled vers compiled
00:37:54.599
runtime versions of those gems and those libraries it's meant more as a a a concrete Library interface not as the
00:38:02.680
ability to start injecting in functionality at runtime so let's take a look at some
00:38:08.599
engine scripting examples what can we do now that we're using Ruby built into uh as our scripting language I've got two
00:38:15.160
examples of uh common things that I would prefer to be writing rather than unreal script um one of which being a
00:38:22.240
rail gun and another being a health pickup by adding in the syntax capabilities of Ruby within there we can
00:38:28.440
now start focusing on bringing in individual module inclusions for bringing in hooks adding callback
00:38:34.319
capabilities and that is a lot easier than trying to write out class rail gun
00:38:39.560
extends UT weapon depends on UT weapon and start adding an additional functionality there uh and conversely
00:38:46.880
Health pickup is start you start bringing in additional modifiers and the
00:38:52.119
nice aspect about that is that not all of this has to be written in in Ruby in order to start adding this capability
00:38:57.280
you could be writing ccod and you could be dropping down into the lower level and accessing the engine internals and
00:39:03.200
no longer have to worry about uh being confined within your particular uh the
00:39:09.240
lower level language so the last part that I want to talk about is that uh I am announcing
00:39:17.079
that I am starting development next week of a full Ruby engine that is built on C++ using the MB
00:39:24.560
embedded embedded engine uh it's going be using the opengl uh rendering system
00:39:30.680
and I am really excited about the the possibilities here I starting next week
00:39:35.960
is our is our company's every other month hackathon so we go 24 hours riding thing out the first spike is going to be
00:39:41.839
during that but I am going to be releasing everything and starting to document the process of how this engine
00:39:47.400
is going and I encourage anyone that's interested in working on that project or uh following it to talk to me afterwards
00:39:53.560
about some of the plans for it um it's it's a cool opportunity I think that Ruby has some great potential within the
00:40:01.280
game development industry and solves some of the main pain points that people have from a modding and uh game
00:40:08.119
extension capabilities it just happens to have some language some challenges that we need to overcome in order for it
00:40:13.960
to gain a little bit more mainstream capabilities and I really hope that soon we can start addressing some of those
00:40:19.760
problems and uh get more get Ruby out into an area that I think has been a
00:40:25.839
little bit uh neglected in its route I would like to see Ruby in a spot where the major project that people notice
00:40:32.640
when you're talking about Ruby is oh do you do you work with rails I want I don't want to have to have that be the
00:40:37.880
main driving thought that people have for a particular language so thank you for listening to me ramble
00:40:45.800
uh this is my first conference talk and uh yeah it's been fun thank you very
00:40:52.160
much
00:41:00.599
it looks like I have a few minutes for questions and if we run out of time then I'd be happy to talk to more people
00:41:06.560
afterwards or over
00:41:15.520
lunch I think that in that particular instance when you're I'm sorry the
00:41:20.880
question was that M Ruby doesn't have concurrency support built in so what is what are the impacts of that I think
00:41:27.079
that if M Ruby is being used more as the the scripting level it's being put up on a
00:41:32.680
higher level that you're able to have the emphasis on concurrency being more
00:41:38.319
with the parent language of the engine rather than the onus on uby uh so it it
00:41:43.400
mitigates it but it certainly doesn't resolve all the potential problems
00:42:02.680
no so the question was that uh I mentioned that J Ruby can handle some of these things but it sounded as though I
00:42:08.920
wasn't super happy with it and that's not really my stance I feel that it's great that J Ruby can handle these
00:42:15.240
things I think that we need to be able to have more than just the the J Ruby implementation alone be the answer to
00:42:22.079
our problems uh I think that we we can address some of these concerns in other implementation if we put the the
00:42:28.559
initiative on that but I definitely love the fact that when I'm looking researching some of the challenges that
00:42:34.559
we have have here that my first answer ends up being oh well J Ruby can handle
00:42:44.559
that uh I'll be posting the the launch on Twitter and posting it up to Ruby
00:42:50.200
news as soon as the the first Spike goes through um K twitter.com Kwan and GitHub
00:42:56.440
Kwan it'll be out
00:43:03.839
there uh this the question is do I know anything about using Ruby as a scripting component within unity and the answer is
00:43:12.040
no but I'm addressing that at work next week so hopefully I'll have more insight on that and I'll as part of the the
00:43:18.839
process I'd like to document that as much as
00:43:24.559
possible anybody else no all right well thank you very much