Hi all,

AGE (Adventure Game Engine) v0.1 is now ready.

I've banged out a lot of code today (because I'm headed out of town tomorrow
and won't be able to work on this for another week) and I've just uploaded
a new version of age.zip to Webster (http://webster.cs.ucr.edu/adv.zip)

This version is actually complete enough that people can start producing
simple games with it, if they can figure out the code from the samples I've provided.
Indeed, I've initialized a simple nine-room maze with three objects you can pick
up and drop. Active commands are:

go {north, south, east, west}
get {knife, key, diamond}
drop {knife, key, diamond}
describe
inventory
score
hint
help
save
quit

The parser is really trivial right now -- just the two-word commands
like the original adventure game (collosal cave). I'll update the parser
when I've got a little bit more of the scaffolding code filled in.


Here is the current verb list that the code supports:

go
run
walk
move
climb
transport
rest
crawl
sit
stand
enter
inventory
look
examine
read
light
extinguish
fight
flee
use
get
drop
give
steal
throw
eat
buy
sell
trade
break
repair
turn
push
pull
open
close
talk
pray
search
describe
score
hint
help
save
quit

There are "verb_*" routines for each one of these verbs.
Most of them are empty at this point (they never get called
because you have to attach a verb to a noun in order to
use that verb in the game and I've only attached
go, get, drop, describe, score, hint, help, save, and quit
to the nouns I've created. Note that although you can "save"
a game, I've yet to write the methods to read the data back
in. That's a bit more complex and I'll have to deal with that
when I get back into town.

The verbs are very easy to extend. Just add a string to a
header file (add this to the verbStrs_c string array constant)
and write a "verb_<your verb name>" procedure
and you're in business. HLA compile-time language code
automatically generates an enumerated type and a procedure
prototype for your new verb in the age.hhf header file.

Adding nouns is not quite as automatic. Indeed, this is currently
a manual operation. You'll need to edit the nounValues_t
enumerated data type in age.hhf, and call an appropriate
<noun|physObj|possession|container|room|player>.create
method to create the noun object in the initializeGame procedure.
You'll also want to call the specific initialization routine for that
particular class object in order to initialize all the fields of the
noun object you create. Finally, you need to attach any
verbs that act upon the noun to the noun object. The initializeGame
procedure contains several examples of this, so take a look
at that code.

Here is the code, for example, that I use to initialize a "knife"
object in the game:

// Create and distribute some "possessions" that
// the player can pick up and drop.
//
// Create knife and put it in room #2:

possession.create( "knife" ); // This creates the knife object.
mov( esi, knife );
possessionESI.initPossession // Possession-specific initialization for knife
(
"knife",
"A sharp, shiny, knife",
1.0,
1.0
);
mov( n_knife, nounESI.nounValue ); // Unique value for this knife

// Activate the get and drop verbs for the knife

mov( &verb_get, nounESI.actions[ uns32( v_get )*4 ] );
mov( &verb_drop, nounESI.actions[ uns32( v_drop )*4 ] );

// Attach the knife to room #2:

mov( room2, esi );
mov( roomESI.contains, esi );
mov( knife, eax );
mov( possessionEAX.possessionObjNode, eax );
(type objList ).append_last( );

Using the code above as a template, you can create
any number of "possession" objects (possession objects
are those that a player, room, or other container object
can possess.


Here is the current object hierarchy:

object -> noun -> physObj -> possession
|
+> container -> room
|
+> player

objects are the basic objects in the system.
They have a name assocated with them, you can read or write
them, and do a few other primitive operations on them.

nouns are things that can be used as the 'noun' portion of a command.
They are generally abstract objects (such as "north" or "south")

physObj object are concrete objects. These objects may be contained
within another (container) object, but if they appear in that container, they
are immoveable.

possessions are concrete objects that can be possessed. That is,
their ownership can change and they can be moved around.
Generally, you use verbs like "get" and "put" to obtain or release
possessions.

A container is an object that can hold other objects.

A room is a special case of a container object. This object forms
the rooms in the game's maze.

A player is another special kind of container object. This is the
person playing the game (you could have multiple players, btw).


All of the strings (hopefully) are in equates in a header file
or in the initializeGame procedure, so it should be real easy
to translate the text from English to another language.

The current demo game doesn't have any scoring or logic
associated with it. I'll leave that up to industrious game
designers to worry about. However, it's quite easy to
extend the classes to maintain this information.

To build AGE, download and unzip the file at
http://webster.cs.ucr.edu/adv.zip

You will need HLA v1.73 and some form of make program.
I've built AGE under Windows, but it *should* build under Linux
as well (no special coding that I'm aware of). However, I've yet
to do a Linux build, so there may be a few minor gotchas here
or there. Note that the source files contain cr/lf line endings.
Shouldn't be a problem with HLA, but you never know.

If you unzip all of the files into a directory (say, "AGE"),
just CD into that directory and type "make".
This should assemble the code just fine under Windows.
(Linux users *will* need to create a new make file that
is compatible with Linux -- the existing make file is definitely
a Windows job).

Alternately, you could compile the whole project at once
by simply typing

hla age ageobjs agesupport actions objlist

from the command line (Windows or Linux).

age.hla is the main program. This contains the
"initializeGame" procedure where you will build your game.

ageobjs.hla contains the methods and procedures for all of the
classes in this game. There are a few empty routines in
this file you may want to fill in to extend the class' capabilities

agesupport.hla is just a few utility routines.

objlist.hla is another class methods/procedures file for the
list and objNode classes (used for lists of objects).

The actions.hla file is where most of the work remains
to be done. This file contains verb procedures for all
the verbs that AGE supports. Most of these routines
are empty and you'll need to supply code to provide
whatever functionality you want for your game.

Enjoy, I'll be back in a week and do some more work on it.
Cheers,
Randy Hyde
Posted on 2004-12-12 20:30:16 by rhyde