A Crafting/Inventory System [Terraria?]

If any of you are familiar with the game Terraria, I would love your help here.

I'm in the midst of starting a game similar to so, but I'm confused as to go about making an inventory system. It will be in Cocoa for the desktop, and depending on the success of it, will be ported to iOS.

As of now, I'm just using an NSTableView to list the items the player would find, but I would like to know how to go about making one gridlike, similar to Terraria.

And as for the crafting system, if anyone has a suggestion how to approach one like the game Junk Jack (iOS) or Minecraft (almost all platforms) I would appreciate ideas as well. I considered arrays but couldn't figure out the implementation for it.

As of now, I am considering using the Terraria scheme, where you just need to have the items in inventory, but I'll spin that off using recipes that one unlocks.

I have a semi-fair knowledge of Cocoa, but would be willing to learn new things to push this game out. Any questions about what I would like are welcome.

Personally I like the Terraria crafting much better. In Minecraft I only remember the recipe for like 5 things ever and have to look up the rest up constantly. In Terraria you just end up seeing more and more things become available as you have the ingredients. Minecraft effectively forces you to use the internet to know even the basics of playing the game. There isn't really the same feeling of discovery that way. The guide really helped with that too.

Implementing the grid based crafting thing would be easy. You'd just be comparing equality of an array against all of the recipes. If one of them is equal, then that's what they put in.

(Jul 28, 2012 09:02 PM)Skorche Wrote: Personally I like the Terraria crafting much better. In Minecraft I only remember the recipe for like 5 things ever and have to look up the rest up constantly. In Terraria you just end up seeing more and more things become available as you have the ingredients. Minecraft effectively forces you to use the internet to know even the basics of playing the game. There isn't really the same feeling of discovery that way. The guide really helped with that too.

Implementing the grid based crafting thing would be easy. You'd just be comparing equality of an array against all of the recipes. If one of them is equal, then that's what they put in.

How about an inventory? I'm thinking something like an NSDictionary, but not sure how viable that is.

I don't really understand the question. You could implement an inventory with a bajillion different data structures. Although an inventory is just a list of things really, why not use a regular plain old array? What good does a dictionary do you? It doesn't need to be efficient, so just do whatever is simplest to you.

(Jul 29, 2012 03:20 PM)Skorche Wrote: I don't really understand the question. You could implement an inventory with a bajillion different data structures. Although an inventory is just a list of things really, why not use a regular plain old array? What good does a dictionary do you? It doesn't need to be efficient, so just do whatever is simplest to you.

Like, say I did choose arrays. How would I go about doing something like

(Jul 29, 2012 08:06 PM)jwei92 Wrote: Like, say I did choose arrays. How would I go about doing something like

[ [ItemID, Quantity] , [ItemID, Quantity]...]

I think I see what you're asking, but it's hard to be sure. As Skorche said, there are many, many different ways you could structure your data. Without more information, we can't really help you choose one; anything that can express the data you need could be made to do the job. If it's not clear in your head what you're trying to express, the process of figuring that out will probably give you the answer you need.

(Jul 29, 2012 08:06 PM)jwei92 Wrote: Like, say I did choose arrays. How would I go about doing something like

[ [ItemID, Quantity] , [ItemID, Quantity]...]

I think I see what you're asking, but it's hard to be sure. As Skorche said, there are many, many different ways you could structure your data. Without more information, we can't really help you choose one; anything that can express the data you need could be made to do the job. If it's not clear in your head what you're trying to express, the process of figuring that out will probably give you the answer you need.

Yeah, I looked at it for a while last night, and think I figured something out. Once I get it down, and if I need help, I'll be back here.