Game Development Community

Items in RPGs

by Till Hoffmann · in Technical Issues · 10/25/2005 (9:50 am) · 2 replies

I want to program a RPG with items that can modify the properties of the player (e.g. Strength, Health, Mana, etc.).
I've though about two ways to develop this feature:

- every Item has got a structure with different variables which are attached to the player when the item gets mounted
- every Item has got a function onMount which modifies the player's variables

Which way is better or is there any way that is better than both???

Till

#1
10/25/2005 (10:09 am)
Perhaps you could do it in both ways at the same time, i.e., store item properties on the item object, store player properties on the player object, when the item is mounted (onmount) add item properties to player properties and substract them again when item is unequipped.
I'm saying this based on the assumption that you're making a simple, normal rpg. If you're making an rpg in a persistent world then probably storing the property values as attributes of the game objects themselves might not be a good idea, you'd rather do something more complicated with databases.
#2
10/25/2005 (10:34 am)
I'm trying to develop a RPG like DiabloII. Much smaller, but it should be able to be extended to a larger game.