News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

AGE Essay #1

Started by Randall Hyde, January 24, 2005, 08:49:06 PM

Previous topic - Next topic

Randall Hyde

AGE - Adventure Game Engine

This essay, the first of several, describes the HLA
"Adventure Game Engine" or "AGE". AGE serves two
purposes -- it is a practical tool for developing
"interactive fiction" games ("adventure" games) in
assembly language, and it also provides a great
example that demonstrates object-oriented
programming in assembly language.

----------------------------
What is an "Adventure Game"?
----------------------------

Adventure games (also known by the more generic
term "interactive fiction games") are text-based
console applications that respond to user input
(commands) to solve puzzles and move through the
game space.   The user types a command, like "go
north" and the program processes the command and
displays the result of whatever actions the user
requested.

"Adventure games" are so-named because the first
game in the genre was known as the "Colossal Cave
Adventure" (which was written in FORTRAN back in
the early to middle 1970s by Crowther [and Woods]).
Shortly after this game became a huge hit on
ARPAnet (the forerunner to the internet), several
different types of "adventure" games began
appearing for small personal computers. Some
outfits like Sierra On-Line made quite a bit of
money selling variants of these games. "Zork" is
probably the most famous of the genre. Of course,
as machine power increased and video displays
supporting hi-resolution color bitmaps appeared,
adventure games were replaced in popularity by
video style games (though games like "Warcraft" and
"Diablo" continue the tradition of an interactive
fiction game, in a GUI environment). Despite the
fact that adventure-style games are no longer
commercially viable as software products, they are
still a popular genre enjoyed by thousands of
computer enthusiants world-wide. Though it is
difficult to find a traditional adventure-style
game for sale these days, there are hundreds of
free examples floating around on the internet.

--------------------------------
How Are Adventure Games Written?
--------------------------------

The original Colossal Cave Adventure was written in
FORTRAN. This was quickly ported to C (for UNIX
users) and various flavors of BASIC. BASIC was
probably the most popular language for early
variants of this genre, though many such apps
were written in assembly language (because of the
limitations of early personal computer systems).
Eventually, those companies who were making a
living selling interactive fiction games began
developing their own languages specifically
designed to help them write "adventure" games.
The early Zork games, for example, used the "ZIL"
(Zork Implementation Language).   There are dozens of
adventure authoring games today, check out
"Adventure Builder" if you want to see one of the
better ones.

Adventure Game programming languages vary in terms
of capability and ease of use. Some of them exist
solely to make it possible to shoe-horn games into
small systems (e.g., the 8-bit systems with 32K of
memory that were common when adventure games were
popular). Later versions of these languages were
more concerned with making it easier to write
adventure games, without the concerns about making
the result small enough to fit within the confines
of an early personal computer.

AGE is a set of library routines and objects that
let you write an adventure game in assembly
language. One might ask why one would ever consider
writing an adventure game in assembly language.
These days, we don't have the memory constraints
facing early adventure game authors. Performance
never really has been a problem when writing
adventure games (even the early, slow, 8-bit CPUs
were fast enough to provide a reasonable experience
for adventure game players). Given that these
"speciality languages" were designed to make it
easy to write adventure games, why bother with
assembly language?

Well, AGE demonstrates that you *can* write
applications in assembly language just as easily as
you can with VHLLs (very high-level languages)
specifically designed for creating adventure games.
Combined with the High Level Assembler's (HLA)
object-oriented programming facilities, it is
possible to create a complete interactive fiction
game by simply defining all the data and
connections that make up your game.  Some simple to
moderate scenerios will require almost no
programming statements -- almost everything is data
driven.  Of course, if you want to extend the
game's logic beyond what the AGE libraries support,
it is very easy to add additional code to the
system; but by and large, the vast majority of
adventure game coding with AGE consists of defining
the data for the game.

-----------------------------------------------
Why Use Object-Oriented Programming Techniques?
-----------------------------------------------

Few assembly language programmers use
object-oriented programming techniques, so one
might ask why AGE uses OOP techniques. Well, this
is one of the main reasons for creating AGE - to
teach programming OOP techniques in assembly and to
demonstrate how to write OOP code. Besides, an
adventure game, as it consists of objects like
players, rooms, agents, and treasures, begs for an
object-oriented implementation. AGE's
object-oriented implementation is one of the main
reasons it is so easy to create an adventure game.
AGE's object-oriented implementation is another
reason AGE is easy to extend and modify.

