Git Product home page Git Product logo

mapgen4's Introduction

Mapgen4

http://unmaintained.tech/badge.svg

Mapgen4 is a procedural wilderness map generator I wrote during 2017 and 2018. It’s written in JavaScript and designed to:

  • run fast enough to regenerate in real time as you paint terrain
  • look pretty instead of generating realistic terrain

https://www.redblobgames.com/maps/mapgen4/blog/screenshot15-small.jpg

Install

If you like yarn:

yarn global add browserify
yarn install
make build/points-5.data
yarn build

If you like npm:

npm -g install browserify
npm install
make build/points-5.data
npm run build

Run python2 -m SimpleHTTPServer 8000 or python3 -m http.server 8000, then visit http://localhost:8000/embed.html in your browser.

Background

I have a series of blog posts about how I made these maps:

It’s a continuation of ideas I developed for mapgen2 back in 2010, but at a much larger scale. The underlying code can support 1 million+ Voronoi cells (change spacing in config.js to 0.7), including a very detailed river network, but the rendering code and other parameters are designed to look prettiest around 25k cells.

There’s plenty more that could be done to make it even faster and prettier. There are plenty of features that could be added, such as drawing your own rivers, sphere output, natural resources, towns, forests, names, roads, and nations, but I’m leaving those for a future project.

License

Mapgen4 and helper libraries I wrote (dual-mesh, prng) are licensed under Apache v2. You can use this code in your own project, including commercial projects.

The map generator uses these libraries:

  • Delaunator from MapBox is licensed under the ISC license.
  • poisson-disk-sampling from Kevin Chapelier is licensed under the MIT license.
  • simple-noise from Jonas Wagner is licensed under the MIT license.
  • flatqueue from Vladimir Agafonkin is licensed under the ISC license.
  • hash-int from Mikola Lysenko is licensed under the MIT license.

The rendering code uses these libraries:

  • regl from Mikola Lysenko is licensed under the MIT license.
  • gl-matrix from Brandon Jones, Colin MacKenzie IV is licensed under the MIT license.

The build step uses:

mapgen4's People

Contributors

redblobgames avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.