16#include <unordered_set>
23constexpr float kInf = std::numeric_limits<float>::infinity();
24constexpr float kSqrt2 = 1.41421356237f;
28using NeighborFn = std::function<void(
int nx,
int ny,
float moveCost)>;
30Topology parseTopology(
const std::string &
name, Topology fallback) {
31 if (
name ==
"ortho4" ||
name ==
"orthogonal4" ||
name ==
"4")
return Topology::Ortho4;
32 if (
name ==
"ortho8" ||
name ==
"orthogonal8" ||
name ==
"8")
return Topology::Ortho8;
33 if (
name ==
"hex" ||
name ==
"hexagonal" ||
name ==
"staggered")
return Topology::Hex;
34 if (
name ==
"auto")
return fallback;
38const char *topologyName(Topology
t) {
40 case Topology::Ortho4:
42 case Topology::Ortho8:
50Topology topologyFromOrientation(
MapOrientation orientation,
bool preferDiagonal) {
51 switch (orientation) {
58 return preferDiagonal ? Topology::Ortho8 : Topology::Ortho4;
63 const NeighborFn &
fn) {
66 case Topology::Ortho4: {
67 static const int dx[4] = {1, -1, 0, 0};
68 static const int dy[4] = {0, 0, 1, -1};
69 for (
int i = 0; i < 4; ++i)
fn(
x +
dx[i],
y +
dy[i], 1.f);
72 case Topology::Ortho8: {
73 static const int dx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
74 static const int dy[8] = {0, 0, 1, -1, 1, -1, 1, -1};
75 for (
int i = 0; i < 8; ++i) {
76 const float c = (i < 4) ? 1.f : kSqrt2;
83 const bool rowOdd = ((
y & 1) != 0);
84 const bool shifted =
staggerOdd ? rowOdd : !rowOdd;
89 fn(
x + 1,
y - 1, 1.f);
91 fn(
x + 1,
y + 1, 1.f);
95 fn(
x - 1,
y - 1, 1.f);
97 fn(
x - 1,
y + 1, 1.f);
101 const bool colOdd = ((
x & 1) != 0);
102 const bool shifted =
staggerOdd ? colOdd : !colOdd;
107 fn(
x - 1,
y + 1, 1.f);
109 fn(
x + 1,
y + 1, 1.f);
113 fn(
x - 1,
y - 1, 1.f);
115 fn(
x + 1,
y - 1, 1.f);
124float heuristic(Topology
topology,
int x0,
int y0,
int x1,
int y1) {
125 const int dx = std::abs(x1 - x0);
126 const int dy = std::abs(y1 - y0);
128 case Topology::Ortho4:
129 return float(
dx +
dy);
130 case Topology::Ortho8:
131 return float(std::max(
dx,
dy)) + (kSqrt2 - 1.f) *
float(std::min(
dx,
dy));
132 case Topology::Hex: {
133 auto toCube = [](
int x,
int y) {
134 const int q =
x - (
y - (
y & 1)) / 2;
136 const int s = -
q -
r;
137 return std::tuple<int, int, int>{
q,
r,
s};
139 auto [q0, r0, s0] = toCube(x0, y0);
140 auto [q1, r1, s1] = toCube(x1, y1);
141 return float(std::max({std::abs(q0 - q1), std::abs(r0 - r1), std::abs(s0 - s1)}));
144 return float(
dx +
dy);
166 bool inBounds(
int x,
int y)
const {
return x >= 0 &&
y >= 0 &&
x <
width &&
y <
height; }
168 void resize(
int w,
int h) {
171 cost.assign(
size_t(width * height), 1.f);
172 enterMask.assign(
size_t(width * height), 0xff);
173 exitMask.assign(
size_t(width * height), 0xff);
177 void applyAutoTopologyFromLayer() {
179 topology = topologyFromOrientation(
layer->config()->orientation, diagonal);
185 auto cfg =
layer->config();
186 resize(cfg->mapW, cfg->mapH);
189 if (!topologyManual) applyAutoTopologyFromLayer();
193 void clearLayer() {
layer =
nullptr; }
195 void syncFromLayer() {
197 auto cfg =
layer->config();
199 if (cfg->mapW != width || cfg->mapH != height) resize(cfg->mapW, cfg->mapH);
202 if (!topologyManual) applyAutoTopologyFromLayer();
204 const auto tileset =
layer->tileset();
206 for (
int i = 0; i <
n; ++i) {
207 const uint32_t gid = (i < int(
tiles->gids.size())) ?
tileGid(
tiles->gids[
size_t(i)]) : 0
u;
208 bool blocked =
false;
209 float movementCost = 1.f;
210 uint8_t cellEnterMask = 0xff;
211 uint8_t cellExitMask = 0xff;
212 if (blockEmpty && gid == 0
u) blocked =
true;
215 const auto visual = std::find_if(
216 tileset->visuals.begin(), tileset->visuals.end(),
217 [gid](
const TileLayer::Tileset::Visual &candidate) { return candidate.gid == int(gid); });
218 if (visual != tileset->visuals.end()) {
219 blocked = blocked || !visual->walkable;
220 movementCost = std::max(0.001f, visual->cost);
221 cellEnterMask = visual->enterMask;
222 cellExitMask = visual->exitMask;
225 cost[size_t(i)] = blocked ? 0.f : movementCost;
233 void setTopology(
const std::string &
name) {
234 if (
name ==
"auto") {
236 if (layer) applyAutoTopologyFromLayer();
245 void setDiagonal(
bool enable) {
247 if (!topologyManual && layer) applyAutoTopologyFromLayer();
248 else if (!topologyManual)
topology =
diagonal ? Topology::Ortho8 : Topology::Ortho4;
252 void blockGid(
int gid) {
256 if (layer) syncFromLayer();
259 void unblockGid(
int gid) {
263 if (layer) syncFromLayer();
266 void clearBlockedGids() {
269 if (layer) syncFromLayer();
272 void setBlockEmpty(
bool enable) {
275 if (layer) syncFromLayer();
278 bool isWalkable(
int x,
int y)
const {
279 if (!inBounds(
x,
y))
return false;
283 void setBlocked(
int x,
int y,
bool blocked) {
284 if (!inBounds(
x,
y))
return;
289 void setCellCost(
int x,
int y,
float c) {
290 if (!inBounds(
x,
y))
return;
295 float getCellCost(
int x,
int y)
const {
296 if (!inBounds(
x,
y))
return 0.f;
300 bool canTraverseCardinal(
int x,
int y,
int nx,
int ny)
const {
301 if (!isWalkable(
x,
y) || !isWalkable(
nx,
ny))
return false;
304 if (
nx ==
x &&
ny ==
y - 1) {
307 }
else if (
nx ==
x + 1 &&
ny ==
y) {
310 }
else if (
nx ==
x &&
ny ==
y + 1) {
313 }
else if (
nx ==
x - 1 &&
ny ==
y) {
322 void forEachWalkableNeighbor(
int x,
int y,
const NeighborFn &
fn)
const {
323 if (!
fn || !inBounds(
x,
y))
return;
324 forEachNeighbor(topology,
x,
y, staggerAxisY, staggerOdd, [&](
int nx,
int ny,
float moveCost) {
325 if (!isWalkable(
nx,
ny))
return;
326 if (!canTraverseCardinal(
x,
y,
nx,
ny))
return;
327 if (topology == Topology::Ortho8) {
328 const int dx =
nx -
x;
329 const int dy =
ny -
y;
330 if (
dx != 0 &&
dy != 0) {
331 if (!canTraverseCardinal(
x,
y,
x +
dx,
y) || !canTraverseCardinal(
x,
y,
x,
y +
dy))
return;
342 bool operator>(
const HeapNode &o)
const {
return f > o.f; }
364 return data_ ? std::span<const float>(data_->costs) : std::span<const float>{};
367 return data_ ? std::span<const std::uint8_t>(data_->enterMasks) : std::span<const std::uint8_t>{};
370 return data_ ? std::span<const std::uint8_t>(data_->exitMasks) : std::span<const std::uint8_t>{};
394 auto *
layer = impl_->grid.layer;
395 return {impl_->changes,
layer ?
layer->tiles()->revision : 0};
400 impl_->grid.bindLayer(
layer);
405 impl_->grid.clearLayer();
411 impl_->grid.setTopology(
name);
418 impl_->grid.setDiagonal(enable);
425 impl_->grid.blockGid(gid);
430 impl_->grid.unblockGid(gid);
435 impl_->grid.clearBlockedGids();
440 impl_->grid.setBlockEmpty(enable);
447 impl_->grid.setBlocked(
x,
y, blocked);
454 impl_->grid.setCellCost(
x,
y,
cost);
461 impl_->grid.syncFromLayer();
465 if (impl_->changes == std::numeric_limits<std::uint64_t>::max())
468 impl_->hasCachedField =
false;
469 impl_->cachedField.clear();
474bool ensureSynced(Grid &grid) {
475 if (grid.layer && (grid.dirty || grid.layerRevision != grid.layer->tiles()->revision))
476 grid.syncFromLayer();
477 return grid.width > 0 && grid.height > 0;
480FlowField *buildFlowFieldUncached(Grid &grid,
int gx,
int gy) {
481 auto *field =
new FlowField();
482 if (!ensureSynced(grid) || !grid.isWalkable(gx, gy)) {
483 field->resize(grid.width, grid.height);
484 field->setGoal(gx, gy);
488 const int w = grid.width;
489 const int h = grid.height;
491 field->setGoal(gx, gy);
493 const auto idx = [
w](
int x,
int y) {
return y *
w +
x; };
494 std::vector<float> dist(
size_t(
w *
h), kInf);
495 std::priority_queue<HeapNode, std::vector<HeapNode>, std::greater<HeapNode>> open;
497 dist[size_t(
idx(gx, gy))] = 0.f;
498 field->setCost(gx, gy, 0.f);
499 field->setNext(gx, gy, gx, gy);
500 open.push(HeapNode{0.f,
idx(gx, gy)});
502 while (!open.empty()) {
503 const HeapNode cur = open.top();
505 if (cur.f > dist[
size_t(cur.idx)])
continue;
506 const int cx = cur.idx %
w;
507 const int cy = cur.idx /
w;
508 const float enterCur =
grid.getCellCost(
cx,
cy);
510 [&](
int nx,
int ny,
float moveCost) {
511 if (!grid.isWalkable(nx, ny)) return;
512 if (grid.topology == Topology::Ortho8) {
513 const int dx = nx - cx;
514 const int dy = ny - cy;
515 if (dx != 0 && dy != 0) {
516 if (!grid.isWalkable(cx + dx, cy) || !grid.isWalkable(cx, cy + dy))
521 const float tentative = dist[size_t(cur.idx)] +
moveCost * enterCur;
522 if (tentative + 1e-6f >= dist[
size_t(ni)])
return;
523 dist[size_t(ni)] = tentative;
526 open.push(HeapNode{tentative, ni});
538 Grid staged = impl_->grid;
539 if (!ensureSynced(staged) || std::int64_t(staged.width) * staged.height > 4 * 1024 * 1024)
542 const auto count =
static_cast<std::size_t
>(std::int64_t(staged.width) * staged.height);
543 if (staged.cost.size() !=
count || staged.enterMask.size() !=
count || staged.exitMask.size() !=
count)
546 for (
const float cost : staged.cost)
547 if (!std::isfinite(
cost))
551 const bool axisY =
topology != NavigationTopology::Hex || staged.staggerAxisY;
552 const bool odd =
topology != NavigationTopology::Hex || staged.staggerOdd;
553 const auto &
previous = impl_->lastCapture.data_;
556 previous->costs == staged.cost &&
previous->enterMasks == staged.enterMask &&
557 previous->exitMasks == staged.exitMask)
559 if (
previous &&
previous->revision == std::numeric_limits<std::uint64_t>::max())
562 auto data = std::make_shared<NavigationGridSnapshot::Data>();
563 data->width = staged.width;
564 data->height = staged.height;
567 data->staggerAxisY =
axisY;
568 data->staggerOdd = odd;
569 data->costs = std::move(staged.cost);
570 data->enterMasks = std::move(staged.enterMask);
571 data->exitMasks = std::move(staged.exitMask);
573 result.data_ = std::move(data);
574 impl_->lastCapture =
result;
576}
catch (
const std::exception &
error) {
582Path *Pathfinder::findPath(
int sx,
int sy,
int gx,
int gy) {
583 return findPath(
sx,
sy, gx, gy, {});
589 std::size_t operator()(
const std::pair<int, int> &
cell)
const noexcept {
590 return (
static_cast<std::size_t
>(
static_cast<std::uint32_t
>(
cell.first)) << 32) ^
591 static_cast<std::uint32_t
>(
cell.second);
595Result<bool> keepsPathOpenWithBlocks(Pathfinder &finder, Grid &grid,
int sx,
int sy,
int gx,
int gy,
596 const std::unordered_set<std::pair<int, int>, CellHash> &blocks) {
597 if (!ensureSynced(grid) || grid.width <= 0 || grid.height <= 0) {
599 "pathfinder grid is empty",
"pathfinder.grid", {},
"map"));
601 for (
const auto &
cell : blocks) {
604 "temporary block cell is out of bounds",
605 "pathfinder.block", {},
"map"));
611 std::unique_ptr<Path>
path(finder.findPath(
sx,
sy, gx, gy, [&blocks](
int x,
int y) {
612 return blocks.count({x, y}) ? kInf : 0.f;
619Result<bool> Pathfinder::keepsPathOpen(
int sx,
int sy,
int gx,
int gy,
int blockX,
int blockY) {
620 std::unordered_set<std::pair<int, int>, CellHash> blocks;
621 blocks.emplace(blockX, blockY);
622 return keepsPathOpenWithBlocks(*
this, impl_->grid,
sx,
sy, gx, gy, blocks);
625Result<bool> Pathfinder::keepsPathOpenFootprint(
int sx,
int sy,
int gx,
int gy,
int originX,
int originY,
626 int footprintW,
int footprintH) {
627 if (footprintW <= 0 || footprintH <= 0) {
629 "footprint size must be positive",
630 "pathfinder.footprint", {},
"map"));
632 std::unordered_set<std::pair<int, int>, CellHash> blocks;
633 blocks.reserve(
static_cast<std::size_t
>(footprintW) *
static_cast<std::size_t
>(footprintH));
634 for (
int y = 0;
y < footprintH; ++
y)
635 for (
int x = 0;
x < footprintW; ++
x) blocks.emplace(originX +
x, originY +
y);
636 return keepsPathOpenWithBlocks(*
this, impl_->grid,
sx,
sy, gx, gy, blocks);
639Path *Pathfinder::findPath(
int sx,
int sy,
int gx,
int gy,
640 const std::function<
float(
int,
int)> &entryPenalty) {
642 Grid &grid = impl_->grid;
643 if (!ensureSynced(grid))
return path;
644 if (!grid.isWalkable(
sx,
sy) || !grid.isWalkable(gx, gy))
return path;
645 if (
sx == gx &&
sy == gy) {
647 path->setTotalCost(0.f);
651 const int w = grid.width;
652 const int n =
w * grid.height;
653 const auto idx = [
w](
int x,
int y) {
return y *
w +
x; };
655 std::vector<float> gScore(
size_t(
n), kInf);
656 std::vector<int>
parent(
size_t(
n), -1);
657 std::vector<uint8_t> closed(
size_t(
n), 0);
659 std::priority_queue<HeapNode, std::vector<HeapNode>, std::greater<HeapNode>> open;
661 const int goal =
idx(gx, gy);
662 gScore[size_t(
start)] = 0.f;
663 open.push(HeapNode{heuristic(grid.topology,
sx,
sy, gx, gy),
start});
666 while (!open.empty()) {
667 const HeapNode cur = open.top();
669 if (closed[
size_t(cur.idx)])
continue;
670 closed[size_t(cur.idx)] = 1;
671 if (cur.idx == goal) {
675 const int cx = cur.idx %
w;
676 const int cy = cur.idx /
w;
677 grid.forEachWalkableNeighbor(
cx,
cy, [&](
int nx,
int ny,
float edgeCost) {
679 if (closed[
size_t(ni)])
return;
680 float penalty = entryPenalty ? entryPenalty(
nx,
ny) : 0.0f;
681 if (!std::isfinite(penalty))
return;
682 penalty = std::max(0.0f, penalty);
683 const float tentative = gScore[size_t(cur.idx)] + edgeCost + penalty;
684 if (tentative >= gScore[
size_t(ni)])
return;
685 gScore[size_t(ni)] = tentative;
686 parent[size_t(ni)] = cur.idx;
687 open.push(HeapNode{tentative + heuristic(grid.topology,
nx,
ny, gx, gy), ni});
695 path->add(cur %
w, cur /
w);
696 if (cur ==
start)
break;
697 cur =
parent[size_t(cur)];
700 path->setTotalCost(gScore[
size_t(goal)]);
705 Grid &grid = impl_->grid;
706 if (!ensureSynced(grid)) {
709 empty->setGoal(gx, gy);
713 if (impl_->hasCachedField && !grid.dirty && impl_->cachedGoalX == gx && impl_->cachedGoalY == gy &&
714 impl_->cachedField.getWidth() == grid.width &&
715 impl_->cachedField.getHeight() == grid.height) {
717 *copy = impl_->cachedField;
721 FlowField *field = buildFlowFieldUncached(grid, gx, gy);
722 impl_->cachedField = *field;
723 impl_->cachedGoalX = gx;
724 impl_->cachedGoalY = gy;
725 impl_->hasCachedField =
true;
732 Grid &grid = impl_->grid;
733 if (!field || !ensureSynced(grid))
return path;
734 if (!field->isReachable(
sx,
sy))
return path;
736 const int gx = field->getGoalX();
737 const int gy = field->getGoalY();
738 const int maxSteps = grid.width * grid.height + 2;
744 if (
x == gx &&
y == gy)
break;
745 const int nx = field->nextX(
x,
y);
746 const int ny = field->nextY(
x,
y);
747 if (
nx ==
x &&
ny ==
y)
break;
748 const float c0 = field->costAt(
x,
y);
749 const float c1 = field->costAt(
nx,
ny);
750 if (c0 < kInf && c1 < kInf && c0 >= c1) total += (c0 - c1);
755 path->setTotalCost(total);
756 if (
path->getLength() > 0) {
757 const int lx =
path->getX(
path->getLength() - 1);
758 const int ly =
path->getY(
path->getLength() - 1);
759 if (lx != gx || ly != gy)
path->clear();
764Path *Pathfinder::findGroupPath(
int sx,
int sy,
int gx,
int gy) {
765 Grid &grid = impl_->grid;
766 if (!ensureSynced(grid))
return new Path();
767 if (!impl_->hasCachedField || grid.dirty || impl_->cachedGoalX != gx || impl_->cachedGoalY != gy ||
768 impl_->cachedField.getWidth() != grid.width ||
769 impl_->cachedField.getHeight() != grid.height) {
770 FlowField *tmp = buildFlowFieldUncached(grid, gx, gy);
771 impl_->cachedField = *tmp;
773 impl_->cachedGoalX = gx;
774 impl_->cachedGoalY = gy;
775 impl_->hasCachedField =
true;
778 return followFlow(&impl_->cachedField,
sx,
sy);
788void Path::add(
int x,
int y) { cells_.push_back(
Cell{
x,
y}); }
790void Path::reverse() {
791 for (
size_t i = 0, j = cells_.size(); i + 1 < j; ++i, --j) std::swap(cells_[i], cells_[j - 1]);
794int Path::getLength()
const {
return int(cells_.size()); }
797 if (index < 0 || index >=
int(cells_.size()))
return 0;
798 return cells_[size_t(
index)].x;
802 if (index < 0 || index >=
int(cells_.size()))
return 0;
803 return cells_[size_t(
index)].y;
806float Path::getTotalCost()
const {
return totalCost_; }
808void Path::setTotalCost(
float cost) { totalCost_ =
cost; }
810void FlowField::clear() {
811 width_ = height_ = 0;
821 const int n = width_ * height_;
822 cost_.assign(
size_t(
n), kUnreachable);
823 nextX_.assign(
size_t(
n), 0);
824 nextY_.assign(
size_t(
n), 0);
825 for (
int y = 0;
y < height_; ++
y) {
826 for (
int x = 0;
x < width_; ++
x) {
828 nextX_[size_t(i)] =
x;
829 nextY_[size_t(i)] =
y;
834void FlowField::setGoal(
int x,
int y) {
839bool FlowField::inBounds(
int x,
int y)
const {
840 return x >= 0 &&
y >= 0 &&
x < width_ &&
y < height_;
843float FlowField::costAt(
int x,
int y)
const {
844 if (!inBounds(
x,
y))
return kUnreachable;
845 return cost_[size_t(
index(
x,
y))];
848void FlowField::setCost(
int x,
int y,
float cost) {
849 if (!inBounds(
x,
y))
return;
853int FlowField::nextX(
int x,
int y)
const {
854 if (!inBounds(
x,
y))
return x;
855 return nextX_[size_t(
index(
x,
y))];
858int FlowField::nextY(
int x,
int y)
const {
859 if (!inBounds(
x,
y))
return y;
860 return nextY_[size_t(
index(
x,
y))];
863void FlowField::setNext(
int x,
int y,
int nx,
int ny) {
864 if (!inBounds(
x,
y))
return;
866 nextX_[size_t(i)] =
nx;
867 nextY_[size_t(i)] =
ny;
870bool FlowField::isReachable(
int x,
int y)
const {
871 const float c = costAt(
x,
y);
872 return c < kUnreachable && c >= 0.f;
Stable, structured diagnostics shared by engine modules.
eve::resource::CostSpec cost
std::array< double, 10 > q
const ColourScope * parent
std::shared_ptr< const OceanSprayFrame > previous
std::unordered_set< uint32_t > blockedGids
std::vector< uint8_t > exitMask
std::vector< uint8_t > enterMask
RoadLaneDirection direction
std::vector< WfcTile > tiles
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
EVENGINE_API_FOUNDATION public API.
Move-only operation result carrying either a value or Status.
static Result success(T value)
Construct a successful result owning value.
static Result failure(Status status)
Construct a failed result from a structured status.
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Integration + direction field for group pathfinding to a single goal. nextX/nextY point to the neighb...
Immutable owning capture; independent of Pathfinder and TileLayer lifetimes.
bool isStaggerAxisY() const noexcept
Read hex stagger axis (normalized to Y for orthogonal captures).
NavigationTopology topology() const noexcept
Read captured adjacency.
int height() const noexcept
Read row count.
std::span< const float > costs() const noexcept
Borrow costs while at least one snapshot retains this capture; reassignment releases it.
int width() const noexcept
Read column count.
std::span< const std::uint8_t > enterMasks() const noexcept
Borrow directional enter masks with the same snapshot lifetime.
bool isStaggerOdd() const noexcept
Read hex stagger parity (normalized to odd for orthogonal captures).
std::uint64_t revision() const noexcept
Read content revision, advanced only on changed captured content.
std::span< const std::uint8_t > exitMasks() const noexcept
Borrow directional exit masks with the same snapshot lifetime.
Ordered tile-index waypoints from start to goal (inclusive).
Pathfinding facade. Single-agent: A*. Group (same goal): Flow Field + follow. Grid/topology internals...
std::string getTopology() const
Returns the topology.
void invalidateCache()
Invalidate cached flow field (also called when grid dirties).
void setBlockEmpty(bool enable)
Sets the block empty.
void syncFromLayer()
Synchronizes from layer.
float getCellCost(int x, int y) const
Returns the cell cost.
void bindLayer(TileLayer *layer)
Binds layer.
void setCellCost(int x, int y, float cost)
Sets the cell cost.
void setTopology(const std::string &name)
Sets the topology.
bool getBlockEmpty() const
Returns the block empty.
bool isWalkable(int x, int y) const
True when walkable.
bool getDiagonal() const
Returns the diagonal.
void blockGid(int gid)
Block gid.
void setBlocked(int x, int y, bool blocked)
Sets the blocked.
void setSize(int width, int height)
Sets the size.
void clearBlockedGids()
Clears blocked gids.
void unblockGid(int gid)
Unblock gid.
void setDiagonal(bool enable)
Sets the diagonal.
ECS tile layer entity. Script mutates tile GIDs / tileset / draw; TileRenderSystem batch-draws atlas ...
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
void bindLayer(Shader *shader, bool alwaysDark)
Binds layer.
std::int32_t moveCost(const HexMap &map, HexCoordinates from, HexCoordinates to, HexDirection direction, const HexOccupancyQuery &occupied)
Cost of moving between two adjacent cells.
constexpr HexDirection opposite(HexDirection d) noexcept
The direction opposite to d.
放置世界:格子占用(多通道)+ 地形语义 + 已放置建筑实例。 行为由 PlacementSystem 提供;本类暴露便于脚本绑定的薄封装方法。 坐标换算统一走 eve::grid(支持 rectang...
MapOrientation
Tile map layout: orthogonal, isometric, staggered, or hexagonal.
uint32_t tileGid(uint32_t raw)
Strip Tiled flip / rotate flags; keep low 28 bits.
NavigationTopology
Logical adjacency of a captured map navigation grid.
WidgetDesc grid(int columns, std::vector< WidgetDesc > children, std::string id)
Fixed-column grid; children are placed in source order.
SettlementPipeline::Stage fn
Cheap invalidation hint, distinct from immutable capture content revisions. Includes bound-layer tile...
std::vector< std::uint8_t > enterMasks
NavigationTopology topology
std::vector< float > costs
std::vector< std::uint8_t > exitMasks
NavigationGridSnapshot lastCapture