Game Development | Structure, Enumerations, Data Table --Oh My
As a gamer, my enjoyment in video games tends to focus on acquiring phat loot and slaying mighty creatures. On the game development side, my eyes are bloodshot red and I have nightmares of items. Oh, items, not the first time I’ve run into them and it’s always a battle.
My first attempt at an inventory system was quite a nightmare. There was no way it could within reason handle scalability. Along with it trying to keep my insanity over what could be a never-ending list of items. What would be fine if I only had dozens of items was not going cut if for the hundreds I already have planned and the many possible thousands to come.
One of the hardest things is trying to judge the future scale a system needs to be able to handle. Make it to small and you will end up having to endlessly rewrite to scale it. Even more so once you add in a player population and suddenly you have to deal with information migration with updates.
For my own sanity, I’m not going have say 100k or even millions of items. I’m just an indie solo developer. The amount of time and resources it takes to go about having that much would require an army of far more talented people than myself. That also means I don’t need to invest a lot of countless days and weeks preparing for something to handle that kind of size.
I already know things are going at least be in the hundreds without even trying. For the most part, I’ll be hitting that number by next week. There is a good chance I’ll be hitting the upward bound in the many thousands of items. That will all depend on certain constraints I put in as well for item supply vs being able to scale. Some of it will have to be guesswork on my end. I’m sure this won’t be the second time I’ll have to revisit and make some changes regarding items.
This is also not something I’m going to try and do all at once. There are lots of finer details that need to be added in. Along with a lot of systems that still need to be built out to fully make what I’ve been working on a function.
Since I already have a number of zones and I am working on a few others. There will come a point in time where I need to populate areas with things to fight and yes have items to drop. I know that the last part will be a huge amount of time. It is something I’m already working on building out so I can keep expanding on it when it’s needed.
It also helps to have some of this stuff out of the way for testing. Naturedly there will be a lot of balancing, changes being made, and even rethinking of how I’ve approached solving current problems I’m facing.
Blueprint Structure
Unreal Engine 4 allows the use of an interesting mechanic called structures that allow you to store a vast amount of variables in an organized manner. You then can impart a special kind of file called CSV (comma separated values) that will use it in helping create a data table.
For my items, I’m sitting around having 41 variables. While that sounds like quite an insane amount of information needed just for items in a video game. There is quite a lot of information needed and even further systems built out for functionality depending on what it does.
Some of these variables will be for the items name, description, rarity, what and how the item can be used, gold value, a lot of different stats like damage and resistance and so on. Some of these the player will be able to see. While others it’s more on my side of things. Some will also just help with organizing.
In the above screenshot, you can see some of these variable types are rather standard in the kind of data they will be holding. You see things like integer, string, float, boolean and so forth. These are all rather commonplace in programming.
Next up you have things that are built into Unreal Engine 4 itself. Things like static mesh, texture, and so forth. The really cool thing about these types is they will go and look for the item that matches these types. For example, if I have a mesh called Rusty_Sword it will understand if used correctly how to display this information to the player and how it should function in-game.
Blueprint Enumerators
Then you have stuff I myself had to create using a different type of storing data called Enumerators. Which dumbed down is a fancy way of saying you are just calling something with an actual name while creating a restraint. I’ve created a number of these when combined with everything else that will create certain functionality in my data table.
We can see in the above example I wanted to be able to classify rarity with a restraint. I only wanted rarity to be one of these things listed. This, as a result, will give me a drop-down for rarity with only these options. So that way if there is an error in my own database well it’s not permitted to be something else. Even cooler I could reference all these now and say apply color to rarity if I wanted. I have plans to do much later on when I build onto it.
There are a number of these I’ve built out or will build-out in the future. Another one of them that was needed for my items was for if it could be equipped with which slot is that item even permitted in. While this is just the building blocks of that system I at least now have partly done.
While these are really cool and play a role. It’s only part of things. I still need to build out the actual slots in the character sheet, for instance, to get the above example working. It’s at least so much better than trying to do an endless mess of IF statements to determine that a player can’t wear pants on their head. Unless I wanted to permit such use in my game. Hmmm.
Item Data Table
Finally, there is putting it all together. Which I’ll admit I am far from doing since there are so many items and even place holder that I’m currently using for variables that need to be created. For the time being I at least have a considerable amount of the building blocks in place. I can also now expand things outs when needed to a certain degree.
One of the biggest things I had to do before all of this was to turn a concept into an actual usable format. The above screenshot was, in fact, my first attempt at how I thought things would work. Some of this information won’t be used in the current data table I’m building out. It will however late on when loot tables, for instance, are created and so forth. I might then go back and include that information anyways.
It was also quite a far cry from what it ended up being. For easier use, I am building things out in excel before I import it in as a CSV. It then will use the structure I’ve built out further enabled with numerators to give all my data a way for me to bring meaning to it.
I have quite a number of weapons already in. Unreal Engine 4 has a pack of weapons you are permitted to use. I’ll admit their collection is a bit more restrictive than I wanted with it mostly being swords, axes, and blunt objects. From which I’ve been selecting, classifying, creating names, giving stats, and even writing descriptions for.
Which will take some time to finish as it drains a lot of creatively out of me naming things and that sort. Some of the weapons and items will be rather generic in naming. Others, for instance, might be named after locations they acquired in or from whom you murder to get it. As such, I still need to build all that out so quite a few items not shown just have placeholder information for the time being.
There are also other things that I still need to carry out some real-world research on. Naturally, I want some realism when it comes to certain items. For instance, the above is a snippet of crafting materials in my table that I have created. I’m not quite willing to talk about how they will be used quite yet and I still need to build things out further for it.
Clearly, I don’t want a cheaper gemstone in the real world, for instance, be more expensive than say a higher grade one. While that is simple to guess and be right since it’s gemstones after all you also have other stuff like wood. Which types of wood am I going end up using and how do they relate to price among others? Well, I no expert so I’ll have to look into real-world pricing and other information to determine quite a lot of information.
Then you have the stuff which I know is going to be a massive issue for me. Things like weapons, crafting material icons and the likes which I’ve used up to this point are cheap to buy or even given freely for use with Unreal Engine 4. Armor sets not so much. Even more so if you want armor meshes, animations, and a few other complications that come with them.
While the gamer in me really wants a 3D animated and shown in-game armor sets. I also like so many things so far in this entire process have a near-zero skill level at this moment. I’ll be giving a program called Blender and a couple of others a try later on in the year. I’m not really expecting to be able to create anything even with the wide range of material meshes I have that would be worth using. I am using a keyboard and mouse after all or as many would call it “a brick to draw with.”
The far cheaper alternative is to do what a lot of games have done when you don’t have a triple-A budget and still want to create a 3D non-pixel game. Show weapons but just have icons for everything else. While that is not what I want. I also can’t afford to hire a team of 3D artists, animators, and the likes. While there is a number of website out there that have “some assortment” of armor that I could use in a legal way for cheap or free. A lot of them are quite old. I also will need several hundred pieces. A set of 6 piece plate amour can cost $100+ in some instances. This is understandable for how much time and skill goes into creating them even when they are sold in mass and are not one-off creations.
Final Thoughts
Another week and more rabbit holes jumped down. I swear I start more things than I’m able to finish. That ends up being the nature of things with how intertwined everything is. Sometimes you just can’t do something without it needing something else to go with it. At least I’m starting to build something that will take quite a long time to finish and I feel like I have a decent start on it now.
I’ll more than likely be working on some zones and when I get tired of building those out further switch over to working on my items and data table. There are also quite a few other systems my brain wants to get more details down and work out how do implement them into existence. Sometimes you just need to stop what you are doing to clear the mind of all other stuff floating around. It’s getting quite full.
Other Posts:
- 1. Unknown WIP
- 2. Getting In the Basics
- 3. First Level
- 4. Outdoor Level Attempt Number 1
- 5. Using BSP Method For Making A Zone In Unreal Engine 4
Information
Screenshots were taken and content was written by @Enjar. Screenshots are from Unreal Engine 4.
#Posh If you would like to further support this post you can do so on Twitter where I have shared it.
https://twitter.com/EnjarGames/status/1234276166493724679
It looks very good
is it free?
My game won’t be free. It will be quite a long time before it’s release in any kind of state.
This post was shared in the Curation Collective Discord community for curators, and upvoted and resteemed by the @c-squared community account.
If you are a community leader and/or contest organizer, please join the Discord and let us know you if you would like to promote the posting of your community or contest.
@c-squared runs a community witness. Please consider using one of your witness votes on us here
Thanks for the support. Have a great week.
Hi @enjar!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 5.347 which ranks you at #766 across all Steem accounts.
Your rank has dropped 2 places in the last three days (old rank 764).
In our last Algorithmic Curation Round, consisting of 81 contributions, your post is ranked at #8.
Evaluation of your UA score:
Feel free to join our @steem-ua Discord server
"I swear I start more things than I’m able to finish." I can relate to that statement. lol
Hehe, speaking of which what a week!
Sorry i missed this comment. Have a great weekend :)