diff --git a/worldgen-c/bin/worldgen b/worldgen-c/bin/worldgen index d2fa696..c85bbe8 100755 Binary files a/worldgen-c/bin/worldgen and b/worldgen-c/bin/worldgen differ diff --git a/worldgen-c/src/worldgen.c b/worldgen-c/src/worldgen.c index e27fecd..84a18c2 100644 --- a/worldgen-c/src/worldgen.c +++ b/worldgen-c/src/worldgen.c @@ -217,9 +217,9 @@ void worldgen_prepass(worldgen_ctx *ctx, int min_x, int max_x, int min_z, int ma ctx->trail_segment_count = 0; ctx->trail_segment_cap = 0; - const int step = 48; - const int max_points = 128; - const double min_spacing = 64.0; + const int step = 96; + const int max_points = 32; + const double min_spacing = 160.0; int cap = max_points; int count = 0; int *px = (int *)malloc((size_t)cap * sizeof(int)); @@ -271,8 +271,8 @@ void worldgen_prepass(worldgen_ctx *ctx, int min_x, int max_x, int min_z, int ma } /* Select hubs: pick top valued, then farthest from existing hubs */ - const int max_hubs = 3; - int hub_indices[3] = {0, 0, 0}; + const int max_hubs = 2; + int hub_indices[2] = {0, 0}; int hub_count = 0; int first = 0; for (int i = 1; i < count; ++i) { @@ -303,17 +303,15 @@ void worldgen_prepass(worldgen_ctx *ctx, int min_x, int max_x, int min_z, int ma } } - /* Connect hubs together */ - for (int i = 0; i < hub_count; ++i) { - for (int j = i + 1; j < hub_count; ++j) { - int *pts = NULL; - int path_count = 0; - if (build_trail_path(ctx, (double)px[hub_indices[i]], (double)pz[hub_indices[i]], - (double)px[hub_indices[j]], (double)pz[hub_indices[j]], &pts, &path_count) && pts && path_count >= 2) { - append_trail_segment(ctx, px[hub_indices[i]], pz[hub_indices[i]], px[hub_indices[j]], pz[hub_indices[j]], pts, path_count); - } else { - free(pts); - } + /* Connect hubs together (if two hubs exist) */ + if (hub_count == 2) { + int *pts = NULL; + int path_count = 0; + if (build_trail_path(ctx, (double)px[hub_indices[0]], (double)pz[hub_indices[0]], + (double)px[hub_indices[1]], (double)pz[hub_indices[1]], &pts, &path_count) && pts && path_count >= 2) { + append_trail_segment(ctx, px[hub_indices[0]], pz[hub_indices[0]], px[hub_indices[1]], pz[hub_indices[1]], pts, path_count); + } else { + free(pts); } } @@ -2622,9 +2620,9 @@ static int build_trail_path(worldgen_ctx *ctx, double ax, double az, double bx, if (used[ni]) continue; double next_height = heights[ni]; double slope = fabs(next_height - current_height); - if (slope > 3.5) continue; + if (slope > 3.0) continue; double base_cost = (neighbors[n][0] == 0 || neighbors[n][1] == 0) ? 1.0 : 1.41421356237; - double cost = base_cost * (1.0 + slope * 4.0); + double cost = base_cost * (1.0 + slope * 6.0); if (dist[current] + cost < dist[ni]) { dist[ni] = dist[current] + cost; prev[ni] = current;