I want to design an easily extensible item system for my game where I don't need to modify existing code much. I want to add items with new effects on the fly.
Traits my items have in common:
an npc sell price,
if it can be equipped,
if it is usable in battle,
if it is usable outside of battle,
So I can encapsulate this already into a class. But now there are item effects.
heals x health points,
heals x mana points,
removes debuff x,
adds buff x,
gives x stat points on equipping,
has x% chance to create some other effect when equipped,
And those can be combined like: heals x health and mana points. The first four are examples for effects a usable item can have while the last two are examples for effects equipable items can have.
The idea behind it is that I have this structure in a database as well and I can add a new item with a new effect combination in my database, my code reads this then and builds it together into a new fancy item, without me having to modify much. The only time I need to modify my code is when I add new effects obviously.
How would you put this together in design pattern(s)? I am writing my game in a language which has support for OO obviously.
vinceroMember Since 10 Nov 2012
Offline Last Active Nov 10 2012 03:29 PM
- Group Members
- Active Posts 1
- Profile Views 632
- Submitted Links 0
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown