Network settings
Configuration for client-server multiplayer connections using ENet.
SERVER_IP
const char*
default: "127.0.0.1"
IP address for server connections. Default localhost for local multiplayer testing.
Port number used for hosting and joining multiplayer games.
Show Network configuration
The game uses ENet for UDP-based networking with the following parameters:
Max clients: 1 (1v1 gameplay)
Max channels: 2
Bandwidth: Unlimited (0)
Packet flag: ENET_PACKET_FLAG_RELIABLE
Display settings
Window and rendering configuration constants.
Width of the game window in pixels.
Height of the game window in pixels. Window title is set to “WIZARD DUEL”.
Target frames per second set via SetTargetFPS(60). Controls game loop timing.
Camera settings
Camera zoom limits and default values for the 2D camera system.
Initial camera zoom level when game starts. Higher values zoom in closer to the character.
Minimum allowed camera zoom level. Provides maximum view distance but drains mana.
Maximum allowed camera zoom level. Closest view to the character.
Zoom level when pressing KEY_R to reset the camera view.
Show Camera controls and mana
Zoom controls:
KEY_Z: Increase zoom by 0.02f per frame
KEY_X: Decrease zoom by 0.02f per frame
KEY_R: Reset zoom to 9.9f
Mana interaction:
Zoom < 5.0f: Drains mana at rate of (zoom * 0.03f) per frame
Zoom > 5.0f: Regenerates mana at rate of 0.01f per frame (if mana < 300)
Camera offset:
Centered at (screenWidth / 2.0f, screenHeight / 2.0f)
Target follows local player at (pos.x + 20, pos.y + 20)
World parameters
World boundaries and environmental object configuration.
Maximum X-coordinate boundary of the playable world. Character dies if position exceeds this value.
Maximum Y-coordinate boundary of the playable world. Character dies if position falls below 0 or exceeds this value.
Number of tree obstacles spawned randomly throughout the world. Trees block character movement and interact with spell projectiles.
Tree dimensions:
Collision rectangle: 20 x 60 pixels
Texture: assets/tree.png
Tree spawning:
Random X position: 0 to 2000
Random Y position: 0 to 2000
Player safe spawn ensures no collision with trees
Tree interactions:
Blocks character movement (collision detection)
Spell projectiles with radius >= 4.0f destroy trees
Collision reduces projectile radius by 5.0f
Destroyed trees moved to position (0, 0)
Character defaults
Default values for character attributes and gameplay mechanics.
Starting and maximum health points for all characters. Health can exceed this value when using shields (RIGHT_MOUSE_BUTTON).
Starting and maximum mana points for all characters. Used for casting spells and healing.
Character movement speed per frame when pressing WASD keys.
character dimensions
Rectangle
default: "{ 0, 0, 20, 40 }"
Character collision rectangle with width 20 and height 40 pixels.
Show Health and mana mechanics
Health management:
Shield (RIGHT_MOUSE_BUTTON): Converts 10.0f mana to 2.0f health (requires mana > 12.0f)
Overshield decay: -3.0f health every 2 seconds when health > 300.0f
Death trigger: health <= 0.0f
Boundary death: Character exits world bounds (0-2000 range)
Mana management:
Spell costs: 5.0f mana per cast
Red spell minimum: 25.0f mana required
Blue spell minimum: 35.0f mana required
Regeneration: +0.01f per frame when zoom > 5.0f and mana < 300
Drain: -(zoom * 0.03f) per frame when zoom < 5.0f
Death system:
Death animation duration: 0.0f to 1.0f over time
Death text appears at deathTime >= 0.6f
Auto-reset to menu at deathTime >= 1.0f
All stats reset to defaults on respawn
Color constants
Predefined color values used throughout the game.
bloodRed
Color
default: "{ 128, 0, 0, 255 }"
Dark red color for the red spell projectile (KEY_ONE). RGBA values: R=128, G=0, B=0, A=255.
Default spell color constant set to Raylib’s RED color.
UI colors:
Menu background: BLACK
Button hover states: MAROON, DARKGREEN, DARKBLUE, DARKGRAY
Button default states: RED, GREEN, BLUE, GRAY
Gameplay colors:
Health bar: RED
Mana bar: PURPLE
Bar backgrounds: DARKGRAY
Local player tint: WHITE
Opponent tint: GRAY
Blue spell: DARKBLUE
Death screen: Faded BLACK and RED