









           
                                  BattleFish
                                   (c) 1996

                                  written by:
                          Mike Dussault and Mark Kreitler



 


----  Introduction


Competition in BattleFish is a test of programming skills and ingenuity.
In BattleFish, you write the artificial intellegence for a fish.  All your
fish has to do is kill any other fish it can find!  Many of the capabilities
of the C programming language are available to your fish, so you can make
it as intellegent as can be.

Each fish gets to update its actions in the fishtank about 15 times a second.  
Each time a fish gets to update, it can move or rotate itself, fire a missile
at another fish, and look around to see if it can detect any other fish.  

If you're saying to yourself, "Hmmm, this game sure sounds a lot like
that game C-robots, written by Tom Poindexter in 1985!", give yourself
a prize.  C-robots was definitely the inspiration for BattleFish.



----  Running the game


To run BattleFish, which is a Windows 96 (oh yeah, 95) program, run
BFish.exe.  The fishtank view is the black box in your upper-left
corner.  The view at the bottom is your message view .. it is where
you're notified of errors in your fish programs.  The view at the right
is the info viewer -- when you load fish, it has information about their
health, wins/losses, etc..  You also can select a fish in this list to
perform actions on it.

In the bottom view, there is a slider for the game speed.  You can use
this and run it at a super high speed to see how well your fish does overall.

Actions you can perform at anytime during the game are accessed
in the File menu, or by using its hotkey.  These actions are:

Add Fish  (Ctrl-A)
Loads the code for a fish you've written and adds your fish to the tank.
Wish him luck!  Note: You CAN load the same fish multiple times.

Remove Fish (Ctrl-R)
Removes the selected fish (in the info view) from the fishtank.

Reload Fish (Ctrl-L)
Reloads the code for the selected fish.  This is useful if you want to
continually tweak your fish because you can have the code in one window
and constantly try out new tricks without leaving the game.

Clear Stats (Ctrl-C)
This just clears each fish's win/loss count and starts a new game.



----  How to make a fish

We recommend that every time you write a fish, you make a copy of Bare.c
(it came with BattleFish), and modify that.  Either way, what you need in
your source file are:

#include "shared.h"

and a function that looks like this:
    void <fishname>( Word message, BFish *pFish )
    where fishname is the **name of the file**.

Thus, mike.c has
    void mike( Word message, BFish *pFish );


The message parameter is one of three message from BattleFish to your fish:

FISH_INIT - Called at the start of each battle.  If you want your fish
            to have a custom structure to hold stuff in, allocate it now
            with FishMalloc() and initialize it.  You also should initialize
            your fish's stats (pFish->m_Stats) at this time, as you don't
            get another chance.  Look in Shared.h in the FishStats structure
            for a description of the stats and how to use them.

FISH_UPDATE - This is called every frame.  This is where you want to use all
              the functions available to your fish for movement, rotation,
              and scanning for other fish.  You only get one move, one
              rotation, and one scan per update loop so use it wisely.

FISH_CLOSE - The only thing you should do here is free (with FishFree()) any
             memory you allocated for your fish.



----  Notes about BattleFish

All the fish functions are described in Shared.h, but here are some
miscellaneous notes.

In BattleFish, you can use global variables, but we wouldn't recommend it
because all the fish code runs within the same virtual machine (ie: if anyone
else has a global with that name, you'll both share it).  This also holds
for structure names, function names, and most importantly, fish names.
You can't have two different fish in the tank with the same names.  If you
do, they'll both use the same artificial intellegence.

The fish tank goes from (-1,-1) to (1,1), so you should only try to move
somewhere in there.  If you cross a boundary, you'll wrap around to the other
side of the tank (a great way to get away from attackers, but it can confuse
your fish if you don't program it to be aware of that).

One of the coolest things BattleFish does is save a data file for your fish.
Your fish gets 3000 bytes that it can modify at any time.  This data is
saved at the end of each match and reloaded at the beginning of each match.
If you wanted to get advanced, you could have your fish test different
strategies or patterns, and save out which ones work better!

The types that are supported are CReal (float), Byte (unsigned char),
Word (unsigned short), DWord (unsigned long), and pointers.  You can define
as many new structures and functions as you like.



------------------------------------------------------------------------------

Please send any questions, comments, and cool fish to:

Mike Dussault - mdussault@aol.com
Mark Kreitler - markk@zombie.com



