• Advertisement

Vaishna

Member
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

106 Neutral

About Vaishna

  • Rank
    Newbie
  1. Structure of a game in Java

    Hi folks, Having just finished my first semester of programming with Java at Uni, I decided to try and program a MUD-style text-based RPG to further increase my skills over the summer. My only goal is to (hopefully) learn much more about Java programming and game design, so I'll leave out the internet aspect and develop it as a single-player conceptual game. I've been doing some brainstorming and have been reading up about game development the past days, and so far I figured out how to create the game world using map objects and exit objects to connect them, and how to split up my entities into sub-classes with inheritence. The part that I'm stuck with is the structure and hierarchy of the program, like where to implement the game logic, for example battles with an enemy. First I thought I would add all the relevant methods of battle to the character class, and to add a variable of character class as a reference to an opponent with whom the character is currently battling. This idea didn't work quite well, and it made my code very messy too. Now I'm thinking I should probably isolate all the battle mechanics in a seperate class, but I'm having problems figuring out how to do this. Another thing I am unsure about is how to define all my entities such as enemies, items and spells. Do I create an enumeration for all of them, and write down the details for each item seperately? Or should I use databases to store all the information? Just to be clear, I'm not asking for any code or a step by step walkthrough. It's just that this whole "thinking in Java" thing is new to me, so I'm not sure how to tackle these problems yet, and we haven't had any classes about design patterns or strategies yet either. The topics I've dealt with are: The basics, exceptions, associations, inheritence, interfaces and the Liskov-substitution principle. Thanks! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  • Advertisement