Overview
All configuration constants are defined inheaders/cub3d.h. These control window settings, player behavior, entity properties, rendering parameters, and performance tuning.
Window Configuration
Window and display settings.Window title displayed in the title bar.
Window width in pixels. Can be overridden at compile time.
Window height in pixels. Can be overridden at compile time.
Player Configuration
Player movement, camera, and interaction settings.Movement
Player walking speed in units per second.
Player sprinting speed in units per second (1.5x walk speed).
Player collision box width in map units.
Player collision box height in map units.
Camera & Vision
Player field of view in degrees. Standard FOV similar to classic FPS games.
Mouse look sensitivity (degrees per pixel movement).
Keyboard look rotation speed in degrees per second.
Raycasting
Maximum ray distance when no wall is intersected.
Number of sub-rays cast per screen column for improved hit detection.Higher values improve accuracy but reduce performance.
Maximum number of entities tracked per ray for shooting.
Interaction
Maximum distance to interact with entities (doors, items, etc.).
Multiplayer
Maximum number of simultaneous players.
Milliseconds before respawning a dead player.
Character Configuration
Settings for NPCs and character entities.Milliseconds of invulnerability after taking damage (prevents multi-hit).
Default maximum health for character entities.
Billboard Configuration
Settings for sprite-based entities.Default width of billboard sprites in map units.
Default height of billboard sprites in map units.
Entity Configuration
General entity system settings.Number of inventory slots per character.
Minimum seconds between inventory slot changes (prevents accidental scrolling).
Wall Configuration
Maximum distance to interact with walls (for action prompts).
Door Configuration
Frame rate for door opening/closing animations.Animation delay is calculated as:
1000 / DOOR_ANIMATION_FPS milliseconds per frame.Map Configuration
Map parsing and defaults.Map file loaded at startup.
Characters representing walkable space in map files.
Characters representing solid walls in map files.
Characters representing player spawn points (N=North, S=South, E=East, W=West).The character determines initial facing direction.
Rendering Configuration
Threading
Number of parallel threads for raycasting.
Optimal value depends on CPU core count. 4 threads works well for quad-core processors.
Minimap
Minimap width as a fraction of window width.For 1024px window: minimap width = 256px
Minimap height as a fraction of window height.For 768px window: minimap height = 192px
Performance Configuration
Frame Timing
Target frames per second (uncapped by default).
Initial delta time in seconds (equivalent to ~62.5 FPS).Updated dynamically each frame based on actual timing.
Loading Screen
Minimum milliseconds to display loading screen.Ensures loading screen is visible even for fast loads.
Asset Paths
Fonts
Default bitmap font for text rendering.
Textures
Fallback texture when assets fail to load.
Image displayed during map loading.
Mathematical Constants
Pi constant for trigonometric calculations.
Compilation Flags
FromMakefile:
Platform-Specific Settings
Emscripten (WebAssembly)
macOS vs Linux
The Makefile automatically detects the platform and links appropriate frameworks:- macOS
- Linux
Configuration Best Practices
Performance Tuning
- High-end systems: Increase
CAMERA_THREADSto 8, setFPS_LIMITto 144+ - Low-end systems: Reduce
PLAYER_RAY_SUBRAYSto 3, limit FPS to 60 - Web builds: Use 2-4 threads, lower FOV for better performance
Gameplay Tuning
- Increase
PLAYER_SPRINT_VELOCITYfor faster-paced gameplay - Adjust
CHARACTER_HIT_DELAYto balance combat difficulty - Modify
INVENTORY_SIZEfor more/fewer item slots
Visual Tuning
- Wider
PLAYER_FOV(90+) for more peripheral vision - Smaller
BILLBOARD_WIDTH/HEIGHTfor larger sprites - Adjust
MINIMAP_*_MULTIPLIERfor different minimap sizes
See Also
- Architecture Overview - System design and module structure
- Entities API - Entity structures using these constants
- Items & Weapons - Item system configuration