Item System Layouts

Hello,

I’m having a look around for examples of item systems, specifically how they deal with properties in the items like ATK and DEF in regards to effects like potions and DOT etc.

It’s proving to be troublesome, can anybody point me in the right direction or post some snippets.
I don’t’ mind going through source code if you know of any existing open source games that might have what i’m looking for.
It can be any language or platform, I’m looking at patterns rather than language specifics.

Thank you

  • Mstrymt

EDIT:
I’ve not really explained myself properly, I’m looking into existing implementations because I’m trying to figure out the best way to provide a relatively generic library that could be tacked on to existing systems to provide additional functionality with a minimal amount of implementation required.
To this end I’m trying to find as many “in-the-wild” examples of other peoples implementations so i can make a better decision.

Thanks for the replies,

@Myhi
I’m not actually looking for advice on how to create an item system I’m trying to find real life examples of how other people have done this in released games.

@Frieso
This is sort of what i was looking for, not the tutorial part, but it does have an implementation of a system i can use, so thanks.

Are you talking bout storage of these values?

If that is the case you can just use a custom class and use Inheritance and Polymorphism like so :

public class Item
{
int ATK;
int DEF
//etc

public virtual void Use()
{
//do stuff here
}

}


public class Potion : Item
{
public override void Use()
{
base.Use(); //Do what is already in the base
//do class specific stuff
}

}

I hope that is what you are looking for, if you have any questions please do PM me.
Myhi

You can find some decent tutorials on this at BurgZegr Arcade: http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial

Check tutorials 011 - 017 for character stats. You should be able to get some inspiration from that. The tutorial uses inheritance and polymorphism like the example Myhijim gives.

Thank you for your reply, I’ve updated the original question with a reply to your comment.