globals.h #20

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

//Enums, constants, and the like.
enum Color { Black, Grey, Green, Red, Blue, Yellow, Cyan, Magenta };

struct Settings
{
	bool save;		//save on exit
	short mutate;	//# mutations per procreation
	char camera;	//camera mode
	int opacity_i;	//animals' opacity in world view
	int digest;		//amount of color an animal can eat per step * 100.
	int radius;		//maximum animal radius
	int vision;		//vision range
	int maxspeed;	//max speed, as percentage
	int fitness;	//steps per fitness check
	int image;		//steps per image rotation
	int diff;		//% diff consumption per image rotation
	int pop;		//population
	char autoscale; //autoscale images if they don't match dimensions
	bool shuffle;	//shuffle images instead of displaying in sequence
	bool alternate;	//use first image on every other rotation
	bool gmo;		//use GMOs for first run instead of random mutants
	char display_buffer; //display buffer, only modified at runtime.
	int smudge; //smudge factor, as a percentage
	int smudgedist; //smudge distance, percentage of velocity

	float opacity_f;
	float digest_f; //amount of color an animal can eat per step.
};

extern Settings settings;

#define A_R settings.radius		// Max animal radius
#define A_S	settings.maxspeed * 0.005	// Max animal speed as a multiple of radius
#define A_D settings.digest_f	// Amount of color an animal can eat per step.
#define A_O settings.opacity_f	// animal opacity
#define A_V settings.vision		// Visual distance in image-pixels.

#define D_M settings.mutate		//Number of times to mutate DNA on a split

#define W_P	settings.pop			//World population (constant)
#define W_F settings.fitness		//Number of steps per fitness check
#define W_I settings.image			//Number of steps per image rotation
#define W_S settings.save			//save genes on exit?
#define W_C settings.diff / 100.0	//percent diff consumption to force an autoswap

#define N_R 0.015				//Neuron radius when rendering brain
#define N_L 0.03				//Neuron label "radius"
#define NULL 0					//null

#include "util.h"

# Change User Description Committed
#20 5890 Sam Stafford Increased granularity of "digestion" setting so that lower values can
be set.  (This change is backwards-compatible with old settings files.)
#19 5818 Sam Stafford Configurable painter opacity.
#18 5691 Sam Stafford Rebuilt Scenesaver with Qt 3.3.6.
 Added a new flag to the config file (not in the GUI since it's pretty esoteric) that uses the background image on every other rotation in shuffle mode.
#17 5589 Sam Stafford Make painter speed configurable.
#16 4577 Sam Stafford Add new "smudge distance" tunable.
#15 4572 Sam Stafford New "smudge" feature.
 REALLY COOL.  Off by default (pctsmudge=0) since
it's a CPU hog.
#14 4561 Sam Stafford New smooth autoscaling, with configurable fit-to-screen behavior.
#13 4465 Sam Stafford Genetically engineered organisms - there's now an option to seed the
initial population with these relentlessly efficient creatures rather
than random mutants.  Kinda neat-looking, but not as organic-looking as
pure evolved creatures.
#12 4462 Sam Stafford Image shuffle option.
#11 4458 Sam Stafford Allow screenshot to capture the current buffer rather than always
defaulting to the front one.  (This lets people take cool "diff"
screenshots.)
#10 4457 Sam Stafford After the first round of user feedback:

1) Added option to autoscale images if they don't match in size (on by
default)
2) Fixed crash bug if you tried to cycle the chasecam when it had
never been initialized.
#9 4451 Sam Stafford All significant variables are now user-tweakable.
#8 4448 Sam Stafford Turn this thing into a Windows screensaver.
#7 4447 Sam Stafford Cleanup size-heredity code.
#6 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.
#5 4441 Sam Stafford Ported chase-cam view.
#4 4440 Sam Stafford Bug fixes, new features, the usual.
#3 4439 Sam Stafford Hooked the brain up to its muscles, gave the world physics.
#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/globals.h
#4 3356 Sam Stafford Calculate display width/height ratio, if possible, and set default
zoom level to prevent distortion.  (Windows only, thus far.)
#3 3354 Sam Stafford Code refactoring - split "main" functions into main.cpp (non-Windows) and winmain.cpp (Windows), with all shared code going in util.cpp.

No functional changes.
#2 3349 Sam Stafford Add a simulation variable "crtrspeed" that regulates the speed of the creatures.
 This allows those with blazingly fast CPUs to slow the action down.  (Those with crawlingly slow CPUs are out of luck, since above crtrspeed=400%, the creatures just teleport around the screen.)
#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.