|
R-Type
Networked shoot'em up built on Aegis2D
|
Snapshots of the world sent to the clients (RFC section 4.3). More...
#include <aegis2d/net/packet.hpp>#include <rtype/compact.hpp>#include <rtype/tuning.hpp>#include <cstddef>#include <cstdint>#include <optional>#include <span>#include <vector>Go to the source code of this file.
Classes | |
| struct | rtype::PlayerRecord |
| What a snapshot says of a player. More... | |
| struct | rtype::EntityRecord |
| What a snapshot says of an entity. More... | |
| struct | rtype::Snapshot |
| The state of the world at one tick. More... | |
Namespaces | |
| namespace | rtype |
| R-Type game code, built on the Aegis2D engine. | |
Enumerations | |
| enum class | rtype::EntityKind : std::uint8_t { rtype::PlayerShip = 1 , rtype::PlayerMissile = 2 , rtype::BydosSlave = 3 , rtype::EnemyMissile = 4 } |
| Kind of an entity in snapshots and events (RFC section 4.1). More... | |
Functions | |
| std::size_t | rtype::entity_record_bits (std::uint32_t id_gap) noexcept |
| Size of an entity record. | |
| std::vector< std::vector< std::byte > > | rtype::write_snapshot (const Snapshot &snapshot) |
Encodes a snapshot as the payloads of Snapshot datagrams, header excluded. | |
| std::optional< Snapshot > | rtype::read_snapshot (std::span< const std::byte > payload) |
Decodes the payload of one Snapshot datagram. | |
Variables | |
| constexpr std::uint32_t | rtype::no_entity = 0xFFFFFFFF |
| Network id that names no entity, for a player out of lives. | |
| constexpr std::size_t | rtype::snapshot_fixed_bits = 32 + 3 + 16 |
| Bits of the tick, the player count and the entity count of a snapshot payload. | |
| constexpr unsigned | rtype::id_low_bits = 24 |
| Low bits of a network id, sent as their gap to those of the previous record: the index of the engine's Entity handles, small and dense among live entities. | |
| constexpr unsigned | rtype::id_high_bits = 8 |
| High bits of a network id, sent as they are: the generation of Entity handles. | |
| constexpr unsigned | rtype::kind_bits = 3 |
| Bits of the kind of an entity record: kinds 0 to 7. | |
| constexpr unsigned | rtype::frame_bits = 4 |
| Bits of the frame of an entity record: frames above 15 are sent as 15. | |
| constexpr std::size_t | rtype::entity_record_fixed_bits |
| Bits of an entity record besides the gap of its id's low bits: the id's high bits, kind, position, velocity and frame (69). | |
| constexpr std::uint32_t | rtype::short_id_gap = (std::uint32_t{1} << varint_group_bits) - 1U |
| Largest gap between the low bits of two records' ids that keeps a record within 10 bytes (77 bits). | |
Snapshots of the world sent to the clients (RFC section 4.3).