R-Type
Networked shoot'em up built on Aegis2D
Loading...
Searching...
No Matches
tuning.hpp File Reference

Gameplay values of R-Type: play area, speeds, sizes, health, lives and scores. More...

#include <aegis2d/core/math.hpp>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <string_view>

Go to the source code of this file.

Namespaces

namespace  rtype
 R-Type game code, built on the Aegis2D engine.
 
namespace  rtype::tuning
 Values tuned for the game, in logical pixels, seconds and health points.
 

Variables

constexpr std::uint32_t rtype::tuning::tick_rate = 60
 Simulation rate of the server, in ticks per second.
 
constexpr std::uint32_t rtype::tuning::snapshot_rate = 20
 Snapshots the server sends each client per second (RFC section 4.3).
 
constexpr std::uint32_t rtype::tuning::position_history_ticks = tick_rate / 2
 Ticks of enemy positions the server keeps, for lag compensation: 500 ms.
 
constexpr std::chrono::milliseconds rtype::tuning::client_interpolation_delay {100}
 How far behind the server a client draws the world, as the server assumes it for lag compensation: the client's first interpolation delay, which clients do not report.
 
constexpr float rtype::tuning::area_width = 1280.0F
 Width of the play area (logical resolution).
 
constexpr float rtype::tuning::area_height = 720.0F
 Height of the play area (logical resolution).
 
constexpr std::size_t rtype::tuning::max_players = 4
 Players in one game, as the subject requires.
 
constexpr float rtype::tuning::player_speed = 300.0F
 Speed of a player ship, the same in every direction.
 
constexpr aegis2d::Vec2 rtype::tuning::player_size {33.0F, 17.0F}
 Size of a player ship on screen.
 
constexpr aegis2d::Vec2 rtype::tuning::player_hitbox {27.0F, 11.0F}
 Hit box of a player ship, a little smaller than its sprite.
 
constexpr std::int32_t rtype::tuning::player_health = 1
 Health points of a player ship: one hit loses a life.
 
constexpr std::uint32_t rtype::tuning::player_lives = 3
 Lives of a player at the start of a game.
 
constexpr float rtype::tuning::player_spawn_x = 100.0F
 Distance of the player spawns from the left edge.
 
constexpr float rtype::tuning::player_fire_cooldown = 0.25F
 Seconds between two shots of a player holding fire (four shots a second).
 
constexpr float rtype::tuning::player_missile_speed = 900.0F
 Speed of a player missile, to the right.
 
constexpr aegis2d::Vec2 rtype::tuning::player_missile_size {16.0F, 4.0F}
 Size of a player missile.
 
constexpr std::int32_t rtype::tuning::player_missile_damage = 1
 Damage of a player missile.
 
constexpr aegis2d::Vec2 rtype::tuning::bydos_size {32.0F, 32.0F}
 Size of a Bydos slave, as the clients draw it: width and height of assets/enemies/bydos_slave.lua, where its other values and its behavior are.
 
constexpr float rtype::tuning::bydos_lane_margin = 48.0F
 Room kept above and below the line of a random Bydos for its weave: the amplitude of assets/enemies/bydos_slave.lua.
 
constexpr std::string_view rtype::tuning::random_enemy = "bydos_slave"
 Enemy type the random spawns create, from assets/enemies.
 
constexpr float rtype::tuning::bydos_spawn_min_interval = 0.8F
 Shortest time between two random Bydos spawns, in seconds.
 
constexpr float rtype::tuning::bydos_spawn_max_interval = 2.0F
 Longest time between two random Bydos spawns, in seconds.
 
constexpr float rtype::tuning::bydos_spawn_x = area_width + (bydos_size.x / 2.0F)
 x of the random spawns: a Bydos appears just beyond the right edge.
 
constexpr float rtype::tuning::bydos_lane_top = bydos_lane_margin + (bydos_size.y / 2.0F)
 Highest line of a random Bydos, so that it weaves without leaving the screen.
 
constexpr float rtype::tuning::bydos_lane_bottom = area_height - bydos_lane_top
 Lowest line of a random Bydos.
 
constexpr std::int32_t rtype::tuning::easy_enemy_health_factor = 1
 Factor of the enemy health of an easy room: one missile still kills a Bydos.
 
constexpr float rtype::tuning::easy_spawn_interval_scale = 1.5F
 Random Bydos spawn intervals of an easy room, times the normal ones: fewer enemies.
 
constexpr std::int32_t rtype::tuning::hard_enemy_health_factor = 2
 Factor of the enemy health of a hard room: a Bydos takes two missiles.
 
constexpr float rtype::tuning::hard_spawn_interval_scale = 0.6F
 Random Bydos spawn intervals of a hard room, times the normal ones: more enemies.
 
constexpr float rtype::tuning::enemy_missile_speed = 300.0F
 Speed of an enemy missile, to the left.
 
constexpr aegis2d::Vec2 rtype::tuning::enemy_missile_size {8.0F, 8.0F}
 Size of an enemy missile.
 
constexpr std::int32_t rtype::tuning::enemy_missile_damage = 1
 Damage of an enemy missile.
 
constexpr std::int32_t rtype::tuning::ram_damage = 1
 Damage dealt by ramming: a player ship and a Bydos hurt each other on contact.
 
constexpr float rtype::tuning::despawn_margin = 64.0F
 Distance beyond the screen edges before a missile or an enemy is destroyed, so an enemy whose path dips off screen is kept (ecs::OffscreenDespawn::margin).
 
constexpr float rtype::tuning::collision_cell = 64.0F
 Side of a cell of the collision grid, about the size of a Bydos.
 

Detailed Description

Gameplay values of R-Type: play area, speeds, sizes, health, lives and scores.