animal.h #6

  • //
  • guest/
  • sam_stafford/
  • scenesaver/
  • animal.h
  • View
  • Commits
  • Open Download .zip Download (1 KB)
// Genesaver: copyright 2003 Sam Stafford.

struct Pixel;
class World;

#include "thing.h"
#include "brain.h"
#include "dna.h"

class Animal :
	public Thing
{
public:
	Animal( DNA* dna );
	~Animal(void);

	void Render();
	void RenderFitness();

	void CheckFitness();
	void Eat( Pixel** p, int w, int h );
	void LookAnimals( World* w );
	void LookNear( Pixel** p, int w, int h );
	void LookFar( float c_x, float c_y, float* v_x, float* v_y );
	void Smudge( World* w );
	void Sort( World* w );
	void Step( World* w );

	float r, g, b; //animal color

	float fitness; //current fitness level
	float fitness_d_food;	//fitness gained this step from food
	float fitness_d_flock;	//fitness gained this step from flocking
	float fitness_relative; //relative fitness on 0 to 1 scale.

	float muscles[4]; // x-accel, y-accel, v-accel, turn

	// Velocity vector in linear and polar coords.
	float velocity_x;
	float velocity_y;
	float speed; // magnitude
	float angle; // radians

	float dpp; //digestion per pixel
	float size; //size in image pixels

	bool tagged; //is World->tagged

	float meter_hue; //used for chasecam render

	Animal *hi, *lo;

	Animal* nearest;

	Brain brain;
	DNA* dna;
};
# Change User Description Committed
#6 4572 Sam Stafford New "smudge" feature.
 REALLY COOL.  Off by default (pctsmudge=0) since
it's a CPU hog.
#5 4452 Sam Stafford Fix a couple of small bugs.
#4 4446 Sam Stafford Finished neural inputs, made size hereditary, auto-rotation of images
once a certain amount of diffs have been consumed, saving genomes at
finish.
#3 4440 Sam Stafford Bug fixes, new features, the usual.
#2 4433 Sam Stafford More work on this little project.
 The AI is still nonexistent.
#1 4430 Sam Stafford Start importing alife/AI code from Genesaver.
 Much tweaking will need
to be done.
//guest/sam_stafford/genesaver/src/Animal.h
#1 3052 Sam Stafford Add Genesaver to the Public Depot.
 It's not in any
way Perforce-related, but it does share a bit of code
with Jamgraph, and it feels strange to have an
open-source project that's not in the PD.