Contributing :)

If you are visiting this page, you must be interested in contributing to ai-planet.  The thing to keep in mind is, since this is an OpenSource project, your imagination is your limit.  Any idea you have, you can make possible.  All you need to make it happen is time and effort!


Contributors

Aaron Hochwimmer

Dushan Tcholich

Dennis Murczak

Matt Snelling

Kaufmann Thorsten:

Dan Bartlett and Nik

Eric Grange and GLScene

Matt Weaver


Developing

If you can understand Delphi code, you can develop features, add creatures, fix bugs, profile the code, anything you want.

There are many tools in use for aiplanet.  These include:

  1. Delphi - Object Oriented Pascal
  2. GLScene - 3D OpenGL graphics library
  3. GLBass - 3D Positional Audio library
  4. GpProfile - Profiling tool to optimize Delphi code
  5. Sourceforge - Opensource website
  6. CVS - Version control system to manage code changes
  7. OpenFX - Opensource 3DS model builder
  8. Frontpage - Web building
  9. ODE - physics library (currently phased out)

You will need CVS access and a SourceForge account. 

You will also need Delphi and the latest GLScene from the CVS.  To do this, read this tutorial.


Creatures

If you wish to add a creature to aiplanet, the first and most important thing you need is a 3DS model.  If you want an octopus in aiplanet, the only way to get one is to either find a free octopus model, or build one yourself.  Once you have one, then it is simple to add to the planet.  You can also add suns, moons, explosions, etc, in the same way you would add a creature.

Using Octopus as an example, you can add a creature with the following steps:

  1. STEP ONE - Create a file called cAIOctopus.pas.  Copy and paste from another creature, such as a Fox.  Replace all occurences of "Fox" with "Octopus".
  2. STEP TWO - Add functions to cAIThings.pas.
  3. STEP THREE - Add functions to f3DEnvironment.pas.
  4. STEP FOUR - Add an interface to your creature in vInterfaceClasses.pas, fImages.pas, and f3DEnvironment.pas.
  5. STEP FIVE - Add optional sound effects, animations, and features to your creature.

CREATURES STEP ONE - Create cAIOctopus.pas:

Find a creature you like and copy and paste the code.  For example I chose to take a Fox and replace it with Octopus.  After you have this file made, you have to add it to the project, by using the "Delphi..Add to Project" button.  You should call this file "cAIOctopus.pas" and copy it into the "aiplanet/Code" directory.

{
ai.planet
http://aiplanet.sourceforge.net
}
unit cAIOctopus;

interface

uses Classes, cAIBaseObject, cAIOccupations, cAIThings,
  cAIPosition, cAILife, cAILink, cAICreature;

type

// ============================================================================
// an individual Octopus
AIOctopus = Class(AICreature)
public
  Constructor Create(aParent: pointer);
  Destructor Destroy; override;

  procedure Fuel; override;
end;

implementation

uses
  cAIReality, SysUtils, cGlobals, cAIVibes, cUtilities;

// ----------------------------------------------------------------------------
Constructor AIOctopus.Create(aParent: pointer);
begin
  inherited Create(aParent);

  Kind := cOctopus;
  Health := 5024;
  Position.SetSize(2, 2, 2, false);
  Position.SetProperties(5, 0.1, 0.25);

  Health := 4000;
  Desire := cDesireWander;
end;

// ----------------------------------------------------------------------------
destructor AIOctopus.Destroy;
begin

  inherited Destroy;
end;

// ----------------------------------------------------------------------------
// the fuel procedure is called once a round. put ai code in here procedure AIOctopus.Fuel;
begin
  inherited Fuel;

  // example code to eat fish
  Forage(cFish, 0.4);
  if Grabber.Holding then
  if Eat(128) then Noise(cNoiseEat, 1);
  end;

end.
 


CREATURES STEP TWO - Adding to cAIThings.pas:

  1. Add a constant at the top of the file.  This number should be unique in the list of existing numbers.
  2. Add a function to the AIThingList class:  
  3. Add to the implementation uses clause:
  4. Add to the procedure AIThingList.DefaultMaximums.  This value will limit how many creatures can exist at once.
  5. Add to function ThingName(aKind: integer): string;
  6. If you creature has a plural name that doesnt work just by adding 's' to the end, then you should add a special plural name.  Add a function to ThingNamePlural(aKind: integer): string; 
  7. Add to line to function AIThingList.CreateThing(aKind: integer): AIThing;
  8. Add a new function:

