Other

项目介绍

amitp/mapgen2 是一个托管在 GitHub 上的开源项目,主要使用 ActionScript 编写,采用 Other 许可证,目前获得 1.4k 个 Star、205 次 Fork。

仓库全名
amitp/mapgen2
开源许可证
Other
Star 数
1.4k
Fork 数
205
未关闭 Issue
2

README 摘要

After working on a Perlin-noise-based map generator I had wanted something with islands and rivers and volcanoes and lava. However, I had a lot of trouble getting that map generator to generate any more than what it did at first. This project was my exploration of several different techniques for map generation. The goal is to make continent/island style maps (surrounded by water) that can be used by a variety of…

完整内容见 GitHub 原始 README 或本页 。

常见问题

mapgen2 用什么语言开发?

主要使用 ActionScript 编写,采用 Other 许可证,目前有 1.4k 个 Star。

mapgen2 可以免费商用吗?

仓库标注的许可证为 Other,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 mapgen2 的源码?

可以直接克隆仓库:git clone https://github.com/amitp/mapgen2.git,默认分支为 master;安装与运行步骤见仓库 README。

mapgen2 最近还在维护吗?

仓库最近一次更新为 2025年5月8日,当前有 2 个未关闭 Issue;Star 数为 1.4k,可作为社区活跃度的参考。

简要分析

热度分
1898
价值分
900
活跃状态
活跃

语言占比

ActionScript

README

No Maintenance Intended

After working on a Perlin-noise-based map generator I had wanted something with islands and rivers and volcanoes and lava. However, I had a lot of trouble getting that map generator to generate any more than what it did at first. This project was my exploration of several different techniques for map generation.

The goal is to make continent/island style maps (surrounded by water) that can be used by a variety of games. I had originally intended to write a reusable C++ library but ended up writing the code in Actionscript.

The most important features I want are nice island/continent coastlines, mountains, and rivers. Non goals include impassable areas (except for the ocean), maze-like structures, or realistic height maps. The high level approach is to

  1. Make a coastline.
  2. Set elevation to distance from coastline. Mountains are farthest from the coast.
  3. Create rivers in valleys, flowing down to the coast.

The implementation generates a vector map with roughly 1,000 polygons, instead of a tile/grid map with roughly 1,000,000 tiles. In games the polygons can be used for distinct areas with their own story and personality, places for towns and resources, quest locations, conquerable territory, etc. Polygon boundaries are used for rivers. Polygon-to-polygon routes are used for roads. Forests, oceans, rivers, swamps, etc. can be named. Polygons are rendered into a bitmap to produce the tile map, but the underlying polygon structure is still available.

The full process is described here.

History

  • I started out with C++ code that used mountains, soil erosion, water flow, water erosion, water evaporation, volanoes, lava flow, and other physical processes to sculpt terrain expressed in a 2d array of tiles. However as described in this blog post I decided to abandon this approach.

  • Since my initial approach failed, I wrote several small prototypes to figure out how to make rivers, coastlines, and mountains. These are the key features I want to support. I will then figure out how to combine them into a map.

  • The voronoi_set.as prototype worked well and I continued adding to it (instead of converting to C++). It supports terrain types: ocean, land, beach, lake, forest, swamp, desert, ice, rocky, grassland, savannah. It has rivers and roads. I decided not to convert it to C++ for now. Instead, I’ve refactored it into the core map generation (Map.as), display and GUI (mapgen2.as), graph representation (graph/*.as), decorative elements (Roads.as, Lava.as), and noisy edge generation (NoisyEdges.as).

Requirements

These third-party requirements have been added to the third-party directory:

Make sure you run git submodule update --init to check out the third-party libraries.

Compiling

To compile mapgen2.as to mapgen2.swf, use the following command:

mxmlc -source-path+=third-party/PM_PRNG -source-path+=third-party/as3delaunay/src -source-path+=third-party/as3corelib/src mapgen2.as -static-link-runtime-shared-libraries

评论

暂无评论