How would you use items from an inventory

Hello all,

I’m currently thinking about inventory aspects.

Storing items in an inventory is relatively easy. But what if items should be taken from the inventory?

Inventory types:
Pocket) there can only be one item
Bag) there can be several items
Board) several slots can contain items of the same type in each of them [classical inventory]

How would you determine what item to take from the inventory (and how many)?
How would you present that to the player?

Edit:
Examples:
-> Eat an apple
-> Give three apples to an NPC
-> take a key to unlock a door

you can have a image icon, and rolling through the inventory index, changes the picture,

personally I like the object appearing in the players hand,

and inputs are contextual, like holding a key and pointing at a lock, vs a NPC,
vs clicking yourself while holding a item,

This is not what I meant.

I mean how do you determine what object to take from the inventory.

Example:
The inventory contains:

  • three apples,
  • one golden key,
  • one silver key,
  • 100 gold

Now the player wants to use (give away, sell … whatever)

  • one apple + the silver key + 10 gold.

(Remaining: two apples, golden key, 90 gold)

How can the player tell the inventory to release these things? (“Mr. Inventory please give me an apple, the golden key and 90 gold”)

Right now I like the idea of a simple dictionary based inventory.
I posted an example in the resource forum.
I think the actual contents of the dictionary should be as simple as possible, this makes interfacing with it, through a dialog with an NPC for example or picking up and dropping items from an inventory overlay much easier.

As an example:

my_pocket = {"apple":2}

I have two apples in my pocket.

If you want to limit the size of the pocket you just put in a check when adding to the dictionary; are the dictionary contents too big already? if so don’t add any more stuff.

If you want custom items they could be defined in a different dictionary, you can make them really complex, using classes and everything, but just store them under a dictionary key which will be repeated in your inventory dictionary:

game_items = {"special_apple":[some data, maybe a class instance]}
my_inventory = {"special_apple":1}

Then you could cross reference the inventory key with the game item key to pick up a reference to the item.

With such a system, it’s quite easy to add or remove items from the inventory and the items could be changed within the game_item dictionary, so for example your apple could:

game_items['special_apple'].go_rotten(True)

If I want to remove an item from the dictionary I could use:


item_string = "apple"
my_inventory[item_string] =  max(0,my_inventory.get(item_string,0) - 1)

That will leave at least 0 apples still in my inventory or at worst 0 pears if item_string = “pears”.

generate a list based on interaction with the inventory screen,

have a seperae interaction system for high number items, like bullets or gold etc.

choose 100 gold, 1 apple, 1 kitten whisker, calculate if he accepts the trade?

kinda like fallout new vegas?

It is a question of game design (rather than implementation)…

How would you let the player tell the inventory to get the things he wants?

Option A) [as stated above] type in your keyboard: “Mr. Inventory please give me an apple, the golden key and 90 gold”

I’m sure this would work, but as a player I would not be happy about typing such long sentences. How would you do that?

have a + and - next to each item?

  • adds one if you have it, clicking and holding ads faster,and faster,
  • removes one of these from,the list, clicking and holding removes them,faster,and,faster?

this way 1 click = one apple

or hold and click can move,1000 gold?

Hello! I’m not sure to understand, but if it’s a matter of design, for the inventory, I would make an overlay board that you can open with a key, and with the character picture at side of the board. You could drag items from the board and drop it over the player for “eatable” items, or drag an armor and drop it over the player to equip him… If you want to make an exchange beetween the player and NPC or a chest, you could open two boards (1 board with the picture of the player at side, and one another with the picture of the chest or the NPC) and drag and drop beetween the 2 boards. To select amount of items you want to select, I would make a slide bar with mouse cursor. Each player or container objects would have a default inventory based on an inventory class with default attributes and methods to exchange, add, remove etc (object.inventory.add(“item”, amount))… Sorry if I didn’t understand the question.

Ah, then it’s a question of symbolic interactions vs representational interactions. Do you just click on a button that says eat or should you move a representation of an apple to the player’s mouth…? Or write/speak the interaction (linguistic interaction)…

As I understand it the Monster proposition, it is something similar to what is in the inventory of Dying Light: You have 50 packs of cigarettes and will sell, then the system asks how you want to sell, giving you the option to schedule the total.

Exactly. I’m looking for such concepts.

So if it is more than one … the player can “select” the items by moving them to a separate area. Yes, good idea.

More of the handling. What can the player do (with mouse, keyboard, joystick) to tell the system what he wants. The feedback (biting into an apple is a different aspect which will follow later).

The inventory gets a context menu to tell what to do with the (single) object - not bad.

Drag and drop to the game scene - nice idea.

As stated above … but I guess it is a bit of a complicated handling

I would say the first two methods work fine with one item. With several items I guess a multi-selection is needed.

I do not know that game. From your description it sounds like a variation of youle’s board idea.

Yes, this is an option … but where are the subtracted items until they are used? Together with the board idea … this could be a fine user interface

This all sounds like good concepts

Any other ideas? Maybe complete different?

I usually use other AAA games (or a combination of games) as a template. Then change it up slightly to customize it for my game.
Like in Far Cry 3, items are collected to sell for money, or use for crafting larger sling bags, or wallets, whatever. Then the player either goes to the store, or a vending machine, and sell items by pressing the “X” key. or whatever.
Basically the same for “Red Dead Redemption”. 'Cept no vending machines. :slight_smile:
Or, as the player uses items to craft, that item is deleted from inventory.
I would use an overlay scene for this as youle said.
I normally use Text properties for this. Because the save/load I use will save it in the globaldict. Find an item add 1 to Text property, sell an item, subtract 1 from Text property.
This is just an examples of many different ways, depending on your game.

These days I’ve been thinking a lot about symbolic or linguistic interactions vs representational or physical interactions.
I’ve got a partly textual interface for my game, so you can choose an option such as open the door, pick up the keys, turn the handle, pick up the rat etc… But when it boils down to it, you’re just making a choice between option A or Option B (or C and D or whatever).

When reduced to purely symbolic or linguistic interactions there’s not much difference between Eating an apple or kissing a beautiful woman. Consider the following:

Narrator: You see an apple. Do you want to eat it?
Player: Yes.
Narrator: OK, done.

Or:

Narrator: You see a beautiful woman. Do you want to kiss her?
Player: Yes.
Narrator: OK, done.

Mechanically, there’s no difference between the two situations.
In a game almost all puzzles can boil down to the same old mechanics. You see a door but it’s locked. Where’s the item/switch needed to open it? What do I have to push/pull/eat/kiss to get it to open?

Using a representational interaction mechanic can help a lot, as can things like contextual animations (consider the above examples with appropriate animations). A game which does good physical interactions well is machinarium:

Often that game requires you to really think about what you’re doing as there’s no linguistic interaction. There’s almost no symbolic interactions either, most stuff is done using physical representational interactions.
Interestingly in that game the main character has his inventory inside himself. He eats items to store them and then spits them out when it’s time to use them.

(watch how he deals with this gun and dog: http://youtu.be/FAR880Q11-M?t=2m48s)

maybe you can drag and drop item/s on npg and a code checks if they are rights item and get/subtracts the right amount he needs, than the rest of the items will repop on your inventory.
or a code checks if you have all the items he needs and they simply desappear from your inventory