Risk of Rain 2 Modding Tutorial - Making A Character

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today i wanted to talk about modding risk of rain too i recently made a mod for the game and i know that modding is something that people want to get into but it's kind of hard to get into this so they don't know where to start so let's make one before we get into this i want to make sure that i point you guys to a couple resources in case i missed anything that being the wiki and the discord links those are down in the description as well to get started we're actually going to use one of those resources right now that being rob's example survivor template you get a link to the file which includes the unity project as well as the visual studio project down in the description below or you can join the discord community and type exclamation mark getting started character in the discord but don't do that just use the link in description otherwise you're gonna spam the chat it's just gonna be once you download the survivor template you're gonna need the right version once you download the template you're gonna need the right version of unity to open it with keep in mind that if you install the unity hub you're gonna have to add it manually after you download the old version in any case go to the unity download archive a link to that in the description as well and download this specific version of unity once you're done downloading unity open up the project now we're starting with the template right now because i prefer to get the character in visually before the functionality is done meaning that you can see the character before the moves are done but you can totally do the reverse as well that means that the first thing we're going to do is talk about how to make an asset bundle now an asset bundle is just a way of bundling assets together into a file that can be read inside a visual studio this means that all your models textures and particles have to be a part of this file if you want them to show up in your mod now usually to create an asset bundle you need to write this unity utility script thingy that takes all assets grouped together with a tag and then throws them into the bundle but keep in mind that that does have a 98.23 chance of breaking for absolutely no reason now what i heavily recommend you do instead is just take all of your assets and put them into this example survivor template project and then use the stuff that's already in here to make your asset bundles it has the unity utility script that you need as well as this convenient plug-in that actually lets you navigate around and see all the stuff that's in your bundle now to make an asset bundle you're gonna need actual assets this is why league of legends survivors are so common the assets are available and easy to implement inside of risk array too plus the visual style kind of matches the game there's easy implementation they even have a similar number of abilities it it all kind of just works anyway if you want to know how to rip your art assets out of your league of legends install then follow this video here i didn't make it but it's a pretty comprehensive guide and it should show you everything you do it's pretty easy now if you're making a completely custom character this is where most of your time is going to be spent making art is hard and it takes a lot of time and i'm not a 3d modeler i'm just a programmer and a game developer now if you guys do want a tutorial on how to create your own custom character model rig animations whatever i don't know how to do it but i can maybe convince bret to give you guys a tutorial so let me know down in the comments if you want to see it and i'll let them know regardless of how you get it done at this point you should have a model with some textures and animations and be ready to make an asset bundle to import your model into unity just open up a window of file explorer and a window of unity and then drag the file into unity it's super super simple just make sure it's a correct file type the one i use is fbx fbx is pretty universal for most engines if you're going to be making models in the future just make sure they're fbx now if you have a different file type for your model don't worry it's not the end of the world just get a 3d modeling application like blender or maya import your asset in and then re-export it as an fbx after you import the model import all your pictures for the character portrait as well as the icons whatever you need pictures for you can import them pngs work just fine now that all your art assets are in the engine except for particles which we can go into later usually you'd have to go through and tag all of them with the specific asset bundle tag so that they got put into the same asset bundle with everything but as long as all of those assets are within a folder that is tagged for the asset bundle everything within the folder will get added so you don't need to worry about it the last step for this is to actually make your character a prefab to do this drag your model into the level and then drag it back out into the asset browser this will save your object as a prefab and more importantly make it an interactive game object rather than just a model now that you have your prefab you can give it an animator component and then drag all your animations into it i'll go over how to make the animations functional in a bit but for now we just want to get the character into the game the prefab will save all the data that's in this animator component including the data of the actual animation so all we need to do later is change some of the values that these animations reference and it just works so now we can go into this tab and click the ap make button and watch the magic happen now that our asset bundle is finally done we can make the stuff we put in unity appear in the game but first we're going to need some code now this parts where it's up to you you can either use rob's base template c-sharp class and work off of that as a base or you can make your own c-sharp blank project it's what i did for the ribbon mod but it doesn't matter in the slightest you can do what you want before we actually get started coding our character though we're going to have to set up a couple things instead a visual studio the first thing we have to do is add this little bit of code at the top make sure that you substitute the names of your own mod in the applicable spaces like after the namespace and bepin plugin lines here's mine for reference next we need to add some references to the visual studio project make sure that you've installed bettenx and have run the game with it at least once we'll start off by adding references to the pepin x plugin that you have installed so whatever that is you're going to need to navigate to it typically it's this location go through each of the folders in your bepinex installation in every folder select every item and click add once you've got all that go to the risk of ring 2 data folder and then add all of the classes from the manage folder that you need for your mod you'll learn more about what specific ones you may need as you get further into making your mod for starters select unity engine unityengine.networking unityengine.com module and assembly c-sharp and add those to visual studio finally click ok to apply your references this may take a little bit so be patient now that we've added all the necessary references we're going to have to add two more using lines before the name space we created earlier that being using bepinex and using roar2 this allows our code to pull other code from other places on the computer in this case it's beeping x and risk of rank 2. this is where a decompiler can become very helpful because it's crucial to understand what you have to work with in this code we've just referenced from my experience it doesn't really matter what decompiler you use i use dot p and haven't had any issues although it is recommended to use d and spy all that we're going to be using the decompiler for while making this mod is opening up other dll files to help us understand what we're doing here all that matters is that with rd compiler we can open up this assembly c sharp file and get acquainted with all the functions and stuff we have available to us a really good place to start figuring out what you actually need to know from this huge library of functions is to open up other mods from the community and see the general size and scope of their code as well as what from this library they actually use a really important thing to remember is that we are just looking at this code to get an idea for how we should be structuring our code and what functions we should be using don't go copy pasting other people's work unless you specifically credit them in a code comment or something really quickly before we finally get started coding here i have to mention hooks they're basically things that allow you to execute a piece of code when something that already happens and risk of rain happens let's say you wanted to do something every time you teleport to the next zone you could hook onto that bit of code and do something else at the same time there's a link in the description to the wiki which tells you how to use them but i'm not going to go through them in this video because there's already enough information to process and they're not necessary to make a character mod so now we are at last ready to start coding as i said at the beginning of the video you can start coding however you feel makes sense i prefer to get my character visually in the game first so let's start with that what we'll need to do is create another class called assets which will handle loading our asset bundle from earlier as well as adding all of the stuff in it into the code as a bunch of variables really quick we have to actually copy the asset bundle from earlier into visual studio and to do that all we have to do is open the file location of it open the visual studio project in file explorer and then copy the paste the bundle into this folder it should then show up in visual studio at which point we need the switcher to be an embedded resource going back to the code we can set up a bunch of variables at the top of this assets class here one variable for each asset in our bundle if you have more assets than i do like more particles or something then make sure you create variables for them here we also need to add an asset bundle resources provider variable and an asset bundle variable here which we'll use later to give r2 api all the stuff it needs to make our assets appear in-game once you're done declaring all the variables you need up here add a new function called populate assets at the top of this function here we'll add an if statement to check if our asset bundle is properly loaded and if it hasn't to then load it you'll need to change these strings to be the same name as your namespace in my case it's just riven just below this if statement we'll need to actually give the variables we declared earlier some values so we'll use this main assetbundle.loadasset function and set our variables to the output of that function the strings here also change depending on what names you gave your assets in unity so just copy the names of the assets from unity into these strings you don't have to worry about including the folder structure as well in the string it'll find it even if it's in a folder just fine that's actually all we need for our assets class so all we need to do is call this function somewhere else in the code and our assets should load just fine now don't jump into the game just yet because the assets just being loaded doesn't make them appear that's what we'll handle doing here next up in our previous classes awake function we'll add this line of code to actually call that function we just created now we can write some new code to take all those assets and make them appear in the game we're actually going to need three new functions to call here in the awake function so let's go ahead and add those the first one that we'll need is the createprefab function and i want to quickly say that i do believe there's probably a way to write this that isn't so ridiculously large but in here you essentially want to go through and add values to all the variables that define how the character moves around in the game space if you want to have some source code for this to look at i again recommend going through rob's example survivor template in the description because the create prefab function in that source code is a pretty good starting point for figuring out how much what stuff you actually need now there are a couple of lines of code that i have in my function that will likely be different than what you guys will end up having because my character probably works differently than what you guys are making for instance i have some stuff the end which handles creating my state machine which i'll be going to later and my passive handler which i won't be going into later because it's something specific for my mod the next function we'll need is a register function mine's called register riven but you can call it whatever you like remember that we are calling all of these in the awake function from before to start off this function we add some value to the character display game object variable we declared earlier on we'll use this instantiate clone function to create a model for our character and then add some necessary components onto it next we'll add a bit of description for our character this is actually what you see in games so make sure it says what you want it to display i'm going to add a couple of lines here so it looks nice these new line calls space out the text next we're going to add a couple of lines for the language api now risk of rank 2 holds string values and tokens so this riven name string is not arbitrary we'll go through and add value to these tokens later on next we'll add a definition for a new survivor risk of rain 2 has a function to create survivors based on a definition or a template so we'll create a definition here and then below this add in a survivor based on this definition i'll also call another function here called skill setup which we'll create later on and then finally add in this bit of code that makes our character actually selectable on the overall survivor list in the pre-game menu see the way risk of rain 2 survivors work is that all of them are stored in a list and the properties within the list are pulled and then displayed on the menu moving on we'll go to the create doppleganger function now this isn't entirely necessary for your mod so you can skip it if you'd like because all this does is make the artifact of vengeance functional so if you're not playing with it it doesn't really matter this function is going to look pretty similar to the last one but a bit shorter now you're able to create your own ai for your doppelganger if you'd like but personally i don't really care that much so all this code does is spawn on a doppelganger for the commando and then switch out the model that you see now that we've got all of those functions written and called inside of this awake function there's one more that we'll need to add some functionality to our character we'll need a register states function that only has four lines of code all it does is ask our loaded api to add certain skill types to our list of skills that our character will use now to create those skills we'll need to create a separate class that inherits from the base skill state class which is part of the risk of rain library of classes now the coding here is entirely up to what you want your ability to do so i can't really help you with this i can however point you to some functions that you should use or learn to use within this class that will be helpful to use the first is that inherently these skill state classes have on enter and on exit functions which are called when the skill is used or is finished being used the second is something inherent to unity called an innumerator or co routine essentially these are functions that can run separately from another and that can continue to run for a specified amount of time which is really useful if you want your move to let's say have a startup animation to it before the hitbox comes out to end off the coding section i'd like to go back and quickly talk about the skill setup function from earlier this skill setup function is going to be a void and we'll call all the setup functions from the various abilities that we will need which will correspond to how many skills we have only go through one of these functions because they're all nearly identical but here's the general framework of one essentially we have to get a reference to our character's skill locator component which we will store in a variable called a component we can then go ahead and create a skill def which will hold all of the various properties of our skill like how many charges it has whether or not it can be used while sprinting and so on we'll need to add some tokens to our language api here that appear when you hover over the ability in the game and then add a bunch of values to our ability now this part is again up to you you can do whatever you want with your move but this is what i have for my left click attack and my rhythm class at the bottom here we'll need to add our new ability to the loadout api which is handled by this bit of code something to note is this line here make sure that you change your component primary line to whatever this ability this is for be it primary secondary or so on finally after all this code we can build our mod we'll use the build tab at the top here and then hit build solution once we wait for the build to complete we can see if it was successful or not in the output window here at the bottom and if it was we can go ahead and find this file location copy it and then paste it into our own pepin x folder like you would any other mod off the store all there is left to do is run the game and pray that your code works so that brings us to the end of the coding section if there's anything i missed that you need an answer to let me know down in the comments and i'll see if i can answer your questions all that's left to do now is to add some sounds into our mod for this we'll need to use the software wise which is a piece of middleware tech that games from risk of rain to borderlands used to manage sound in their games we won't be using this software to its full potential today all we'll be doing is the bare minimum to get our sounds into the game if you're at all interested in sound or sound engineering i highly recommend you play around with the software it can be a lot of fun there is also a wiki page for this that you can follow if you'd prefer a link to that is in the description as well like with unity we're going to need a specific build of wise to work with risk of rain you can find it pretty easily by downloading the wise launcher and installing a new version while looking through the all versions tab here once you've finished installing it have launched the software you may run into a bunch of errors about stadia but you can skip right past them just like you probably skipped past the console itself next click accept to open up your project making our audio work is actually super simple all we need to do is click the project button up here and then hit import audio files select our file and then hit import after that we're going to change our layout to sound bank at the bottom left there will be an event viewer here we'll just right click and then create a new play event the name doesn't matter all that matters is that we add the audio clip we imported to this event there are cool things you can do with these events that i did in my mod for instance you can make these events choose from a random sound each time they fire but for now just adding the sound to this event is good all we have to do now is drag our event into our soundbank editor window and then hit this generate selected button this will produce a soundbank.bnk file which we can then add to our visual studio project like we did the asset bundle it's important to change this in visual studio to be an embedded resource which will make the soundbank actually save within your dll file next we'll add these lines of code to initialize our soundbank inside of our awake function and then whenever we want to sound a fire we'll add an aksoundengine.postvent function the numbers at the beginning here correspond to the actual id of the event in the soundbank file so make sure that you have it open in notepad as well as to copy the numbers over the second argument in this function doesn't really matter it just asks for the owner of the function you can put a reference to your own character by default like this and it should work just fine all that's left to do now is to build our mod like before and hear your sounds happen in the game all that's left to do with your amazingly unique awesome mod is to publish it to the thunderstorm for everybody to see it's a pretty easy process all that you need are these lines of code that we should have from our project earlier once you have your finished dll you're going to need a couple other things inside of a folder first off copy and paste your dll in here and then find a thumbnail picture you'll also need a readme file that appears here in the store i recommend putting your change log into it because there's bound to be issues when other people try to download and play your mod that you're going to have to fix and keep track of the last thing you'll need is this manifest.json file which will have to look pretty much identical to mine fill out these fields accordingly and then save your file once all of that is done add all of these files together in a zip file finally upload that to the thunderstorm and you're done well probably not you're probably going to have to patch it and update it a couple of times but now you have all the tools you need to make a good mod and risk of rank 2. that's it for today's video if you enjoyed like subscribe all that stuff comment down below if you have any questions for me about the mod i'll be happy to answer your questions you
Info
Channel: ArcSin Jesse
Views: 33,580
Rating: undefined out of 5
Keywords: Risk of Rain 2 Tutorial, Risk of Rain 2 Modding Tutorial, Risk of Rain 2, Modding Tutorial
Id: f28dcq7J-As
Channel Id: undefined
Length: 16min 9sec (969 seconds)
Published: Fri Oct 30 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.