Explaining How ARPG(Action RPG) Inventory Works

Hi so I Wanna Know How Does Epic Design The Invetory In ActionRPG ?i’ve read the code but im not fully understand how this do and what that do can anyone explain to me how their design their inventory

anyone still can help me with this?

You’ll have to be more specific, what are you referencing here? Which Epic inventory design are you talking about?

For an inventory, usually, unless you want something far more complex, you simply need to make an Inventory class which contains an array of your items. You make an Item class and use inheritance to categorize the items.
For example a sword could be of the Sword class and inherit from Weapon which inherit from Equipment which inherit from Item. Being a child of Item, you can add it to the inventory’s items array list.
For equipment, you create an Equipments class with a variable for each equipment slot. So for a weapon slot, you’d have a variable Weapon for which you can add a weapon to.
Add a variable to your character class for Inventory and Equipments.

You make a UI to show the items using the list found in the inventory and a UI for the equipment on your character.
You can use double click event for equipping items or follow a drag and drop tutorial if you want to drag and drop between your inventory and equipment UI.

If you want to know the stats on all your equipped items, you can make a function in your Equipments class to calculate the total value of all the equipped items.

I would recommend drawing a schema on a piece of paper or whiteboard to help you conceptualize the logic and link between each classes.

@ANameTooLongToFi** you have completely failed to answer the question. Throwing around “you need to whiteboard the class structure” is not all helpful. Clearly the post is asking for more detailed documentation on how the inventory system in the ActionRPG “learning resource” works, as the current information (**https://docs.unrealengine.com/en-US/…RPG/index.html) barely goes over anything.

What myself and probably a lot of the community would like to know, is how does the inventory storage specifically in ActionRPG handle the following basic functionality:

  • Get a list of stored items (of respective item types)
  • Add an item to the array (explain loot tables for the sample)
  • Equip an item (weapon)
  • Use an item (potion)

As the sample is supposed to be a learning resource, all of this should be documented. Otherwise its about as useful as giving someone a car with no manual and saying “here, figure out how it all works together and go make your own”. ActionRPG brings together a lot of systems and just expects you to know how everything fits together and why.

Not trying to put down your comment because I completely agree, if you are designing your own systems, then you need to put appropriate time and effort into design. But with this sample we have extremely limited resources.

Every live stream skirts around what people actually want to know, you have Sam Deiter saying things like “you can’t just add an ability to a game as it will break the balance” when asked how would you add a new ability to the sample (you know, to teach us how it works). The most useful stuff we have is created by the community and not by Epic. (A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums written by community member KJZ).

Every single component of ActionRPG should be broken down and explained, which would help people struggling to connect the dots between all of the C++/BP crossover. After all, the better we understand the concepts shown in the sample, the better informed we will be when designing our own implementations.

1 Like

Godbosa, actually, it is pretty helpful to tell him to whiteboard the class structure. Too many times, people will get messed up on projects because they don’t properly plan things out. If you set up a proper inheritance hierarchy, it can streamline a project astronomically. It can make it many times easier to implement a system like an ARPG inventory.

The code is all there, study it. Make a flow chart if you have to to help visualize what’s going on.

Not true at all, they aren’t there to break down every word for word detail on a topic. That would turn an hour stream into a ten hour college lesson…

Again, this is on you to study the depths of the code, not on them. Epic’s job isn’t to give you a free college level education on programming and game design. You should already have a knowledge and understanding of these fields before going in… There’s a reason why people spend 4+ years in college to become programmers and game developers.

How did I know there would instantly be someone misreading what I said…

Clearly you didn’t read what I said fully.

But as stated by the OP, he wants to know how THIS system works, it’s patronising to assume that any developer isn’t intelligent enough to know to plan out their code beforehand. It’s just stating the obvious.

Did I say every word? No, I said that they should document every single component that works together to provide the core gameplay for ActionRPG. (Abilities, Inventory, Equipment, Loot)

Please, enlighten us to where anything other than how to add a potion is covered. None of the design decisions are talked about, none of the implementation reviewed or explained.

Your argument might be valid, except the degree I took on Games Programming is how to write everything from scratch, designing physics systems etc from the ground up without an engine. Also when we did work with engines, it was Unity as Unreal wasn’t free at the time. So yes, it is Epics job to explain the specifics of their engine, especially in a sample project that is there to teach us “the Epic way”.

I’m sure anyone with a development background can design an inventory system, what I think you will find if you re-read what I posted is that I want to know the specifics of how the system was designed for this implementation. If you’ve looked through it you will know that it uses the asset manager and muddies the water to people that are new to Unreal, not specifically new to games dev.

Again, clearly missing the point of what I was saying, if it is a learning resource, then why is there nothing to document what you are looking at. I will make the point again, it’s like giving us a finished car and expecting us to pick it apart and make our own without any sort of guidance.

You are clearly fixating on the idea everyone should pick through the code and figure it out. Why is it so hard to grasp that with any code should come adequate documentation to explain the what and why. If I took that approach in my day job writing web API’s, I wouldn’t have a job for very long. Code is for people, as is documentation that explains it, especially in a learning resource.

You think I would just hand a back end system over to a front end dev without any docs that explain the endpoints and their purpose?

1 Like

I don’t know, if you knew that someone would instantly misreading what you said, then you probably didn’t think your wording through all the way. Yes, I did read what you said. You had very mixed signals on expectations.

You’d be surprised how often pre-planning is an issue for developers… They get a good way through development, then realize they want to add in some new feature to the mix and end up in a hell of refactoring because of it. And as I said, you can figure out how THIS system works by following the code. I don’t care if it comes off as patronizing, I’m not here to delicately address someone so that they don’t feel the slightest bit of discomfort in their lack of understanding in something. If you know how to plan out code beforehand, then you probably understand how hierarchical structures work, which means you can probably figure out how someone else’s system works. It just takes time and effort. The good news is that you only have to do it once, if you’re going to recycle someone else’s work.

Isn’t that the whole point of being a developer? You have to be able to think outside of the box on your own. There isn’t always going to be someone to hold your hand through every nook and cranny of a project. You have to learn to read between the lines and figure things out on your own. Otherwise, you’ll perpetually find yourself in the trap of always needing someone to do your work for you.

If this were the case, then you should have no problem following through UE style syntax and code. It’s not that alien from standard c++ code… It just has a specific setup that’s pretty well outlined in the documentation and examples.

A lot of people actually can do that… You can quickly figure out the basics like the car needs wheels, a steering wheel, chassis, differential, transmission, engine, etc etc. From there, you can apply what you’re supposed to know already and realize that something like a transmission is going to have a set number of gears, with set gearing ratios. The engine is going to need to produce a minimum amount of torque at the wheel to accelerate from 0-60 within a time frame. You engine is going to need cylinders of a certain displacement to produce a certain amount of power, etc etc. This is where your knowledge and degree in a field are supposed to come into play…

Not really, it’s not on them to produce documentation for everything. If you’re going to use some premade asset, most of the time, it’s on you to figure out the blackbox in how it works. Otherwise, you just have to go with it, plug in your inputs, let the blackbox do it’s magic, and run with it’s outputs. Don’t get me wrong though, documentation is nice, it’s just not an entitlement. You should see how poorly some of the other popular engines are documented… UE is pretty decent.

Play around with it, experiment with it, see what does what. It doesn’t really take as long as you’d think.

What’s really ironic is that I have zero official education in game development and am actually an electromechanical engineer, yet I rarely find myself unable to follow through UE code to figure out what’s doing what… Sometimes, it might take a little bit to truly peck through it all, but it’s all pretty simple and self explanatory. Even in the actual engine code, there is usually plenty of annotation. Hell, even in the example blueprints, they usually try to comment things out…

Look mate, I’m not getting into an argument on a forum where someone was asking for information on how the system works, you can take fault with whatever you like but the simple fact is, the guy is asking if there is any docs or explanation to how the sample works. For some reason you feel the need to go around being a white knight for Epic when the reality is, they provided a learning resource (which the community is grateful for) and I am merely pointing out that the docs are lacking.

Also just to point out that C++ isn’t everyone’s main language, I myself work primarily in C# so have been caught by some engine specific and language specific gotchas along the road. Nobody asked “how do I design an inventory system”, only how does this sample work. I’m still unsure why you are arguing against better docs for the sample, even after looking briefly through the code and tracing back into blueprint to find how it is all implemented takes a long time to yield useful information. In it’s current state, it would be far easier to come up with your own solution, rather than trying to pick apart their example, but the idea of the sample is to show how Epic would **utilise **the engine to create an RPG.

I’m not saying they should document the system in it’s entirety, line by line, blueprint by blueprint. But they should at least go over the class structure and inheritance flow between C++ and blueprint (because as far as I remember, the main reason they created this sample was to show how we should be balancing between the two)

1 Like

Also take a look at how Microsoft document their sample’s with extensive docs on good practices: Tutorial: Create a web API with ASP.NET Core | Microsoft Docs

I’m not saying Epic have to hand hold this much, but you have to remember, not everyone has been working with Unreal for the last 20 years. So to just say that everyone should be able to look at the code and understand why it is written the way it is would be naive, sure you can follow it and hack at it, but what is the point if you don’t understand why.

1 Like

Sorry, it wasn’t “clear” to me unfortunately, which is why I asked the original poster to give a reference to what he was talking about. I personally wasn’t aware of the existence of that learning resource since I didn’t use any of the example projects.
Anything past the first line of my post was an attempt at providing information on what a typical inventory system would be.

While I agree that Unreal documentation is lacking a lot, I think it’s more lacking when it comes to the engine API. Code samples should be in that documentation to explain the purpose of each modules. When it comes to an example project, basic steps on how to use with the source code should be more than enough as the example project assume you know enough about C++ to read the code.
So I have to go agree with @IronicParadox . The best way to learn is to learn how to reverse engineering.
Like the idiom says: Give a man a fish and you feed him for a day. Teach him how to fish and you’ll feed him for a lifetime.

As for the ActionRPG documentation, glancing it over, it seems to be providing the basic information to get started with reverse-engineering it and it provide links to documentation about balancing blueprint and C++ (https://docs.unrealengine.com/en-US/…CPP/index.html) which in turns provide links to the learning C++ in Unreal prerequisite topics (https://docs.unrealengine.com/en-US/…ion/index.html) which covers how to use C++ macros to expose your code to Unreal so you can use it in blueprints.
I haven’t read all of that documentation, only glanced it over, but it seems to provide the necessary to work with Unreal and assuming people have some former knowledge of C++, otherwise the Unreal documentation isn’t the place to learn C++.