RPG Object Variables

I’m creating a text based RPG (will be turned into a top-down dungeon crawler later), and all I’ve gotten to the point of developing all my Objects.

I have a basic idea of what I need inside these objects, but I would love if I could get some opinions on what else to include! I’ll post what I already have, along with comments if necessary. Anything that is extended will include all of the inherited variables.

Player class:
   private String name;
	private double evadeChance;
	private int experience;
	private int money;
	private int level;
	private int baseAttack; // starting base + stats
	private int speed; //speed based on weight and stats		//***DEFINE BASE SPEED***//
	private int finalAttack; // baseAttack + weapon damage
	private int health;
	private int skillPoints;
	private String style;		// mage/melee/range
	public Vector<Item> inventory = new Vector<Item>();		// inventory
	public Vector<Item> equipped = new Vector<Item>();		// equipped item
Armor class:
	protected int price;
	protected int level;
	protected String name;
	protected int wieldLevel;
	protected int itemLevel;
	protected int weight;
   protected double reduction; // value to reduce income damage by
 Weapon class:
   protected int price;
	protected int level;
	protected String name;
	protected int wieldLevel;
	protected int itemLevel;
	protected int weight;
   protected int damage;	// double?
	protected double missChance;
	protected boolean hasAmmo;
	protected boolean needsAmmo = false;
	protected String type;    // bow/axe/etc...
 Potion class:
   protected int damage;	// double?
	protected double missChance;
	protected boolean hasAmmo;
	protected boolean needsAmmo = false;
	protected String type;
 Ammo class:
   protected int damage;	// double?
	protected double missChance;
	protected boolean hasAmmo;
	protected boolean needsAmmo = false;
	protected String type;
   protected String forWeapon;
	protected int quantity;
Creature class:
   protected String name;
	protected int damage;
	protected int level;
	protected int experience; // reward for slaying (xp)
	protected int health;
	protected int bounty; // reward for slaying (cash)
	protected double missChance;
	protected int speed; // relative to weight & base speed; getSpeed() returns speed - weightAddition

For reference: wieldLevel is the required level to EQUIP the item. itemLevel is the level of the item relative to it’s effectiveness (ie. a very very rare super weapon can have a level of 999).

Any other variables you think would be good to include? I’ve been trying to think of others to put in here so I can finish the constructors, but I always think there’s something I’m missing.

Can’t comment on the stats themselves, it’s your RPG, your game mechanics. You should keep in mind you may want to change them around pretty frequently as you think of different ways to do things, so good encapsulation is a must. You have things protected, so that’s a reasonable start, just watch how you use accessors too.

You have several fields that are calculated, like “speed” and “finalAttack”. Those should be methods, not fields.

In a slightly more advanced design, consider designing things around interfaces first, and have your classes just implement a selection of interfaces. That gives you a lot more leeway in how you implement them, and in how you combine and split apart functionality as you make changes.

I think that you should start developing your game with these variables. As you go through creating the game, some things might come to you. You can also mess around with other RPGs. Think about what traits you would like to have in an entity and add it to your own game. Coding is a continual process. You may finish a section of your game, but your never done. :wink:

Probably should be using ArrayList not Vector, and I would recommend making a “Item” superclass that contains price, name, etc (or, if not all items are purchasable, a “purchasable” interface).

To build upon the OOP suggestions that have already been made I would also create a basic super class for Entities. Then you can put common code and variables in it like health, speed, damage, etc.

Additionally, Ammo should not have a quantity variable, I think - the quantity of ammo would be however many ammo objects you create, right?