The bottom line, though, is that AGE's primary
purpose is to demonstrate object-oriented
programming techniques.

-----------------------------------------
Is AGE a Game (Application) or a Library?
-----------------------------------------

AGE, itself, is a set of library objects, a main
program, and some skeletal files (scaffolding code)
needed to compile without error. An adventure game
writer would replace the skeletal code with their
own game-specific code.

There is an example of a complete adventure game,
HLAADV, which is included with the AGE package.
HLAADV is based (loosely) on Paul Pank's HLA
Adventure game. This example demonstrates a
complete, working, adventure game written with AGE.
It also demonstrates lots of game programming
techniques.


-------------------------------
Why Wasn't This Written in C++?
-------------------------------

The purpose was to teach object-oriented assembly
language programming, not C++ programming. Feel
free to translate this into C++ (or your favorite
language) if you like.


------------------------------------------
What is the License? How Does One Get AGE?
------------------------------------------

AGE is public domain. This means that you have all
the rights to use this code anyway you want. AGE is
available as part of the HLA Examples download on
the HLA download page:
http://webster.cs.ucr.edu/AsmTools/HLA/dnld.html
You might also be able to download AGE by itself
from the following link:
http://webster.cs.ucr.edu/adv.zip
(note that this link will go away at some point or
another, so it might not be valid when you read
this).


--------------------------------------------
What Other Tools Will an AGE Developer Need?
--------------------------------------------

AGE is written in the High-level Assembler
language (HLA), so you will need to get a copy
of the High-Level Assembler. You can download a
copy of HLA from the URL given earlier for the
Examples download. Note that neither AGE nor this
essay series purports to be a tutorial on assembly
language programming with HLA. If you're new to
HLA or assembly language programming, then check
out the HLA reference manual at the URL above or
grab a copy of "The Art of Assembly Language"
programming.


--------------------------------------
What are the Files That Come With AGE?
--------------------------------------

The AGE package consists of two directories:
AGE and HLAADV. Both directories should contain
identical sets of filenames, though the contents of
certain files will be different. Here are some
descriptions of the files in these directories:

*.hhf - HLA Header files containing common
declarations and the like.

*.hla - HLA source code files. These are broken
down into two groups -- AGE files and game-specific
files. The game-specific filenames begin with "gs"
(e.g., "gsinit.hla").

*.link - linker files needed to create Windows
executables.

makefile - a "Make" file for use with a "make"
program (like Borland's "make.exe" or Microsoft's
"nmake.exe").


--------------------------------------
How Does One Build an AGE Application?
--------------------------------------

The only practical way to build an AGE application
is via a "make" program. If you don't have a make
program available, download Borland's make as part
of their "free C++ compiler" package on the
internet. See http://www.borland.com for details.
If you're running Linux, you can use GNU's make
program. You might also be able to use KMAKE, part
of the HIDE package (see the HLA downloads web page
for more details).

Under Windows, if you CD into the directory
containing the AGE project you want to build and
you type "make", your project should be built
automatically using the MASM assembler to process
HLA's output.

If you are using FASM to process HLA output, then
you should build AGE using the command line
"make fasm".

If you don't have (or don't want to use) a MAKE
program, you can create a BAT (batch) file to
compile the individual files. You're on your own if
you want to do this, though.  You could also create
a HIDE or RadAsm project for AGE; again, you're on
your own if you want to do this.


----------------
More Information
----------------

For more information, well, keep reading the essays
in this series. Future essays will discuss the
object hierarchy that AGE uses and describe how to
customize AGE and how to create adventure games
using AGE.

For more information about HLA, check out the HLA
reference manual and standard library reference
manual on Webster at:
http://webster.cs.ucr.edu/AsmTools/HLA/index.html

For more information on assembly language
programming, you can check out "The Art of Assembly
Language", published by No Starch Press, or see the
on-line version at:
http://webster.cs.ucr.edu/AoA/index.html



Randall Hyde

Hi All,
I've just put AGE v1.1 up on Webster at http://webster.cs.ucr.edu/adv.zip
Cheers,
Randy Hyde