Rust For Game Development

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

C++ compiles super fast compared to my previous punch card setup

πŸ‘οΈŽ︎ 111 πŸ‘€οΈŽ︎ u/VodkaHaze πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies

Yeah once I prototyped it in C++ I do the actual implementation in the much more faster to run, but hard to code, Python 2.

πŸ‘οΈŽ︎ 80 πŸ‘€οΈŽ︎ u/irqlnotdispatchlevel πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies

So that’s why there are no production grade games or game engines in Rust. And no IDE btw.

πŸ‘οΈŽ︎ 38 πŸ‘€οΈŽ︎ u/xeveri πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies

What's up with all this recent videojerking

πŸ‘οΈŽ︎ 17 πŸ‘€οΈŽ︎ u/[deleted] πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies
πŸ‘οΈŽ︎ 25 πŸ‘€οΈŽ︎ u/Karma_Policer πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies

Can’t jerk, it’s true!

πŸ‘οΈŽ︎ 9 πŸ‘€οΈŽ︎ u/Paccos πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies

Whenever I compile C++ I'm truly surprised at its compile speed

πŸ‘οΈŽ︎ 8 πŸ‘€οΈŽ︎ u/w00t_loves_you πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies

The only correct thing in that blurb is that Rust gets in the way.

