Finally decided to get down to something that I had been putting off for awhile: custom inspector editors. This has no bearing on the actual game itself, and in fact, will not even be accessible by anyone playing the game. However, for us, these are invaluable tools as they allow us to 'visually edit' different parameters belonging to different game components, which will reduce the amount of time we are editing scripts directly.
So, what the hell does this mean? I don't know, I just like to throw around buzzwords. To explain how useful these custom inspectors are, I'll talk about how we were previously doing things, which is somewhat shameful. So, each character has a set of attributes, as is standard in RPGs. The old way literally used a gigantic statically allocated array that stored these parameters. So, if I wanted to change Bodom's maximum HP, I'd have to dig out ole' AttributeStruct.cs, find the particular character array, find the particular attribute I wanted to modify, change it, then save and recompile.
Unfortunately, I wasn't just satisfied with starting down the wrong path for attributes, solely. This was also the case for skills and items. A lot of this can be summed up by saying that these classes (Item, Skill, et cetera) were not extended from actual Unity MonoBehaviors. This means that they could not be added to scripts as components. This means that their parameters could not be edited via a Unity inspector. There were good and bad reasons for doing this:
The bad:
-Wastes a bunch of time searching for the things I want to edit
-Is error-prone--oh, I edited his HP when I meant to edit his SP?
-Can't be changed while the game is running
-Adding a new character/enemy was a huge pain. Imagine you had to copy and paste about 100 lines of code every time you wanted to make a new character. Then you had to individually change each entry. In a sense, this is like having a bunch of spreadsheets for each character, item, skill, etc. except that the spreadsheets are buried in a giant file. And the spreadsheets aren't formatted into proper rows and columns. And you can't actually save your spreadsheets because you accidentally put a comma somewhere it shouldn't have gone.
The good:
- Quick and dirty--allowed us to test whether the basic functionality (damage formulas, equipment assignments, skill usage) actually worked.
-Certain parameters were not able to be well-represented (enumeration types, dictionaries, etc) in an inspector without having to write custom inspector code. Since I didn't want to jump into that just yet, this way seemed preferable.
-Uh... that's about it. (But if you didn't actually read this, it would appear as if there were three good reasons, no?)
The ugly:
-Me
So, anyhow, what the hell is an inspector? Here is a picture of one from the Unity editor:
Er... that's not right. While we're on the subject though, Inspector Gadget was a real dumbass. OK, moving on...
This is a custom inspector designed for skills. Contrast this with the previous method of doing things:
The previous two pictures are essentially equivalent in functionality, but keep in mind, the second picture only shows TWO of Bodom's skills. And that's not even all of the code required to actually register the skills with Bodom. For some reason, I insisted on having skills be placed in a Dictionary. That was dumb. I am dumb.
But yeah, clearly, one is better than the other. Also, that is a 16-parameter constructor. I should honestly have my degree revoked for even having thought about doing that in the first place.
But why stop there? After re-hauling one thing, you might as well keep going. Items were pretty trivial, so I won't even show that. Attributes, on the other hand, were the true target here.
To recap, enemies scale with character level. We plan on having all characters max out at level 100, (easily changed if necessary). Each character currently has 17 different attributes, which are floats. So, to further illustrate how painful this would have been had we continued with the original method, we would have had something like 1700 values to change for every character for every level. To be fair, that's still the case, but you no longer have to edit them in a file (like the previous picture).
The idea was that we needed to be able to edit the current attributes of the character, edit ALL potential attributes of the character for every level and have a way to save and load these from files,
So, this is what we came up with:
So, what the hell does this mean? I don't know, I just like to throw around buzzwords. To explain how useful these custom inspectors are, I'll talk about how we were previously doing things, which is somewhat shameful. So, each character has a set of attributes, as is standard in RPGs. The old way literally used a gigantic statically allocated array that stored these parameters. So, if I wanted to change Bodom's maximum HP, I'd have to dig out ole' AttributeStruct.cs, find the particular character array, find the particular attribute I wanted to modify, change it, then save and recompile.
Unfortunately, I wasn't just satisfied with starting down the wrong path for attributes, solely. This was also the case for skills and items. A lot of this can be summed up by saying that these classes (Item, Skill, et cetera) were not extended from actual Unity MonoBehaviors. This means that they could not be added to scripts as components. This means that their parameters could not be edited via a Unity inspector. There were good and bad reasons for doing this:
The bad:
-Wastes a bunch of time searching for the things I want to edit
-Is error-prone--oh, I edited his HP when I meant to edit his SP?
-Can't be changed while the game is running
-Adding a new character/enemy was a huge pain. Imagine you had to copy and paste about 100 lines of code every time you wanted to make a new character. Then you had to individually change each entry. In a sense, this is like having a bunch of spreadsheets for each character, item, skill, etc. except that the spreadsheets are buried in a giant file. And the spreadsheets aren't formatted into proper rows and columns. And you can't actually save your spreadsheets because you accidentally put a comma somewhere it shouldn't have gone.
The good:
- Quick and dirty--allowed us to test whether the basic functionality (damage formulas, equipment assignments, skill usage) actually worked.
-Certain parameters were not able to be well-represented (enumeration types, dictionaries, etc) in an inspector without having to write custom inspector code. Since I didn't want to jump into that just yet, this way seemed preferable.
-Uh... that's about it. (But if you didn't actually read this, it would appear as if there were three good reasons, no?)
The ugly:
-Me
So, anyhow, what the hell is an inspector? Here is a picture of one from the Unity editor:
![]() |
| Who needs nostrils? |
This is a custom inspector designed for skills. Contrast this with the previous method of doing things:
The previous two pictures are essentially equivalent in functionality, but keep in mind, the second picture only shows TWO of Bodom's skills. And that's not even all of the code required to actually register the skills with Bodom. For some reason, I insisted on having skills be placed in a Dictionary. That was dumb. I am dumb.
But yeah, clearly, one is better than the other. Also, that is a 16-parameter constructor. I should honestly have my degree revoked for even having thought about doing that in the first place.
But why stop there? After re-hauling one thing, you might as well keep going. Items were pretty trivial, so I won't even show that. Attributes, on the other hand, were the true target here.
To recap, enemies scale with character level. We plan on having all characters max out at level 100, (easily changed if necessary). Each character currently has 17 different attributes, which are floats. So, to further illustrate how painful this would have been had we continued with the original method, we would have had something like 1700 values to change for every character for every level. To be fair, that's still the case, but you no longer have to edit them in a file (like the previous picture).
The idea was that we needed to be able to edit the current attributes of the character, edit ALL potential attributes of the character for every level and have a way to save and load these from files,
So, this is what we came up with:
This will essentially allow us to modify any character's attributes, whether the game is actively playing or not. This is insanely valuable. You could almost say it's invaluable. Essentially, I can test any set of attributes at any level for any character and then save them back into the attribute map once they are correctly tuned.
The attribute map then is basically a file that exists for every character that contains the attribute information for that character. "Load to Attribute Map" will take the current character's attributes and save them to file so that they are not lost.
The attribute map inspector, then, looks something like this:
For the most part, these are extremely similar. The key difference being is that we can set up the attributes for any level. Additionally, different level attributes can be specified in a relative manner, meaning that you simply supply the difference in attributes from one level to the next, which is also a huge deal in terms of productivity and not having to remember what the previous level's attributes were.
Just for completeness, here is the enemy attribute map, which has a few extra parameters that are enemy-specific, such as EXP, AP and MONEY awarded by the enemy upon defeat:
Anyhow, just wanted to give a more behind-the-scenes look at our own processes for adding and editing different game components. Now that I've gotten this (mostly) out of the way, I can begin to focus on the next big target: Enemy AI. Thanks for reading!
'Murica.
The attribute map then is basically a file that exists for every character that contains the attribute information for that character. "Load to Attribute Map" will take the current character's attributes and save them to file so that they are not lost.
The attribute map inspector, then, looks something like this:
For the most part, these are extremely similar. The key difference being is that we can set up the attributes for any level. Additionally, different level attributes can be specified in a relative manner, meaning that you simply supply the difference in attributes from one level to the next, which is also a huge deal in terms of productivity and not having to remember what the previous level's attributes were.
Just for completeness, here is the enemy attribute map, which has a few extra parameters that are enemy-specific, such as EXP, AP and MONEY awarded by the enemy upon defeat:
Anyhow, just wanted to give a more behind-the-scenes look at our own processes for adding and editing different game components. Now that I've gotten this (mostly) out of the way, I can begin to focus on the next big target: Enemy AI. Thanks for reading!
'Murica.











