Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
Movement.h File Reference

Shared authoritative movement simulation primitives. More...

#include "Const.h"
#include "Sim/SimConfig.h"

Go to the source code of this file.

Classes

struct  bomberman::sim::TilePos
 Tile-space Q8 position representing the CENTER of the entity. More...
 

Namespaces

namespace  bomberman::sim
 Shared simulation primitives and constants used by both the client and the authoritative server.
 

Typedefs

using bomberman::sim::TileMap = Tile[tileArrayHeight][tileArrayWidth]
 Read-only view of a runtime tile map (same layout as LevelScene::tiles).
 

Functions

bool bomberman::sim::isWalkable (const TileMap &map, int col, int row)
 Returns true if the given tile coordinate is passable.
 
bool bomberman::sim::overlapsWall (const TileMap &map, int32_t xQ, int32_t yQ)
 Returns true if the AABB centered at (xQ, yQ) with half-extent kHitboxHalfQ overlaps any solid tile.
 
TilePos bomberman::sim::stepMovement (TilePos pos, int8_t moveX, int8_t moveY, int32_t speedQ=kPlayerSpeedQ)
 Advances a position by one simulation tick given a directional input.
 
TilePos bomberman::sim::stepMovementWithCollision (TilePos pos, int8_t moveX, int8_t moveY, const TileMap &map, int32_t speedQ=kPlayerSpeedQ)
 Advances a position by one tick with tile-map collision.
 
int bomberman::sim::tileQToScreen (int32_t tileQ, int fieldPx, int scaledTile, int cameraPx)
 Converts a center tile-Q8 coordinate to the screen pixel at that center.
 
int bomberman::sim::tileQToScreenTopLeft (int32_t tileQ, int fieldPx, int scaledTile, int cameraPx)
 Converts a center tile-Q8 coordinate to the screen top-left pixel for sprite rendering.
 

Variables

constexpr int32_t bomberman::sim::kPlayerSpeedQ = static_cast<int32_t>(kPlayerSpeedTilesPerSecond * 256.0 / kTickRate + 0.5)
 Player movement speed in tile-Q8 units per simulation tick.
 
constexpr int32_t bomberman::sim::kHitboxHalfQ = static_cast<int32_t>(kPlayerHitboxScale * 256.0f / 2.0f)
 Player hitbox half-extent in tile-Q8 units.
 

Detailed Description

Shared authoritative movement simulation primitives.

All positions are in tile-space Q8 fixed-point and represent the center of the entity: xQ = tileColumn * 256 + 128, yQ = tileRow * 256 + 128

One Q8 unit = 1/256 of a tile.