Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (578)
games submitted by our members
Games in WIP (499)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  RPG Object Variables  (Read 816 times)
0 Members and 1 Guest are viewing this topic.
Offline chowbaaron

Junior Newbie





« Posted 2013-05-08 04:51:08 »

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.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
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


1  
2  
3  
4  
5  
6  
7  
8  
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


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
 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...


1  
2  
3  
4  
5  
6  
 Potion class:
   protected int damage;   // double?
  protected double missChance;
   protected boolean hasAmmo;
   protected boolean needsAmmo = false;
   protected String type;


1  
2  
3  
4  
5  
6  
7  
8  
 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;


1  
2  
3  
4  
5  
6  
7  
8  
9  
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.
Offline sproingie
« Reply #1 - Posted 2013-05-08 05:46:32 »

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.
Offline Longarmx
« Reply #2 - Posted 2013-05-08 05:51:04 »

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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 114
Projects: 4
Exp: 3 years



« Reply #3 - Posted 2013-05-08 07:21:39 »

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).
Offline Z-Man
« Reply #4 - Posted 2013-05-09 02:44:25 »

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.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 114
Projects: 4
Exp: 3 years



« Reply #5 - Posted 2013-05-09 02:47:02 »

Additionally, Ammo should not have a quantity variable, I think - the quantity of ammo would be however many ammo objects you create, right?
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (30 views)
2014-04-15 18:08:23

BurntPizza (27 views)
2014-04-15 03:46:01

UprightPath (42 views)
2014-04-14 17:39:50

UprightPath (24 views)
2014-04-14 17:35:47

Porlus (41 views)
2014-04-14 15:48:38

tom_mai78101 (63 views)
2014-04-10 04:04:31

BurntPizza (123 views)
2014-04-08 23:06:04

tom_mai78101 (222 views)
2014-04-05 13:34:39

trollwarrior1 (189 views)
2014-04-04 12:06:45

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!