From a80471e2623eb4889958247dd440641413800122 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 6 Dec 2026 03:07:35 +0100 Subject: [PATCH] Cut 13b: bring total assets/maps/sion under 85 MiB with legacy tiles present --- tools/maps/sion/cga_builder.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/maps/sion/cga_builder.py b/tools/maps/sion/cga_builder.py index e0b3d5b..5e1c5ca 100644 --- a/tools/maps/sion/cga_builder.py +++ b/tools/maps/sion/cga_builder.py @@ -987,7 +987,7 @@ def _build_roof_zones( mat_top=roof_mat, mat_bot=pal["trim"], mat_side=pal["trim"], ao_top=245, ao_bot=165, ao_side=200, ) - l2_poly_s = poly.simplify(1.8, preserve_topology=True) + l2_poly_s = poly.simplify(2.4, preserve_topology=True) l2_poly = _clean_polygon_2d(l2_poly_s if isinstance(l2_poly_s, Polygon) else poly, min_area=0.8) or poly l2_roof_parts = extrude_2d_poly_prism( origin, u_axis, v_axis, n_axis, l2_poly, @@ -1105,7 +1105,7 @@ def build_cga_building( bldg_center_xz = np.array([fp_cx, fp_cz], dtype=np.float64) # Final Plinth polygons (NO minimum_rotated_rectangle expansion; secondary parts kept strictly separated) - plinth_tol = 0.65 if micro_zone in (MICRO_FORTRESS, MICRO_OLD_TOWN, MICRO_CIVIC) else 1.45 + plinth_tol = 0.85 if micro_zone in (MICRO_FORTRESS, MICRO_OLD_TOWN, MICRO_CIVIC) else 1.65 plinth_fps: list[Polygon] = [] for fp in footprints: ps = fp.simplify(plinth_tol, preserve_topology=True) @@ -1225,7 +1225,7 @@ def build_cga_building( lod2_solids: list[tuple[np.ndarray, int]] = [] lod2_body_h = max(1.0, eave_y - plinth_bot_y - 0.02) for pfp in plinth_fps: - l2_fp = pfp.simplify(2.2, preserve_topology=True) + l2_fp = pfp.simplify(2.6, preserve_topology=True) l2_fp = _clean_polygon_2d(l2_fp if isinstance(l2_fp, Polygon) else pfp, min_area=1.0) or pfp l2_t, _, _, _ = extrude_2d_poly_prism( np.array([0.0, plinth_bot_y, 0.0]), u_xz, v_xz, n_up, fp_to_uv(l2_fp), @@ -1293,20 +1293,20 @@ def build_cga_building( n_stories = max(1, int(round(wall_h / story_h_target))) hero_zone = micro_zone in (MICRO_OLD_TOWN, MICRO_FORTRESS, MICRO_CIVIC) - min_edge = 3.2 if hero_zone else 4.2 + min_edge = 3.6 if hero_zone else 4.6 ext_pts = _merge_short_ring_edges(list(plinth_fp.exterior.coords), min_edge_len=min_edge) raw_bays_len = max(3, len(ext_pts)) # Cap structural tiers cleanly so total city RCGA + LOD2 fits well <= 16 MiB (and total sion <= 85 MiB) avail_for_stories = MAX_ZONES_PER_BUILDING - (2 + n_roofs) - max_tiers = 4 if wall_h >= 20.0 else (3 if (hero_zone and wall_h >= 9.5) else (2 if wall_h >= 5.2 else 1)) - n_tiers = min(n_stories, max_tiers, max(1, avail_for_stories // max(4, min(raw_bays_len + 1, 6)))) + max_tiers = 4 if wall_h >= 22.0 else (3 if (hero_zone and wall_h >= 12.0) else (2 if ((hero_zone and wall_h >= 6.0) or wall_h >= 7.5) else 1)) + n_tiers = min(n_stories, max_tiers, max(1, avail_for_stories // max(4, min(raw_bays_len + 1, 5)))) n_tiers = max(1, n_tiers) - max_bays_per_tier = max(3, min(6 if hero_zone else 4, (avail_for_stories // n_tiers) - 1)) + max_bays_per_tier = max(3, min(5 if hero_zone else 4, (avail_for_stories // n_tiers) - 1)) perim = float(plinth_fp.exterior.length) - base_bay_len = 14.0 if hero_zone else (20.0 if (is_mauer or micro_zone == MICRO_RONQUOZ or perim > 70.0) else 18.0) + base_bay_len = 15.0 if hero_zone else (22.0 if (is_mauer or micro_zone == MICRO_RONQUOZ or perim > 70.0) else 20.0) bays_2d: list[tuple[np.ndarray, np.ndarray, float]] = [] for mult in (1.0, 1.4, 2.0, 3.0, 5.0, 10.0): cand = _split_ring_into_wall_bays(ext_pts, base_bay_len * mult) @@ -1345,7 +1345,7 @@ def build_cga_building( slab_inset = min(wall_thick * 0.45, 0.20) slab_polys_uv: list[Polygon] = [] for pfp in plinth_fps: - sfp = pfp.simplify(1.65, preserve_topology=True) + sfp = pfp.simplify(2.0, preserve_topology=True) if not isinstance(sfp, Polygon) or sfp.is_empty or sfp.area < 0.8: sfp = pfp sfp = sfp.buffer(-slab_inset, join_style="mitre") @@ -1386,9 +1386,9 @@ def build_cga_building( if len(zones) >= MAX_ZONES_PER_BUILDING - n_roofs - 1: break want_win = (not is_mauer) and ( - (hero_zone and blen >= 3.8 and t_idx == 0 and (b_i == 0 or (b_i == 2 and blen >= 5.5))) - or (micro_zone in (MICRO_VISSIGEN, MICRO_CLAVAU, MICRO_SUBURBAN) and blen >= 5.2 and b_i == 0 and t_idx == 0) - or (micro_zone == MICRO_RONQUOZ and blen >= 7.5 and b_i == 0 and t_idx == 0) + (hero_zone and blen >= 4.0 and t_idx == 0 and (b_i == 0 or (micro_zone in (MICRO_FORTRESS, MICRO_CIVIC) and b_i == 2 and blen >= 5.5))) + or (micro_zone in (MICRO_VISSIGEN, MICRO_CLAVAU, MICRO_SUBURBAN) and blen >= 6.0 and b_i == 0 and t_idx == 0) + or (micro_zone == MICRO_RONQUOZ and blen >= 8.5 and b_i == 0 and t_idx == 0) ) r_parts, c_parts, has_win = _build_wall_bay_geometry( sa, sb, blen, y0, bay_y_top, wall_thick, pal, micro_zone, @@ -1432,7 +1432,7 @@ def build_cga_building( prev_bay_mids = cur_bay_mids # 5. Roof Zones anchored to top-tier perimeter WallBays (never floating solely on 0.8m core) - lod2_roof_cap = 3 if micro_zone in (MICRO_FORTRESS, MICRO_CIVIC) else 1 + lod2_roof_cap = 2 if micro_zone in (MICRO_FORTRESS, MICRO_CIVIC) else 1 for r_i, (r_render, r_col, r_c3) in enumerate(roof_items): if len(zones) >= MAX_ZONES_PER_BUILDING: break