πŸ‘οΈŽ︎ 5 πŸ‘€οΈŽ︎ u/CompetitiveSubset πŸ“…οΈŽ︎ Jul 21 2020 πŸ—«︎ replies
Captions
hey everybody's my carrot game from scratch today we're gonna be talking about the rust programming language now in the game development world C and C++ have long been dominant although C sharp is definitely gaining ground and there are a number of popular scripting languages such as Lua or JavaScript that are also quite popular but C++ is just kind of held on to the crown as the primary language for game development and there's a couple reasons for that first off C++ got very popular in the beginning because it was backward compatible receipt and C was basically the lingua franca of systems level programming so if you wanted to get close to the hardware if you wanted to have absolute control over your programs life cycle over memory management over all of the things that help determine the exactly how game your game or your application is going to program or sort to execute you generally use C or C++ and that's where rust comes in rust is a systems level programming language that kind of aims to solve a lot of the same problems the C++ tries to solve but it has the benefit of learning from 30 years of C++ development at this point in time CFO's plus is almost multiple languages in one originally you've got the C layer underneath it you've got the original C++ you have C++ O 3 version you get into the templating language which is basically an entire programming language built on top of C++ and then you have a template to change the way that all of C++ worked and then that in turn influenced everything and you have then basically five generations of programming language support in one language and that leads to a lot of cruft and that also leads to a lot of complexity so at this point in time the language spec I think it is fair to say that C++ is the most complicated language out there that is to say that the poor bastards that have to write C++ compilers have to follow more rules than any other programming language out there the language spec is just astronomically huge at this point so a clean start is definitely appealing to a lot of people but I'm mentioning rust right now specifically because it just gained a lot of traction last week July the 23rd this tweet came out it's finally happening after 30 years of pro use 20 of which quite reluctantly I am done with C++ only maintenance from now on everything new will be in rust language thanks rust team for refining modern concept in such a practical elegant system I love it now why the hell should we care about this you know an anonymous tweet well it's not anonymous it was on drea pastino but who is under Anna piscina why do his words carry any weight well he is the CTO at ready at dawn and ready at dawn studios is hmm I don't think it's a triple a game developer but they're definitely an a game developer they have made a couple of games some of which you've definitely heard of the order of 1986 God of War origins collection very stiff account of war games Okami so this is not a nobody studio these guys aren't making you know games that sell millions of units and they're moving over to the Rush language and that got me interested I love programming languages in general I love game engines in general so I decided to jump into the rust language world and see what's what see how interesting it is for game developing what I was gonna do is basically do a rundown of the various different options that are out there we could go through some of the difference features and libraries and frameworks available for the rust programming language and I'd break it all down for you in this video now the cool thing is I don't have to point I've already did all the work for me so I'm just gonna piggyback onto their work and I will show you a website that nicely illustrates what the rust ecosystem is like for game developers and you can check it out for yourself now before I get too far let's look a little bit at rust now you can find rust looks a whole lot like well to me it looks a lot like Kotlin to be honest and cotton looks a lot like Swift but I think we're hitting a convergence point basically all programming languages are starting to get pretty samey now so the syntax is getting pretty similar the way things look and filled in this day and age is starting to get pretty similar so this is obviously a C++ inspired language you can see it there but then again Kotlin is a C++ inspired language swift is the C++ inspired language is this there's a lot of copying going on in the world of language development that's a good thing we're getting to a convergence point where these programming languages start to look pretty consistent across the board now there are a lot of features specific to rust and I am by no means a master of this language so I'm not going to be getting into a lot of that but what we will do is cover some of the game development frameworks and then I will finish tutorial off by showing you how to set up a rust development environment and this will actually showcase why rust is so appealing compared to say C++ and C++ setting up a built environment isn't always the funnest thing the leak the linker environment the build process is not the cleanest thing in the world but when you start seeing the way things work and rushed you're gonna covet it just a little bit I guarantee it but anyways what are the feature points of the rust programming language you see right here basically this is your real cost abstractions and zero cost abstractions is basically the mantra of C++ the whole idea behind C++ is they don't want to add weight to the requirements so if you want to have a new feature in the language it has to basically cost nothing from a performance perspective or be completely optional and they're kind of coming to this the same way so there's whenever they add a layer of nicety to the programmer they want to make sure that there's no performance hit on the backend for it that's one of the design mantris there move semantics that's kind of like that the copy constructor stuff that's been added in C++ 11 and our our value which was added in 14 I think guaranteed memory safety threads without data races trade based generics pattern matching type inference minimal runtime and efficiency bindings so if you're looking at that and thinking wow that sounds a whole lot like modern C++ like the kind of stuff being expect in C++ 14 or C++ 17 or you're right rust is very similar in scope to C++ modern-day C++ it just doesn't have all the legacy cruft the c++ does now where i was going to go with all this was i was going to a whole bunch research again on what frameworks and engines etc are available for rust and I'm gonna have to did I discover this lovely site in fact actually people on my Twitter feed informed me of it when I asked the question so thank you by the way you guys for the feedback but what we are looking at is a site called are we game yet calm and this is entirely all about getting started with rust but the cool thing is they basically break down what's available in different categories so if you're interested in getting a game engine for rust you can see here there are nine crates available now a crate is essentially it's like a deployment slash library bundled together kinda like nougat or apt you know it's along those lines it's a package or sorry NPM it's it's a package in the library all-in-one and it makes deployment very very simple which we will see in a second so if you're interested in getting a game engine for rust here are your options and from what I found piston seems to be the primary one and this the one we're gonna use in our actual example and if you're interested you can go to their websites from here so just click that little link and you'll bring up more details on that particular website but we'll go back here for a second you see there's also a date oriented game engine called amethyst quran RS GG easy that's another one i looked at so basically the two I personally checked out we're piston and GG easy is that which both look actually pretty cool then we got turbine caper mold 2d nitro and rust SDL to now speaking of SDL to you'll also find over here you've got a number of 2d rendering libraries like so and we also have thought there was a dedicated session to binding but see you got a feeling for a UI library there's three available ECS system there's nine available math library there's six etc there's a whole bunch of stuff here available and you'll find that a lot of the most popular c libraries because of the easy c++ bindings are quite available to rust developers and that's kind of when we go all the way back to this guy he's basically talking about he's not gonna abandon his entire existing code base but he's going to do a rust layer over top of it and then slowly start weaning those out so you can easily start migrating your c or c++ libraries over to this or you can easily get rust language bindings for your particular language of choice but if you're looking specifically at game development this is where you're gonna want to start you're gonna want to jump through here but this also has some details on getting things up and running so this is pretty much what I was intending to start working on kind of a pale version of you can also find out some of the games that have been invented using rust now what you're gonna find here is there are no major commercial games done with rust that's why this ready addon adoption is a pretty big deal but rust is definitely a language worth check it's a language I am still checking out myself like I said I just kind of got really interested in rust but what I will show you is how you can actually get rust going on your own system now first off you're obviously going to need rust and I let me just unfold screen this guy something we're just going on with my cursor to one second okay here we go so now you're gonna want to grab rust what you want to do is go to the rust homepage which is rust - Lang org and you can just go ahead and do an install now if you're on if you have the Linux sub system installed for Windows or you're on Mac or Linux you can basically install rust using this curl command right here or you can just use the installer if you're on Windows which is what I'm going to do as you saw it six Meg's inside so this is a pretty sick trivial install for the most part yeah we're gonna run that anyways security be damned alright so we will proceed with a default installation to do and this will go ahead and basically this is kind of an executable around this command right here so it's gonna go off and grab it looks like we're at 1500 this'll only takes a few secs but this is pulling down the key things we need specifically rust to see which is the rust compiler and cargo which is i actually it's kind of hard to explain cargo cargo is kind of awesome it's a combination of build manager and package manager in one I think is probably the safest way to put it it's a lot like using NPM if you've ever worked with node so we'll let cargo come on down and did you for this particular example I'm going to be using Visual Studio code as my ID of choice you can obviously use whatever you wish but let this run actually well that's doing its thing as far as this is so slow anyways I'll let that run for a few minutes I'll just pause it and I'll return in a second this is a classic any time windows seems to be slow look to your services oh look it's Windows Defender god I hate you Windows Defender anyways that's why we're taking some time here and I swear I shut that down earlier but I will go shut it down again okay we are back so that should take almost no time at all unless you have Windows Defender running which is one of the worst piece the software in the universe all of a sudden which is weird Windows Defender used to be amazing Oh so anyways my rant aside we should be up and going why is my cursor going insane I don't know I'll just shut this all down maybe it's something to do no it's still going on alright there's something definitely going on with my computer as we're doing this but here we are in Visual Studio code now next up what you need to do is go ahead and install the rust extension what you're looking for is rust RLS to go ahead and install that like this and it is good to go so now it's going to ask for a reload I'm gonna shut that down for now because we're gonna come back to this so next up let's fire up a terminal so I will go into my favorite directory temp directory and now we're gonna go ahead and create our first project to do this you can use cargo so let's first off make sure that rust is working so hey look how it works and what we're gonna do is cargo new and we'll call this rust demo and then - - big so what this does is create a new project for you if we go into rust demo we will see here is our new project now the key thing is this dot T om t om L file and now let's open that up in Visual Studio code so here you see so our source code is in here our main our s is available right there so what you want to do is actually open that one up and it will pop up this rll rll rll not installed install and we want to go ahead and say yes so that will basically now set up and rust should be good to go now it's gonna actually be installing so keep an eye down here this takes a couple of seconds for this to run but once the rust language services are installed you should now be able to get full intellisense and all that kind of stuff going on here is your hello world of rusta tude we should be able to do a I think it's a run task and what we do is cargo run and you will see this will execute our example I named my guide poorly that's my bad this is the warning so we're fine so you see right here hello comma world and done so that is just creating and running your Russ program so getting up and running in rust is trivial now we'll look at it a little bit more of a sophisticated an example by going into their actual piston examples and we'll show you how to get those up and running now first I'm just gonna head on over to the website I'll throw this link down below along with the one - all of the various different resources that we've used today and one - the Russ language home page should be everything you need to know to get up and start it but basically just come on in here to the examples click to this guy and clone that repository I'll go back over here to our command prompt and we want to do a git clone and paste that guy in this basically just brings down the examples for us let's switch into the piston examples folder and open that up in Visual Studio code so this now is a more advanced example coming here to source you can see there's a couple of different examples here such as this cube and the key guy here the key thing to understand behind rust is this package manager that cargo thing that's going on well let the rust language service service parse through our thing this is sort of like the intellisense person that you see in Visual Studio code when you first open a project doesn't take too long but we'll head on over here the key thing you're gonna want is this tamil file now this is basically your project file and that gets annoying go away and the key thing here is your dependencies this is basically their combination of package manager and link or all-in-one this is basically telling rust these are the following repositories that I am dependent on and it will automatically go out and grab all of those when we go ahead and do a bill now let this run for a second I'm gonna pause it and then we'll go ahead and build this project okay rust language services is done doing its thing you'll see here are the various two dependencies of our projects so now when we go ahead and do a run so here I'll hit f1 my palette bar run tasks and what we want to do is a build and what this is immediately going to do is download I actually already did a run of this so it already downloaded them all for us now all it's got to do is compile all those libraries and our code itself so this cargo build process again is a package manager goes across the internet and downloads the various dependencies you've got declared in this dependency section of your Tamil file and then of course it is your build system as well so it's compiling your rust code or it's calling out to Rusty which is doing the magic for you so here you see we're compiling all of our various dependencies here you here my thing it's rolling up a little bit in the background and this will take a bit of time you see there's a there's a fair number of dependencies but it's not outrageous so we'll head on back over here to some the code so this is the code for I think it's creating a rotating a cube in 3d space and you'll see if you've worked in any modern programming language you're gonna immediately recognize a lot of the constructs in rust so you've got your include system here as soon as import in Java or C sharp or pound include sort of in C++ the same basic process here you've got this guy's a bit hard to explain this is anything that ends with the bang or the exclamation mark is a macro it's a lot like a c-sharp our c++ macro where you can basically do a pound to find and do some code that will be replace for the function but it's a little bit more complex than that but a lot of times you'll do it for things like very attic function definition so if you have a bunch of different function perl my brains network and parameters to the function you want to call you can implement them using this macro system that's why you'll see print line because you know print f takes a variable number of arguments well you can implement that using a macro system but for the most part it looks just like a function except for it has this exclamation mark marking it at the end here is your traditional entry point you mark out a function so functions have you know the same scope operator you still use the semicolon to terminate a line a function is declared as FN you'll see here variables are declared using delet determiner if a variable can change you use the mute or mutable marker right here but otherwise you'll find this code looks a whole lot like any other programming language you're used to you've got references yeah so I'm not gonna get into a huge amount of detail on rust coding specifically because I have no means claimed any level of mastery at this point in time but you'll see our code is now done and run so we can now hit f1 again and this time we will instead do run tabs f1 run tasks and what we want to do now is a car go run yeah unset' and what you're seeing here is we have multiple different binaries in this example so to come back here you'll see instead of just one executable we have ones it 10-ish and you go into your tamil file you'll actually see that they're defined that way so there's this binary file this binary file this binary file so you're saying I have like 10 mains inside of this project so is that what we're gonna do is drop back to our trusty command prompt and we'll run it this way so we can do cargo run and then we just specify which bin profile to use so you see here we have hello world etc and what we want to use is I think it was called cube go ahead and run that and there you will see our cube so we could also have done cargo run - - sprite sorry that - bin sprite and there is a rough sprite demo so that is in a nutshell getting roughed up and running configuring an external library for game engine development it's pretty sweet but the systems and settles work pretty much as you would expect it now some language I'm gonna jump into a little bit deeper on my own free time so you want to actually think of coding in rust as opposed to c-sharp or C++ I don't have enough experience to really give you an opinion there I've only just scratched the surface of what it's capable of but I do like the ecosystem I think you can get up and running in rust basically if you are a brand-new developer you can follow the tutorial I just did and now you're at least at the point where you're going to be able to start writing code in C++ I don't think you could get up and running and using an external framework or a game engine or something with anywhere near this level of ease and that's to make sense it's a newer game engine it's got a modern workflow tool set but I like what I've seen so far I will be interested to see what you think of rust are you using rust already have you been cat your eyes on rust the kicker is there is no major game age of support and that's where the mass majority of people are going to be the most people are still going to be working in unity or Unreal Engine or default or Godot etc and in that case realistically the language doesn't matter a whole lot although you could still probably start making your extensions using rust if you preferred I believe you can even cadeau for example I'll use GD natives with rust if you wished but if you're working at much lower level and/or you're rolling your own is Rusted appealing looking technology to you or is it just another c++ want to be in your world be interested in hearing what you think of rust overall now once again a big shout out to crap I close that window already but again check out those links I will throw them down below that resource for basically are we rusty are yeah we ready yet or we've rust yet basically that website was just a wonderful resource for the frameworks and libraries etc that are available for rust so if you're looking for a place to start with rust for game development and definitely check that one out alright that's it for now I will talk to you all later goodbye
Info
Channel: Gamefromscratch
Views: 76,233
Rating: 4.8682928 out of 5
Keywords: Rust, GameDev, Game Development, Programming, C++, 2018, Game Engine, Language, Framework
Id: 0xiBflBdels
Channel Id: undefined
Length: 20min 36sec (1236 seconds)
Published: Tue Jul 31 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.