Item Structure Logic for an MMORPG+

Hi everyone!

I am creating a game that is (in my opinion) the next generation of MMORPG.
An “ASOERPG” (Active Simulation Online Erotic Roleplay Game).

I have worked for many years in other projects on other game engines, but in a community management position. Now I want to create my own game with my own brand and I am about to release my first pre-alpha gameplay.

The game contains two worlds.
The planet Protares (plays in our and modern technology, also high-tech)
The planet Antares (plays in the Middle Ages with gunpowder weapons, also low tech). Here I have written a novel as game story, where the player can create a roleplay character based on the novel for the game. All in German language, if I have more money I would like to translate it into other languages.
This is the reason why I need a huge amount of items in the game, because they are different in technology.
On both planets and technologies, players create there own content for the game.
This is the main gameplay!

Currently I am reworking my item structure system for a better workflow in the future, but here I have some problems in the logic. Some games have about 500.000 items in the game, this is a huge database of items to manage and change things inside etc. The database will have massive performance issues… but i need more!

My idea is to make 6 structures for items to split the database, it will be more than half a million of items over time. So I created a base structure (Master Parent Actor) for each type.
Example of Master Parent Actor “ItemDataBaseBuildings” for all buildings in the game.
“ItemDataBaseCrafting” for all crafting items in the game.
Each structure contains additional information. A building dont need weapons gameplay information, for example… maybe a watchtower with weapons… hmhm I dont know! You see my logic issue?

