Pages

Saturday, August 14, 2010

New item system

Still apprehensive about jumping straight into all the complicated stuff of writing a new engine, I decided to start off with the item system. Basically, the item system now consists of two classes so far. There's the Item class which will be used to point to specific instances of an item (such as in a player's inventory) and will be able to contain instance specific data, such as quality, quantity, etc. The item class contains a pointer to a unique instance of ItemTemplate, which defines the actual item information of a given item type. So while there may be multiple instances of a PX45 Pistol, they'll all still get their base stats from the same ItemTemplate. This new system is different from the old one in that I'll now be able to add in various modifiers to specific items, which was impossible before.

In addition, I've made the ItemTemplates get all their data from a text file, which means anyone will be able to modify the game's items. The data file currently looks like this:

//TEMPLATES
//defines base characteristics for all items
item:base_template
{
    char:249
    cost:10
    description:"No description"
}
//defines gun characteristics
item:gun_template
{
    use:base_template
    char:191
    gun
    fireRate:1
}

//GUNS
item:light_pistol
{
    use:gun_template
    name:"PX45 Pistol"
    ammo:".45 ACP"
    damage:5
    magazine:10
}

It's pretty readable and offers a fair bit of flexibility. I think I like it.

6 comments:

  1. I love this idea, I also love how it opens the door for random generation of items that can have different properties and modifiers, a la Diablo 2. Or having the ability to mod your weapons with different accessories.

    ReplyDelete
  2. Also, is there any way we can contact you through an instant messenger or email? I'd actually be quite interested in helping out somehow.

    ReplyDelete
  3. Absolutely, but the only IM clients I use now are AIM and xfire.
    AIM: hk xm29 oicw
    xfire: biologicalweapon
    If you have neither of those, then my email's my xfire username @ gmail.com

    ReplyDelete
  4. Oh, and I also live in IRC. You can find me on GameSurge, Wolfire, Espernet, or QuakeNet. I go by the nick "Azathoth" on the first 3 servers and "nihilanth" on QuakeNet.

    ReplyDelete
  5. I like the look of the system so far. Are you using the libtcod parser?

    ReplyDelete
  6. I wrote my own... Now that you mention it, I guess it does kinda look a lot like the libtcod format.

    ReplyDelete