CREATURES STEP THREE - Adding to f3DEnvironment.pas:

  1. Copy your Octopus model, lets call it: "Octopus.3ds", into the directory:
  2. Add a new FreeForm to the ModelCube found inside the GLScene icon.  You can then modify the Material.FrontProperties to get the colors you want.
  3. Add to the top uses clause:
  4. Add to the class definition:
  5. Add to function Tfm3DEnvironment.CheckCradle: TCrossover;
  6. Add to procedure Tfm3DEnvironment.LoadModels;
  7. Add to procedure Tfm3DEnvironment.RefreshSatellites;
  8. Add a new function to be called when a new octopus is built.
  9. Add a new procedure to update the octopus every round.  This sets the position, direction, and size.  You may have to play with the scale of your model to get the right size.  You can do whatever visual effects you need in this procedure, including animation. 

CREATURES STEP FOUR - Adding an interface to your creature in vInterfaceClasses.pas, fImages.pas, and f3DEnvironment.pas

  1. Add a Bitmap image of an Octopus to imgIcons on the fImages.pas form.  You can use the Borland Image Editor in Delphi to create a small bitmap (16x16).  Anyone can draw these tiny images!  Remember the ImageIndex (number) of the image you just added.
  2. Add the following to the eTool enumerated data in vInterfaceClasses.pas, where "xx" is equal to the ImageIndex from step1.
  3. Add the following to function ThingImageIndex(aKind: integer): integer; in vInterfaceClasses.pas:
  4. Add the following line to the function ApplyTool in f3DEnvironment:
  5. Add a new button to the Creatures toolbar in f3DEnvironment.pas.  Set the image to your new Octopus image, set Grouped:=true, Hint:=Octopus, and ShowHint:=true, and Style:=tbsChecked.
  6. Add an event to the button by double clicking it.  In the button code add:
  7. Add a line to procedure Tfm3DEnvironment.tbCreaturesMenuClick(Sender: TObject);
  8. Add a new button to the Camera toolbar in f3DEnvironment.pas.  Set the image to your new Octopus image, set Hint:=Octopus, and ShowHint:=true.
  9. Add an event to the new camera button by double clicking it.  In the button code add:

You are done!  You can now run AIPlanet, use the Octopus tool to add an octopus to the water.  Then add some fish and watch the octopus eat the fish. 


CREATURES STEP FIVE - Adding optional sound effects, animations, and features to your creature.

  1. To add a sound effect, you must have a .WAV file with the right kind of sound in it.  Place your file in:
  2. Add a unique sound effect handle ID to the file AIVibes.pas:
  3. Add the following line to LoadSounds in f3DEnvironment:
  4. In your creature file, cAIOctopus.pas, add the noise somewhere, when you want the octopus to do its thing:

    Animation instructions will be posted upon request.  For simple animations, please look at the UpdateBird function in f3DEnvironment.  You will need a model for each pose of the creature.  You can also use skeletal animations, however you are on your own for creating the animations, but I will help you integrate the animations into the engine.
     


Art

While the heart of aiplanet is the code, that code is pointless without art.

And as you can see, we need more art.  If you can draw a 3D model, then aiplanet needs you!

Imagination is your limit.  You may improve the current art, or create new art. 

Most models are in the range of 20-50 polygons.  This is to improve speed when many objects are on the screen at once, for example a flock of birds.  High poly models can also be used, when the user zooms in close to a creature, the high detail model will be shown.


 

Sound

AI-Planet uses GLBass to create full 3D sound.  Sounds may be created anywhere, at any time, even inside the game engine.  To do this, you emit a "Vibe".  These are found in cAIVibes.pas.  Every creature has the ability to make a Noise, which is a Vibe of type cEffectNoise.

If you have any sound files (.WAV) that you would like to contribute, please send them to me, or add them to the CVS.


 

Marketing

Help spread the word about AI-Planet.  Link to it on your site, or tell other sites. 


 

Ideas

If you aren't a programmer or have no time to code, you can suggest something to add into aiplanet.  Who knows, maybe it will be something easily added in!


Features

There are many things that would be great to have in ai-planet.  You may want to build one, or provide an idea to add to this list:

There are also endless improvements to be made.  If you can think of a better algorithm, data structure, then please suggest it or add it in:


Funding

If you wish to fund aiplanet or a similar project then contact David Kerr.  About Dave: Dave is a broke Canadian who never stops working, money or no money.  If you support Dave he can make things you like faster and better. So if you are rich please lend Dave a hand!  For example a model of a fish costs $30.00.  Donate a bit and boom there could be a nice looking fish swimming around. 

--- Click on this button to donate! 

Also available are AI Planet t-shirts and stuff


Last updated: September 5 2003.