I hope you can help me to find the best way to get the best performance and workflow (doing everything 6x times is… not so good ;( ).

My big question:.
Is it better to have ONE big huge structure (master parent actor) that contains ALL types of items. Make child actors and add additional information there separately (like armor variables for building defense etc.)? Also, can the Unreal engine handle this huge amount of items?

Or split it into 6x Master Parent Actors to increase performance, because when I am looking for a specific item in the game, I do not need to talk to the other 5 databases. And the replication is not needed. Many players, many performance problems, maybe!

Is it important to include many variables in the structure of the master parent actor, or reduce it and add it as a regular variable in the blueprint?
For example:
My buildings should have a defense variable, so that a sword cannot destroy a stone wall (for example). But if I add this defense variable in the master parent actor structure, this is a value for the whole actor, but I need this specific to actors inside the blueprint.
For example:
The stone wall is resistant to a sword attack.
The wooden gate can be damaged by sword attacks.
Just a simple example. Also I dont need a main structure variable for the whole building (player dont build there own buildings, its the part of the development team to create buildings and player can buy these fixed buildings to place).
Its not so easy to describe what I mean.

PM: My items have a mass in grams. Do I need an Int64 for that? Because a battleship or later a starship can have many grams… you know what I mean. I do not like floats with the 0.000000 problems.

Thanks for you help!

First you need to Decouple item database from game. Size and number of variants you going for is your biggest problem here.

Having single parent actor/class for all items will make net of references all around game, yes it is maintainable, but single mistake and you have references back and forth all over project.

Having every possible item variation in single actor means it will be lots of data/code, and every instance (ie. every item) will allocate that memory. So that is no way.

Instead you should look into Data assets. But then i have no idea how asset manager handles 500k assets. Loading may be messed up. However with data assets you just drop file (that holds your structure) into folder and asset manager will register it. Then you can make editor widget tool to fill them up etc.

Imo, best way is to use LYRA project as starting point. Then see either data assets, or some external database. Best would be combination of both:

  • customer/player gets item in possession
  • some server side database (does not need to be written for unreal exactly, can be just regular database + some python code) sends template of such item to client
  • client creates Data Asset based on item, and can use that item.
1 Like

One master item logic is pretty bad. You need to split it up to the base struct and then optional additions to the item.

Main struct would have for instance
item name
item description
item rarity

then you would have a list of sub structs that would define extra attributes
stat modifier (+ 5 to strength)
elemental damage
knockback
etc

you could have extra info like: unsellable, quest item etc

This would map onto a relative database where you would have one table that has the base item and a second table with the equivalent of the sub-struct that has a foreign key that would map onto the main items id.

The sub struct could also map to an attribute dictionary (then it would have a second foreign key to map onto a mod). This would make the data keep the third normal form.

Also, the way I go to split all items into 6 types is the best way?
Because in my opinion I can better handle and stream in/out what they players need to know in replication.
First of all, buildings are the most important things because you can see them in the distance. Also, there is no need to replicate crafting items (for an example). If you move closer to the city and move into an inn, the game can now load all other stuff. This can save network traffic. The idea of Object Container Streaming.

Have seen other games, they did all items in a MasterActor type, but in multiplayer with more players they get high issues with performance problems and lags.

As you allready said, if there is a problem in the MasterActor reference, they problem is in every other place. If you split this into 6 structs, you have 5 problems less… I hope you understand what I mean.

This is why I want to do this step now, to avoid problems in the future development.

Another example is the “MasterItemCreature” of creatures, also all creatures in the world (players, NPCs, etc.) It makes no sense in my opinion to have a building actor (for example), containing pawn variables, etc.

Serializable items should have their struct / data asset equivelant. (The actor should be build from this data and be it’s visual representation in the world)

I wouldn’t focus on too deep inheritance for actors. It will hurt in the future when you will need to refactor anything.

Lean into interfaces to handle actor interactions, then you can decouple classes.

Please explain this more, I do not understand.

Please all, give examples for your answers, so I can better understand what you are talking about.
I am not familiar in to specific mechanics of the engine.

Thank you :slight_smile:

For example you could have a struct that describes a building

Name: Pagoda

TArray FloorsTypes => would hold id’s for each floor element that would have it’s own equivalent in main static mesh.

Inside the building actor base you would have a constructor script that would read in it’s struct and see that the building has x amounts of Floor types and it would add in in hierarchical instanced static mesh component to the actor and populate all of the floors and offsets where the meshes are the same, repeat until all of the static mesh types are exhausted.

Then if the struct has sub struct information you can for instance spawn in specific interior models, or load in a texture set depending on the style of the building.

The floor example is of course simplified, you could break this down into more granular modules , for instance per room (if it was player driven), where the room could have extra information like how is it offset from the building root.

Basically your building actor starts off nearly empty and needs to populate itself based on the passed in data. Same thing for items, armours, etc.

You should not jump right away into deep waters of coding (and creating backend for mmorpg is really really deep water).

However you have experience as community manager, and probably some in marketing (or have contacts with people that know it). So instead of going into databases, unreal C++ lyra etc. You should focus on getting some funds then hiring/getting backend (database) + unreal coder. And then you can do some simpler coding tasks in your game.

As indie dev you should optimize what you can do. Build strong team instead. And i already see you got niche market that is not so niche and actually may make profits from game.

I know, my goal is to make a good pre-alpha game with the gameplay I can do solo.
Then get funding and create my company and hire employees that are more skilled in multiplayer networking.

This helps me to find the right way.
Thank you all for the information! :slight_smile:

Ah if its prototype only, you do not need to bother with 500k items size.

I would do it this way:

  • get lyra project, use it as a base
  • use Data Assets for making all items in game, so create actor that loads and reads data asset
  • do project as content+code plugin for lyra

Benefits of lyra:

  • you have all multiplayer system ready (not mmo size)
  • steam and some other integrations
  • data assets used everywhere, so you can do it all modular
  • very easy to retarget skeletal meshes and animations

Git project with links to tutorials and pdf files (about Lyra):

Thank you very much.

With Unreal Engine 5.4 there are many improvements that help me to solve the actual problems in replication etc.

Have already tried with Lyra, but I can not modify anything. So I skipped that. But thats ok because I need another method of replication for bigger worlds.

Look into that git page, it has pdf files and liinks to tutorials about Lyra. Best tut so far i found about Lyra.

I am reworking my inventory system and I found a problem so I need to fix this.

Before, all my items are used with “ItemDataBaseXYZStructure” array.
This contains; Name, Health, Weapon Damage, etc.

Every time I added or removed something in this BaseStructure, I got errors all over my game.
Also I got endless “Unknown Structure” errors… thats bad.
But with just this ItemDataBaseXYZStructure I cannot get access to other variables inside the actor blueprint.

Now I need to change this to get a better solution of accessing all variables, structures and more inside the actor.
But what type of variable can give me all this information and KEEP this inside the actor when I move from world to inventory and back to world.

Do I need to select “Actor Reference” from my MasterXYZ actor?
Or Soft-Reference
Or Hard-Reference?

Which reference can hold all the information? And DONT take the defaults?
Example: My longsword has 100 damage by default.
In the game I can change the damage of that longsword to 120, so the information I need to keep is for THAT item, all other longswords can have different values (90 or 100 or 400 damage, whatever). What is the best reference array for the inventory system?

If I change the weapon from Longsword to Mighty Longsword, should the name be kept inside the actor, in inventory or world in multiplayer?

I hope you understand what I am talking about.
Before I have used the ItemDataBaseXYZStructure but this is very bad so I need to take an alternative way.

Look into Data Assets:

C++ data assets are best:

However You can also use BP data assets:

Then add middle layer of your own functions in function library (and for your example):

  • make function library
  • make blueprint pure function that reads your structure (from now on only this function will derp)
  • make bunch of pure functions that read single fields from struct (whatever you want) that use that single function above
  • finally make similar functions that read data asset and give results from it (As above functions)

Tips for data assets:

  • separate types in separate folders: for eg: \items\weapons\swords and \items\weapons\axes etc.
  • make blueprintable widget tool to fill up all your data assets
  • if you make single data asset for standard sword, you can copy it and add variants
  • make function that sorts all items/data assets by filename and path, and another function that removes all that does not have \swords\ in filename, then you are sure they all are in same order

Do i understand this right.
The type of Structure in an Parent Actor System is outdated to use?
Do other MMORPGs using Data Asset systems to manage there Items etc.?

I dont know if the Data Asset system ist compatible and easy to use in a inventory system.
This sounds to get dirty after long time.

Need a simple and good modular system to manage items, in inventory and in gameplay.

That is impossible it can be either simple or modular, next you probably would ask for also fast.

No it is not outdated, middle man (that single function in func library) is easiest way to avoid fixing all those broken connections when you change struct. It will break only connection inside that function.

No they use server side client just to display stuff, all is done in backend server and probably not in unreal at all.

Really make simple game first. This “i do my first mmorpg game” trend is like running marathon day after you learned how to walk.

1 Like

Thank you for your answers and help.

What is the best Inventory-Variable for Items that are be unique (also different in stats, like more damage etc.)?

  • Actor Reference
  • Soft Actor Reference
  • Struct (but do massive “Unknown Structure” errors when changed)
  • Other and what Variable Type is this in Unreal Engine?

Data Assets are not good for my case.

Problem is, the more tutorials i am watching, the more they are different.

With Hard Actor Reference (what it is), the Space Storage and Memory Storage are heavy increased.
Is this a problem with more Players (about 100+).