Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
TileMapGen.h
Go to the documentation of this file.
1#ifndef BOMBERMAN_SIM_TILEMAPGEN_H
2#define BOMBERMAN_SIM_TILEMAPGEN_H
3
4#include <random>
5
6#include "Const.h"
23namespace bomberman::sim
24{
31 inline void generateTileMap(uint32_t seed, Tile outTiles[tileArrayHeight][tileArrayWidth])
32 {
33 std::mt19937 rng(seed);
34 std::uniform_int_distribution<int> brickDist(0, kBrickSpawnRandomize);
35
36 for (int row = 0; row < static_cast<int>(tileArrayHeight); ++row)
37 {
38 for (int col = 0; col < static_cast<int>(tileArrayWidth); ++col)
39 {
40 outTiles[row][col] = baseTiles[row][col];
41
42 // Randomly promote Grass to Brick.
43 if (outTiles[row][col] == Tile::Grass && brickDist(rng) == 0)
44 {
45 outTiles[row][col] = Tile::Brick;
46 }
47 }
48 }
49 }
50
51} // namespace bomberman::sim
52
53#endif // BOMBERMAN_SIM_TILEMAPGEN_H
Game-world configuration constants.
constexpr unsigned int kBrickSpawnRandomize
Shared brick-density knob for generated maps; lower means more bricks.
Definition Const.h:27
constexpr unsigned int tileArrayWidth
Tile map width in tiles.
Definition Const.h:43
constexpr unsigned int tileArrayHeight
Tile map height in tiles.
Definition Const.h:44
Tile
Tile type identifiers used in the tile map.
Definition Const.h:13
Shared simulation primitives and constants used by both the client and the authoritative server.
Definition Movement.h:21
void generateTileMap(uint32_t seed, Tile outTiles[tileArrayHeight][tileArrayWidth])
Populates outTiles with a procedurally generated tile map.
Definition TileMapGen.h:31