ADOM Central

JADE Central

Background

Design

Source Code

External Code

Documentation

Download

Bug Reports

Links

Jade

Java-based Ancient Domains Engine
© Copyright 1998-2010 by Thomas Biskup. All Rights Reserved.

Monsters are players, too!

One of the fundamental truths of ADOM is that monsters and players are very different beings. Monsters have a lot less attributes than the player character, they use a different magic system, they will have a different inventory system, they can't (really) pray, they will require special code for used items and so on.
This is annoying at best and costs time and efforts at worst. Thus one of the principal approaches of JADE will be to treat monsters and players similar in as many respects as possible: I'm hoping that this will extend so far that the only difference will be some controlling methods and the actual game control (an AI for the monster, the keyboard for the player).

This document collects some of my preliminary thoughts on this subject.

The basic being

Beings in JADE consist of many factors:
  • nine major attributes (Strength, Learning, Willpower, Dexterity, Toughness, Charisma, Appearance, Mana and Perception)
  • plenty of derived attributes (basic DV, hitpoints, mana, basic saving throws against dangers, etc.)
  • a body consisting of bodyparts (head, neck, hand) which in turn have body locations (upper neck, lower neck, hand, ring finger) which in turn can hold items
  • a backpack (probably with many more containers in it)
  • a skill list
  • a spell list
  • a pool of guild memberships with associated ranks and special abilities
  • and so on.
I want these structures to be the same for both the player and the monsters (the base class will be called Being). Now it's very tempting to implement all game effects (potion effects, effects from drinking from pools, effects from praying, weapon damage effects and so on) but once for both the player and the monster.

Since both player and monster will be made from the same stuff (e.g. have the same traits and the same methods to access them), this should be trivial except for one problem: during the game texts will be printed to the screen and these texts must be adjusted to both the player and the monster, preferrably without having to write texts for these two special cases. Thus I right now try to determine whether a simple set of special symbols for the text messages will be suficient to write messages once. See the proposal below and email me if you discover a flaw somewhere.

Special symbols for messages

The set of special symbols has some similarity to what you get in C - to understand the following table it might be helpful to understand a bit of C programming. Otherwise please try to make sense of the examples below the table.
For the examples we use the player, the generic goblin, a slime blob and Tara the witch.

Symbol Text output for...
The Player Generic Goblin Tara the witch Slime Blob
@the you the goblin Tara the witch the slime blob
@he you he she it
@him you him her it
@his your his her its
@is are is is is
@ you goblin Tara the witch slime blob
@v f v v v
%x x

For each symbol there also will be a capitalized variant which returns the capitalized text. Each being will have a method called usesThirdPerson to determine whether the text is in third- or first-person. Following each @ tag there can be a number n (one digit) referring to the nth monster registered as a participant in the message text.

For the examples the following being and item instances will be used:
  • m1 = Player (the only being instance with usesThirdPerson == false)
  • m2 = Generic Goblin
  • m3 = Tara the Witch
  • m4 = Slime Blob
  • i1 = broken broad sword
  • i2 = glowing staff
Message Registered instance Text output for
First participant (1) Second participant (2) Third participant (3)
@1The slash%e%s at @2the. m1 m2 You slash at the goblin.
@1The slash%e%s at @2the. m2 m1 The goblin slashes at you.
@1His @2 is shattered by the explosion. m1 i2 Your glowing staff is shattered by the explosion.
@1His @2 is shattered by the explosion. m3 i2 Her glowing staff is shattered by the explosion.
@1The corrode%s @3his @2. m4 i1 m1 The slime blob corrodes your broken broad sword.
@1The corrode%s @3his @2. m1 i1 m2 You corrode his broken broad sword.

Naturally you can't model arbitrarily complex sentences with this set of tags, but the question is whether this set is sufficient for your typical roguelike game. Do you perceive any problems? Let me know....

Ressource requirements

As you might guess from the above JADE will be somewhat on the ressource-hungry size. Each being will be made up from a couple of dozen objects (probably 100+ for powerful and/or complex beings). All these beings will have a wide variety of choices at their disposal. Thus you'll need a powerful machine to be able to run JADE.

I don't mind for a simple reason: JADE probably will need another five full years to get completed (assuming that we'll survive Y2K) and computers will be a lot more powerful then than they are today. This premise has worked very well for ADOM and I'm hoping that it will work for JADE as well. A saved game might require 10-20 megabytes of memory (even when compressed with gzip compression, which is trivial to add with Java) and what? The smallest hard disks even today are in the gigabyte range. And memory? Yes, JADE probably will require at least 128 MB of memory! Again I don't care. My computer right now has that much and slowly the cheapest things you can get have that much... by the end of the year 128 MB probably will be a low standard and in five years we might be talking about gigabytes of main memory.

Please note that this is not meant to be an excuse for sloppy programming and waste of ressources (I'm not trying to write Windows, mind you), but if a fun feature requires ressources, the feature will get the ressources.



Java Swing, 2nd Edition Thomas Biskup recommends: Java Swing, 2nd Edition
"I heartily recommend this book to everyone who wants to build GUIs with Java and is trying to learn Swing. There are tons of great examples, everything is explained, but in nicely consumable bits and pieces and you really can get all the details - if you want. I learned Swing with the 1st edition of this book (and still use it as a reference for difficult programming questions concerning the JADE GUI), but the 2nd edition is even better from what looks in the store tell me. Maybe I'll buy it again. Note that this covers Swing up to JDK 1.4 (which is more than enough for a long time - the most recent new items do not require as much additional explaining, if you understand the basics)."

More details about this item can be found here: United States, United Kingdom, Canada, Germany.

In Association with Amazon Please support this website by going to Amazon through one of the links on this website (if you want to shop at Amazon at all that is ;-). It doesn't cost you any surcharge, but provides me with ADOM-related income. Thanks!

A complete list of my reading recommendations is available here.


| Suggestions? EMail me.