Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (113)
games submitted by our members
Games in WIP (563)
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  
  Implementing battle actions in an RPG?  (Read 2470 times)
0 Members and 1 Guest are viewing this topic.
Offline Indignation211

Senior Newbie





« Posted 2011-02-02 21:37:09 »

Hello, I'm in the process of developing my first Java RPG. So far i have a basic battle system in place in which creatures are created from data stored in XML files (which upon starting the game is parsed into a GameData object which various methods can search). The creatures can act in a certain order, attack other creatures, take damage and die.

Now in order for the battles to really take shape i need to implement a variety of special actions. Player characters will share a small number of universal actions (such as Move, Basic Attack, and Defend) and will learn a number of unique actions as the game progresses (Mostly special attacks and utility powers). Monsters will have a predetermined list of actions they can take, which varies from species to species (naturally all will be able to at least Move and Attack). Initially Actions are performed by typing the name of the Action into the console, as I have yet to implement anything graphics-wise, eventually they will be handled through a GUI.

My question is how to implement actions like this? Should Actions be their own class or part of the Main class? How much of an Action should be programmed in Java and how much should be stored in XML?

Thanks to anyone who can help me out. Cheesy

Offline aazimon
« Reply #1 - Posted 2011-02-09 23:00:19 »

You want to break it down to its simple components. With a special attack, it would be the same as attack, but more damage, or it could be fire damage. If its different types of damage, I would have the victim have a method for taking fire damage. Breaking it into types of damage, your XML could list the type of damage (<DamageType>fire</DamageType>).
Instead of pulling the Action in its own class, maybe a class for handling the damage. This class would have attributes unique to the character or monster, to determine how it takes damage for a specific type.

Does that help?
Offline loom_weaver

JGO Coder


Medals: 17



« Reply #2 - Posted 2011-02-10 03:18:13 »

In my opinion...

If this is your first game I would put none of the actions in XML.  Keep it all in Java until you come to that day that you're writing a lot of boilerplate code.  If that day happens, _then_ you can refactor your code to add more actions without recompiling.

Why?  Because you likely not have that many actions compared to mobiles and objects.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproket

Junior Member


Medals: 1



« Reply #3 - Posted 2011-03-05 00:39:10 »

In my opinion...

If this is your first game I would put none of the actions in XML.  Keep it all in Java until you come to that day that you're writing a lot of boilerplate code.  If that day happens, _then_ you can refactor your code to add more actions without recompiling.

Why?  Because you likely not have that many actions compared to mobiles and objects.

Good point. Java first is the best approach. Also I would recommend using the javax.script API instead of XML.

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.

Dwinin (16 views)
2014-09-12 09:08:26

Norakomi (50 views)
2014-09-10 13:57:51

TehJavaDev (59 views)
2014-09-10 06:39:09

Tekkerue (27 views)
2014-09-09 02:24:56

mitcheeb (50 views)
2014-09-08 06:06:29

BurntPizza (34 views)
2014-09-07 01:13:42

Longarmx (20 views)
2014-09-07 01:12:14

Longarmx (23 views)
2014-09-07 01:11:22

Longarmx (22 views)
2014-09-07 01:10:19

mitcheeb (31 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!