src/Config.hh
author Tero Marttila <terom@fixme.fi>
Thu, 22 Jan 2009 02:38:33 +0200
branchnew_graphics
changeset 418 194bc810a570
parent 417 c503e0c6a740
child 423 947ab54de4b7
permissions -rw-r--r--
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
#ifndef CONFIG_HH
#define CONFIG_HH

/**
 * @file
 *
 * Various constants used to define application/game behaviour
 */

// build settings
#include "config.h"

// custom types
#include "Types.hh"

// for CL_Color
#include <ClanLib/display.h>

/**
 * @name General
 * @{
 */

// @}

/**
 * @name Terrain
 * @{
 */

/** Default random generator seed to use for terrain generator */
const int TERRAIN_RANDOM_SEED = 1337;

/** Default terrain size, equal to physics simulation size */
const PixelDimensions TERRAIN_DIMENSIONS (1000, 800);

/** Base color of empty space (i.e. background color) */
const CL_Color COLOR_EMPTY(86, 41, 0);

/** Base color of dirt */
const CL_Color COLOR_DIRT(144, 82, 23);

/** Base color of rock */
const CL_Color COLOR_ROCK(132, 136, 135);


// @}

/**
 * @name Engine
 * @{
 */

/** Engine timeout, this determines our minimum tick rate */
const TimeMS ENGINE_TIMEOUT_MS = 10;

/** Default log output level */
const LogLevel DEFAULT_LOG_LEVEL = DEBUG;

// @}

/**
 * @name Physics
 * @{
 */

/** The value of pi used in physics/graphics calculations */
const float KG_PI = 3.14159265;

/** Physics tick interval */
const TimeMS PHYSICS_TICK_MS = 10;

/** The force of gravity on objects, exerted on the Y axis */
const float MAP_GRAVITY = 1500.0;

// @}

/**
 * @name Player
 * @{
 */

const float PLAYER_MASS = 10.0;
const float PLAYER_MOVE_FORCE = 1100.0;
const float PLAYER_MIN_SPEED = 10.0;
const float PLAYER_JUMP_MIN_DISTANCE = 5.0;
const float PLAYER_AIM_MIN = -3*KG_PI/8; 
const float PLAYER_AIM_MAX = KG_PI/2;
const float PLAYER_INITIAL_X = 400.0;
const float PLAYER_INITIAL_Y = 300.0;
const float PLAYER_CROSSHAIR_DISTANCE = 20.0;
const float PLAYER_CROSSHAIR_WIDTH = 4;
const float CROSSHAIR_ANGLE_SPEED = PI/2000;
const float PLAYER_MAX_SPEED = 43;
const float PLAYER_WALK_SPEED = 33;
const float PLAYER_COLLISION_ELASTICITY = 0.25;
const float PLAYER_RADIUS = 10;

/** Radius if ground removed on digging */
const float PLAYER_DIG_RADIUS = 15;

/** Player's initial health */
const Health PLAYER_HEALTH = 100;

/** How long to wait after dying to respawn */
const TimeMS PLAYER_RESPAWN_DELAY = 2500;

// @}

/**
 * @name Projectile
 * @{
 */

/** Projectiles mass is irrelevant */
const float PROJECTILE_MASS = 10.0;

/** How far away from the player the projectile spawns */
const float PROJECTILE_START_DISTANCE = 10.0;

// @}

/**
 * @name Rope
 * @{
 */

/** How much to grow the rope length by on every ROPE_UP/DOWN */
const float ROPE_GROWTH_RATE = 5;

/** The force that the rope exerts on the player when the length is too long */
const float ROPE_FORCE = 3500;

/** Same as player mass...? */
const float ROPE_MASS = 10.0;

/** Initial rope length... this should probably be a bit more dynamic? */
const float ROPE_LENGTH = 100.0;

/** Initial velocity of the rope when thrown */
const float ROPE_VELOCITY = 500;

/**
 * Rope colors, it should alternate between these two
 */
const CL_Color ROPE_COLOR_LIGHT = CL_Color(198, 100, 2);
const CL_Color ROPE_COLOR_DARK = CL_Color(159, 79, 1);

// @}

/**
 * @name Graphics/Input
 * @{
 */

/** Window title, XXX: PROJECT_VERSION is unreliable */
const std::string GRAPHICS_WINDOW_TITLE = (std::string() + PROJECT_LONG_NAME + " : Version " + PROJECT_VERSION);

/** Default resolution */
const PixelDimensions GRAPHICS_RESOLUTION (800, 600);

/** Interval between frames */
const TimeMS GRAPHICS_UPDATE_INTERVAL_MS = 20;

/** Default fullscreen mode? */
const bool GRAPHICS_FULLSCREEN = false;

/** Number of pixels between lines */
const PixelDimension GRAPHICS_INFO_TEXT_LINE_OFFSET = 5;

/** Input handling keyboard poll interval */
const TimeMS INPUT_POLL_INTERVAL = 10;

/** How long to block INPUT_FLAG_NOREPEAT for */
const TimeMS INPUT_REPEAT_DELAY = 250;

// @}

/**
 * @name Network
 * @{
 */

/** Default port used for network games */
const std::string NETWORK_PORT_STR = "9338";

/** Maximum packet size used for normal NetworkPackets... aligned to a sensible UDP mtu */
const size_t NETWORK_PACKET_SIZE = 1280;

/** Backlog used for TCP server... doesn't really matter all that much */
const int NETWORK_LISTEN_BACKLOG = 5;

/** Magic string used to identify game between client/server */
const char NETWORK_MAGIC_STR[8+1] = "KISNGLIS";
const uint64_t NETWORK_MAGIC_ID = * ((const uint64_t *) NETWORK_MAGIC_STR);

// @}

/**
 * @name Filesystem paths
 * @{
 */
const std::string PLAYER_SKIN_PATH = (PROJECT_DATA_DIR "/skin.png");
const std::string RESOURCE_XML_PATH = (PROJECT_DATA_DIR "/resources.xml");

// @}

#endif