dueled20


Alpha01 version

This page contains links to the source files and details the activity so far with this project.

This project is being devloped:
- within Mac OS X/Cocoa/Java, so I can learn some stuff
- because I think this might turn out to be a fun game!

Right now, the infrastructure is in place to:
1. read in character files
2. parse character files and populate Java-based character classes
3. perform an extremely rudimentary combat

Next steps:
1. Expand on character attributes (using XML)
2. Expand combat engine appropriately, based on step 1


Next next steps:
1. Establish tactics rules (using XML)
2. Expand combat engine appropriately

NOTES

0.
Two Java jar files are necessary for the XML parsing to work. These files are:
These two files should be placed in the directory:
    /Library/Java/Extensions
and can be found here
    http://gump.covalent.net/jars/latest/xml-xerces2/

1.
Full source disk image here

2.
app only is here

3.
Screen shot is here

4.
Java source files are:
char1SetFile.java
char2Setfile.java
charData.java
duel.java

5.
Example character files are:
char1.xml
char2.xml

SOME EXPLANATIONS

0.
An example XML file describing a character is:

<?xml version="1.0"?>
<name>
Fred Smith
    <offense>
    7
    </offense>
    <defense>
    5
    </defense>
</name>


1.
The character class is:

public class charData {
    // attributes
    private int loc ;
    private String name ;
    private int offense ;
    private int defense ;

    // constructor
    public charData(int iLoc) {
        loc = iLoc ;
    }
    // set methods
    public void setName(String iName) {
        name = iName ;
    }
    public void setOffense(int iOffense) {
        offense = iOffense ;
    }
    public void setDefense(int iDefense) {
        defense = iDefense ;
    }
    // get methods
    public int getLoc() {
        return loc ;
    }
    public String getName() {
        return name ;
    }
    public int getOffense() {
        return offense ;
    }
    public int getDefense() {
        return defense ;
    }
}

2.
The combat engine is:


    private void combat (charData char1,charData char2) {
        duelOutput.insertText("After a bloody battle, ") ;
        if ( char1.getOffense() > char2.getDefense() ) {
            duelOutput.insertText(char1.getName()) ;
        }
        else {
            duelOutput.insertText(char2.getName()) ;
        }
        duelOutput.insertText(" emerges victorious!\n") ;
    }



3.
Clearly, the combat is not that interesting at this point!

Mail Mike Carniello

mlcarn1@attbi.com