x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Persistent Item-System with definite deletion

Hello everyone,

How would one design a system where Items (Actors) in the world can be picked up and thus permanently deleted from the level and added to the inventory. This deletion needs to persist a restart of the game. I`m thinking of Item-systems like the ones in Fallout here. The way i see it, i have two options:

  1. save the level at runtime (which will involve c++ i`d imagine)

  2. spawn every Item dynamically from some huge list after the level has finished loading

Are there other ways, and how could i efficiently construct such a system? If i were to dynamically spawn every Item in the world, this could have a big impact once i spawn tens of thousands of items, equally, if i save the level, it becomes unusable for any other players with different SaveGames. Both ideas have problems so i`m wondering if anyone has experience with those kind of systems and could help me out here.

Thanks, Marc

Product Version: UE 4.20
Tags:
more ▼

asked Oct 31 '18 at 07:25 PM in Blueprint Scripting

avatar image

MarCraft23
101 1 7 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey MarCrafr23

I'd recommend checking out some of the tutorials for a standard inventory system to get a baseline for what you're looking for.

You'll basically want a data structure that holds all of the data that makes an item (id,name,description,icon,stats,meshes,etc). That data structure can be passed to an actor in a level when spawned and then be given to the player when they interact with the item. Your inventory item will essentially be the data structure and the actor will just be a stage that handles how the item is interacted with. From there you can use the basic save game class to store everything you need. You might need to create mutlitple classes but you'll be able to save locations, items state, etc...within that class.

I'm not at my device right now but I'll have screen shots if needed later.

I hope this helps!

more ▼

answered Oct 31 '18 at 10:32 PM

avatar image

Entropikz
113 18 21 26

avatar image MarCraft23 Nov 01 '18 at 09:33 AM

Hello Entropikz and thank you for your quick answer,

however i was looking for a more abstract way on how to do this. The inventory system i have works fine and is not the problem here. For most items i just store the class itself so i can get the info of it and spawn it when needed. This however only works for generic items of a same type. I would get problems once i want to save weapons, since the weapon system shall be very complicated and due to some systems, the weapon specific data is stored on the weapon itself. With many weapon classes that do different things and unique weapons that are different altogether, it would become unfeasible to, copy the whole data of the actor in a struct. As i understand it, you only save references in your SaveGame and not the object itself, which means weapon dont survive a game reboot. Now you seem to suggest, that one would dynamically spawn every item in world after begin play, so option 2. This also would be my preferred way, yet i feel this system is limited in some way. How does Bethesda do it with their games? I only found some clues but no definite answer. The whole system will become quite messy, as you cant place an item in the world for picking up, but rather place a placeholder and then add the item in some big list or array, OR one would save the placeholder state (picked up or not), save those and initialize every item on begin play(let them spawn a random item e.g.). In either way i would need to iterate over every item in the map on begin play. That doesn't seem efficient to me.

Thanks, Marc

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question