Jump to content
  • Advertisement
Sign in to follow this  
Zefrieg

Things

This topic is 5139 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on an RPG, and I am trying to decide how to classify various objects. By the way, I'm trying to generalize this as much as possible to allow for interesting in game combinations. Let's say an Entity releases feces on the ground. The player should be able to pick it up and throw it on another entity therby producing the effect of reducing that entity's charisma (or whatever).
enum OBJECT_TYPE
{
	OBJECT_NONE,
	OBJECT_WEAPON,
	OBJECT_ARMOR,
	OBJECT_AMMO,
	OBJECT_CONSUMABLE,
	OBJECT_KEY
};

enum OBJECT_USE
{
	USE_HOLD    = 0x00000001,
	USE_SWING   = 0x00000002,
	USE_THRUST  = 0x00000004,
	USE_THROW   = 0x00000008,
	USE_SHOOT   = 0x00000010,
	USE_WEAR   = 0x00000020,
	USE_CONSUME = 0x00000040,
	USE_UNLOCK  = 0x00000080,
	USE_READ    = 0x00000100,
};

enum WEAPON_TYPE
{
	WEAPON_NONE,
	WEAPON_DAGGER,
	WEAPON_RAPIER,
	WEAPON_SPEAR,
	WEAPON_SWORD,
	WEAPON_KATANA,
	WEAPON_AXE,
	WEAPON_HALBERD,
	WEAPON_CLUB,
	WEAPON_MACE,
	WEAPON_HAMMER,
	WEAPON_FLAIL,
	WEAPON_STAFF,
	WEAPON_SLING,
	WEAPON_CROSSBOW,
	WEAPON_BOW,
};

enum MATERIAL_TYPE
{
	MATERIAL_NONE,
	MATERIAL_PLANT,
	MATERIAL_FLESH,
	MATERIAL_CLOTH,
	MATERIAL_WOOD,
	MATERIAL_HIDE,
	MATERIAL_LEATHER,
	MATERIAL_IRON,
	MATERIAL_STEEL,
	MATERIAL_SILVER,
	MATERIAL_GOLD,
	MATERIAL_PLATINUM,
	MATERIAL_OPAL,
	MATERIAL_ADAMANTITE,
	MATERIAL_MITHRIL,
	MATERIAL_DIAMOND,
	MATERIAL_DRAGON,
};

enum EQUIP_LOCATION
{
	EQUIP_NONE     = 0x00000000,
	EQUIP_FACE     = 0x00000001,
	EQUIP_HEAD     = 0x00000002,
	EQUIP_NECK     = 0x00000004,
	EQUIP_CHEST    = 0x00000008,
	EQUIP_SHOULDER = 0x00000010,
	EQUIP_BICEP    = 0x00000020,
	EQUIP_FOREARM  = 0x00000040,
	EQUIP_FIST     = 0x00000080,
	EQUIP_WAIST    = 0x00000100,
	EQUIP_THIGH    = 0x00000200,
	EQUIP_SHIN     = 0x00000400,
	EQUIP_FOOT     = 0x00000800,
	EQUIP_PALM     = 0x00001000
};

enum AMMO_TYPE
{
	AMMO_NONE,
	AMMO_ARROW,
	AMMO_BOLT,
};

enum HOLD_TYPE
{
	HOLD_ONE_HANDED,
	HOLD_TWO_HANDED,
};

enum DAMAGE_TYPE
{
	DAMAGE_SLASH,
	DAMAGE_CRUSH,
	DAMAGE_PIERCE
};

