Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
weaken constraints for starting positions (flat radius for a buildabl…
Browse files Browse the repository at this point in the history
…e tile reduced from 40 too 35 meters)
  • Loading branch information
malytomas committed Jan 2, 2024
1 parent 92901fb commit 2b0875b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 3 additions & 1 deletion sources/startingPositions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace unnatural
for (uint32 i : spatQuery->result())
if (tiles[i].buildable)
b++;
static constexpr uint32 Threshold = CAGE_DEBUG_BOOL ? 400 : 2000;
static constexpr uint32 Threshold = CAGE_DEBUG_BOOL ? 400 : 2500;
return b < Threshold;
});
}
Expand Down Expand Up @@ -92,6 +92,8 @@ namespace unnatural
CAGE_LOG(SeverityEnum::Info, "generator", "generating starting positions");

const std::vector<uint32> allCandidates = generateCadidates();
if (allCandidates.empty())
CAGE_THROW_ERROR(Exception, "no starting positions candidates");

Real bestScore = 0;
static constexpr uint32 Limit = 100000 / (CAGE_DEBUG_BOOL ? 100 : 1);
Expand Down
11 changes: 5 additions & 6 deletions sources/tileProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace unnatural
const String c = Stringizer() + current;
const String r = Stringizer() + 100 * Real(current) / total;
const String g = maxc > 0 ? fill(String(), 30 * current / maxc, '#') : String();
CAGE_LOG_CONTINUE(SeverityEnum::Info, "tileStats", Stringizer() + fill(name, 28) + reverse(fill(reverse(c), 6)) + " ~ " + reverse(fill(reverse(r), 12)) + " % " + g);
CAGE_LOG_CONTINUE(SeverityEnum::Info, "tileStats", Stringizer() + fill(name, 28) + reverse(fill(reverse(c), 6)) + " ~ " + reverse(fill(reverse(r), 13)) + " % " + g);
}

template<uint32 Bins = 30>
Expand Down Expand Up @@ -194,26 +194,25 @@ namespace unnatural
Holder<SpatialQuery> spatQuery = newSpatialQuery(spatStruct.share());
for (uint32 i = 0; i < cnt; i++)
{
if (tiles[i].flatRadius < 40)
static constexpr Real Radius = 35;
if (tiles[i].flatRadius < Radius)
continue;
if (tiles[i].type >= TerrainTypeEnum::Rough)
continue;
tiles[i].buildable = true;
uint32 overlapped = 0;
spatQuery->intersection(Sphere(tiles[i].position, 40));
spatQuery->intersection(Sphere(tiles[i].position, Radius));
for (uint32 j : spatQuery->result())
{
if (tiles[j].type >= TerrainTypeEnum::Rough)
{
tiles[i].buildable = false;
break;
}
overlapped++;
}
if (tiles[i].buildable)
{
totalBuildable++;
totalOverlapped += overlapped;
totalOverlapped += spatQuery->result().size();
}
}
const uint32 totalBuildings = totalOverlapped ? numeric_cast<uint32>(uint64(totalBuildable) * totalBuildable / totalOverlapped) : 0;
Expand Down

0 comments on commit 2b0875b

Please sign in to comment.