Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sources/maps/cedar_rapids/GroundTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/cedar_rapids/SurfaceTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/cedar_rapids/SurfaceTiles_v2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/davenport/GroundTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/davenport/SurfaceTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/davenport/SurfaceTiles_v2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/des_moines/GroundTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/des_moines/SurfaceTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/des_moines/SurfaceTiles_v2.json

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions sources/maps/gis_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,22 +273,19 @@ def get_grid_coord(lat, lon):

for c in range(COLS):
idx = r * COLS + c
raw_elev = elevations[idx]

elev = int(50 + (raw_elev - 39) * 3)
elev = max(40, min(80, elev))

g_type = grid_class[r][c]

if g_type == "levee":
if g_type == "water":
elev = 40
elif g_type == "levee":
g_type = "parks"
if 20 <= r <= 24:
elev = 50 # Breach Crevasse
elev = 45 # Breach Crevasse
else:
elev = 72 # Solid Levee
if g_type == "water":
elev = 40
else:
dist = math.sqrt((c - 14)**2 + (abs(r - 22) * 0.6)**2)
elev = max(46, min(68, int(46 + (dist / 32.0) * 20)))

g_id = ground_counters.get(g_type, 0)
ground_counters[g_type] = g_id + 1
Expand Down
2 changes: 1 addition & 1 deletion sources/maps/greenville/GroundTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/greenville/SurfaceTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/greenville/SurfaceTiles_v2.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions sources/maps/greenville_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@
g_type = "parks"
# Low elevation at breach point (cols 20 to 25)
if 20 <= c <= 25:
elev = 50
elev = 45
else:
elev = 75
elev = 72
# Town at other rows
else:
elev = 50
if c in vertical_roads or r in horizontal_roads:
g_type = "road"
else:
Expand All @@ -83,6 +82,9 @@
g_type = "parking_lot"
else:
g_type = "parks"
# Gradient based on distance from breach (r=39, c=22)
dist = math.sqrt((r - 39)**2 + (abs(c - 22) * 0.6)**2)
elev = max(46, min(68, int(46 + (dist / 35.0) * 20)))

# Ground Tile JSON
g_id = ground_counters[g_type]
Expand Down
33 changes: 29 additions & 4 deletions sources/maps/map_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,20 @@ def fetch_elevations(lat_min, lat_max, lon_min, lon_max):
return elevations


def normalize_elevation(raw, emin, emax):
ELEV_MIN_LAND = 46
ELEV_MAX_LAND = 72


def normalize_elevation(raw, emin, emax, dist_to_water=None):
if emax - emin < 2.0 and dist_to_water is not None:
if dist_to_water <= 5:
return int(46 + (max(0, dist_to_water - 1) / 4.0) * 7)
else:
return int(56 + min(1.0, (dist_to_water - 5) / 10.0) * 14)
if emax == emin:
return 55
return 60
norm = (raw - emin) / (emax - emin)
return int(ELEV_MIN_GAME + norm * (ELEV_MAX_GAME - ELEV_MIN_GAME))
return int(ELEV_MIN_LAND + norm * (ELEV_MAX_LAND - ELEV_MIN_LAND))


def fetch_osm(lat_min, lat_max, lon_min, lon_max):
Expand Down Expand Up @@ -509,6 +518,20 @@ def find_grid_streets(counts, min_spacing=6, threshold=5):
print(f" Buildings: {building_counts}")

print("\n[Step 9] Building output arrays...")
from collections import deque
dist_map = [[999] * COLS for _ in range(ROWS)]
q = deque()
for (wr, wc) in water_cells:
dist_map[wr][wc] = 0
q.append((wr, wc))
while q:
cr, cc = q.popleft()
for dr, dc in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
nr, nc = cr + dr, cc + dc
if 0 <= nr < ROWS and 0 <= nc < COLS and dist_map[nr][nc] > dist_map[cr][cc] + 1:
dist_map[nr][nc] = dist_map[cr][cc] + 1
q.append((nr, nc))

ground_counters = {"water":0,"parks":0,"road":0,"building":0,"parking_lot":0}
surface_counters = {k:0 for k in PEOPLE_MAP}
ground_grid, surface_grid, surface_v2_grid = [], [], []
Expand All @@ -517,10 +540,12 @@ def find_grid_streets(counts, min_spacing=6, threshold=5):
ground_row, surface_row, v2_row = [], [], []
for c in range(COLS):
idx = r * COLS + c
elev = normalize_elevation(elevations[idx], emin, emax)
g_type = grid_class[r][c]
if g_type == "water":
elev = ELEV_MIN_GAME
else:
d_val = dist_map[r][c] if water_cells else None
elev = normalize_elevation(elevations[idx], emin, emax, d_val)
g_id = ground_counters.get(g_type, 0)
ground_counters[g_type] = g_id + 1
ground_row.append({"row":r,"column":c,"elevation":elev,"type":g_type,"instanceId":g_id,"floodWall":0})
Expand Down
2 changes: 1 addition & 1 deletion sources/maps/st_bernard/GroundTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/st_bernard/SurfaceTiles.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/maps/st_bernard/SurfaceTiles_v2.json

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions sources/maps/st_bernard_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,22 +291,20 @@ def get_grid_coord(lat, lon):
idx = r * COLS + c
raw_elev = elevations[idx]

# Scale elevation relative to sea level (0 meters)
elev = int(50 + (raw_elev - 0) * 3)
elev = max(40, min(80, elev))

g_type = grid_class[r][c]

if g_type == "levee":
if g_type == "water":
elev = 40
elif g_type == "levee":
g_type = "parks"
# Detonation crevasse point is modeled in the middle of the vertical levee (rows 20 to 24)
if 20 <= r <= 24:
elev = 50
elev = 45
else:
elev = 72
if g_type == "water":
elev = 40
else:
dist = math.sqrt((c - 14)**2 + (abs(r - 22) * 0.6)**2)
elev = max(46, min(68, int(46 + (dist / 32.0) * 20)))

g_id = ground_counters.get(g_type, 0)
ground_counters[g_type] = g_id + 1
Expand Down