designing and writing my own game from scratch. am i doing this right so far?

I am taking on a project way bigger than my britches for my first project because i believe in baptism by fire. this is to be an RPG with similarities to final fantasy tactics.

I identified the need to have a class for actors, and i think i need subclasses for all of the different characters and character types. this is what i wrote up, it is the first part of my program (i don’t even have a game loop yet). did i do this right/intelligently/usably/extensibly or should i go back to the drawing board?

public class Actor {
	private int level;
	private int hp, maxhp;
	private int mp, maxmp;
	private int patk, pdef;
	private int matk, mdef;
	private int[] elementArray;

}

 class PC extends Actor{
	private int xp;
	private int[] jobs;
	private int rosterNumber;
	private int partyNumber;
	private int partyPos;
	private String lhand, rhand, armor, jewelry, acc1, acc2;
	
}
 
 class monster extends Actor{
	 private int xpValue;
	 private int goldValue;
	 private String loot;
	 private String[] Abilities;
	 
 }
 
 class npc extends Actor{
	 private String job;
	 private String level;
	 private int energy;
	 private String project;
	 
 }

Well that looks ok, but I think you really should your classes out among files instead of having them all in one file. I cant really say if its a good start or not!

I believe the fact that you are asking on this forum is a huge indicator that you should be starting a smaller project, but I digress.

When designing an tile based game, everything has to do with how objects interact. At the moment, you just have a bunch of variables all in the same spot. I’m not saying it isn’t going to work, but there is a huge chance that if you don’t write the objects first you’ll have a bunch of problems.

That being said, here is a different version of tackling the same problem. It completely depends on your game though…


//This class holds common elements for all characters in the game
public class Character{

         private int HP; //Holds the HP of an object
         private int maxHP; //Holds the maximum HP of an object
         private int MP; //Holds the MP of an object
         private int maxMP; //Holds the maximum MP of an object

         private int locx; //The x-axis location of the unit
         private int locy; //The y-axis location of the unit
}


//This class holds all the abilities for warrior classes in the game
public class Warrior extends Character{
         private int attack; //Physical attack for warrior class
         private int defense;//Physical defense for warrior class
         private int magicAtk;//Magic attack for warrior class
         private int magicDef;//Magic defense for warrior class
}

then, you can structure your classes from there.

[icode] public class Monster extends Warrior [/icode]
[icode] public class NPC extends Character [/icode]

I would actually put the inventory and jobs in a separate classes to avoid it being mixed up with the player character.

[icode] public class inventory [/icode]
[icode] public class jobs [/icode]

Make sure the classes are split up by type in packages. Then you’ll realize that you have leagues more code you need to write to make this game functional.