World traffic2 min read

Development Log: Map Transportation System
Over the past two months, alongside daily bug fixes and code refactoring, the most significant update has been the addition of a transportation system to the map, connecting all towns and settlements. Here's an overview of the system and its implementation:
Feature Image Legend
- Black: Represents land transportation routes.
- White: Represents sea routes.
Transportation System Design
The core idea of the system is to use the region blocks of the map as nodes for the pathfinding algorithm. Here's how it works:
- Pathfinding Between Cities:
- I generated the shortest paths between each pair of cities using the region blocks as nodes.
- Kruskal's Algorithm:
- I applied Kruskal's algorithm to connect the shortest non-looping paths between cities.
- Additional nearby city nodes were added later to optimize the results.
- Secondary Paths:
- Within each region, the second layer of the dual-mesh (property blocks) was used to mark secondary paths using a similar pathfinding algorithm.
- Tilemap Integration:
- The main and secondary roads were rendered using tilemaps, with fixed widths for consistency.
Recent Updates
- Road Tiles:
- With the development of road tiles, I optimized the tiles for towns and farms to better align with the transportation system.
- Region-Specific Adjustments:
- Furniture and resources in different types of regions were adjusted to better match player exploration expectations.
This transportation system not only enhances the connectivity of the game world but also adds depth to exploration and navigation. Stay tuned for more updates as I continue to refine the map and its features!
开发日志:地图交通系统
在过去两个月里,除了日常的 bug 修复和代码重构,最重要的更新是为地图增加了 交通系统,将所有城镇和聚居区连接了起来。以下是该系统的设计思路和实现细节:
功能图例
- 黑色:代表陆地交通路线。
- 白色:代表海洋航线。
交通系统设计
该系统的核心思路是使用地图的 region 区块 作为寻路算法的节点。具体实现如下:
- 城市间路径生成:
- 我使用 region 区块作为节点,生成了每对城市之间的最短路径。
- Kruskal 算法:
- 我应用了 Kruskal 算法来连接城市之间的最短无环路径。
- 后期额外补充了一些较近的城市节点以优化结果。
- 辅路生成:
- 在每个 region 内,使用第二层 dual-mesh(property 块)通过类似的寻路算法标记辅路节点。
- 瓦片地图集成:
- 使用瓦片地图拼接出固定宽度的主路和辅路。
最近更新
- 道路瓦片:
- 随着道路瓦片的开发,我对城镇和农场的瓦片进行了优化,以更好地与交通系统匹配。
- 区域特定调整:
- 对不同类型 region 中的家具和资源进行了调整,以更符合玩家的探索预期。
这套交通系统不仅增强了游戏世界的连通性,还为探索和导航增添了深度。敬请期待更多更新,我将继续优化地图及其功能!