class Object : public Thing
{
protected:
	OBJECT_TYPE m_objectType;
	OBJECT_USE m_objectUse;
	WEAPON_TYPE m_weaponType;
	MATERIAL_TYPE m_materialType;
	EQUIP_LOCATION m_equipLocation;
	AMMO_TYPE m_ammoType;
	HOLD_TYPE m_holdType;
	DAMAGE_TYPE m_damageType;
	unsigned int m_damage;
	unsigned int m_delay;
	unsigned int m_range;
	unsigned int m_quantity;
	Object* m_ammo;
public:
	// Mutators
	void SetObjectType(OBJECT_TYPE _type) { m_objectType = _type; }
	void SetObjectUse(OBJECT_USE _use) { m_objectUse = _use; }
	void SetWeaponType(WEAPON_TYPE _type) { m_weaponType = _type; }
	void SetMaterialType(MATERIAL_TYPE _type) { m_materialType = _type; }
	void SetEquipLocation(EQUIP_LOCATION _location) { m_equipLocation = _location; }
	void SetAmmoType(AMMO_TYPE _type) { m_ammoType = _type; }
	void SetHoldType(HOLD_TYPE _type) { m_holdType = _type; }
	void SetDamageType(DAMAGE_TYPE _type) { m_damageType = _type; }
	void SetDamage(unsigned int _damage) { m_damage = _damage; }
	void SetDelay(unsigned int _delay) { m_delay = _delay; }
	void SetRange(unsigned int _range) { m_range = _range; }
	void SetQuantity(unsigned int _quantity) { m_quantity = _quantity; }
	void SetAmmo(Object& _ammo) { m_ammo = (_ammo.m_ammoType == m_ammoType) ? &_ammo : 0; }

	// Accessors
	OBJECT_TYPE GetObjectType() const { return m_objectType; }
	OBJECT_USE GetObjectUse() const { return m_objectUse; }
	WEAPON_TYPE GetWeaponType() const { return m_weaponType; }
	MATERIAL_TYPE GetMaterialType() const { return m_materialType; }
	EQUIP_LOCATION GetEquipLocation() const { return m_equipLocation; }
	AMMO_TYPE GetAmmoType() const { return m_ammoType; }
	HOLD_TYPE GetHoldType() const { return m_holdType; }
	DAMAGE_TYPE GetDamageType() const { return m_damageType; }
	unsigned int GetDamage() const { return m_damage; }
	unsigned int GetDelay() const { return m_delay; }
	unsigned int GetRange() const { return m_range; }
	unsigned int GetQuantity() const { return m_quantity; }
	Object& GetAmmo() const { return *m_ammo; }

	// Constructor/Destructor
	Object();
	Object(OBJECT_TYPE _objectType, OBJECT_USE _objectUse, WEAPON_TYPE _weaponType,
		   MATERIAL_TYPE _materialType, EQUIP_LOCATION _equipLocation, AMMO_TYPE _ammoType,
		   HOLD_TYPE _holdType, DAMAGE_TYPE _damageType,	unsigned int _damage, unsigned int _delay,
		   unsigned int _range, unsigned int _quantity, Object& _ammo);
	virtual ~Object();
};


Any problems so far? I'll update while I continue to add upon it. Well, I decided to get rid of the inheritance stuff. I figure it would be better to just make it a general object that can do just about anything. Ok, so what else do I need to add to this? Oh, and I haven't put it on there, but there is going to be a list of effects chained to the object. [Edited by - Zefrieg on October 24, 2004 2:31:40 AM]

Share this post


Link to post
Share on other sites
Advertisement
Don't forget a thing can be made of several things brought together.

For instance, you could take out arrows from a quiver or put them back in, or cut the poo in half and throw it at two people instead of one (m-m-m-m-monster poo)

Share this post


Link to post
Share on other sites
Well, the weight and size could be used to divide objects. I remember reading about splitting objects in an AI book.

I could just make a copy of the object and reduce the weight of the two objects.

Thanks a bunch for pointing that out. For some things it might be better for the individual to cut a certain percentage of the thing off, like a boulder of ore, than to carry the whole thing around with them.

That brings up an interesting point of how objects that are reduced to a certain size should be named. Obviously if you take 1% off a boulder, then that piece might be a rock or pebble. I'll have to consider this when I get to naming conventions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!