All Projects → peterhellberg → karta

peterhellberg / karta

Licence: other
Experiments with map generation using Voronoi diagrams

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to karta

GPU-Voronoi-Noise
GPU Voronoi noise in Unity
Stars: ✭ 44 (-49.43%)
Mutual labels:  voronoi-diagram
WeightedTreemaps
Create Voronoi and Sunburst Treemaps from Hierarchical data
Stars: ✭ 33 (-62.07%)
Mutual labels:  voronoi-diagram
VoronoiIsland
🏝: Voronoi Island
Stars: ✭ 15 (-82.76%)
Mutual labels:  voronoi-diagram
wordle-kt
Wordle game clone made with Kotlin & Compose
Stars: ✭ 33 (-62.07%)
Mutual labels:  toy-project
delaunay-triangulation-algorithm
Delaunay Triangulation
Stars: ✭ 25 (-71.26%)
Mutual labels:  voronoi-diagram
keras-semantic-segmentation-example
Example of semantic segmentation in Keras
Stars: ✭ 53 (-39.08%)
Mutual labels:  toy-project
tektosyne
The Tektosyne Library for Java provides algorithms for computational geometry and graph-based pathfinding, along with supporting mathematical utilities and specialized collections.
Stars: ✭ 52 (-40.23%)
Mutual labels:  voronoi-diagram
gifcc
Tiny c compiler
Stars: ✭ 51 (-41.38%)
Mutual labels:  toy-project
pyDelaunay2D
A simple Delaunay 2D triangulation in python (with numpy)
Stars: ✭ 145 (+66.67%)
Mutual labels:  voronoi-diagram
foolang
A toy programming language.
Stars: ✭ 33 (-62.07%)
Mutual labels:  toy-project
pycobra
python library implementing ensemble methods for regression, classification and visualisation tools including Voronoi tesselations.
Stars: ✭ 111 (+27.59%)
Mutual labels:  voronoi-diagram
FortuneAlgorithm
A C++ implementation of the Fortune's algorithm for Voronoi diagram construction
Stars: ✭ 44 (-49.43%)
Mutual labels:  voronoi-diagram
ruspea
A Lisp to be used as a Ruby Library (written in Ruby)
Stars: ✭ 20 (-77.01%)
Mutual labels:  toy-project
js-study-lv1
단국대학교 자바스크립트 스터디 레벨 1 과정을 위한 저장소
Stars: ✭ 18 (-79.31%)
Mutual labels:  toy-project
SplashGeom
Open-source C++ library for geometry and linear algebra
Stars: ✭ 22 (-74.71%)
Mutual labels:  voronoi-diagram
Cgal
The public CGAL repository, see the README below
Stars: ✭ 2,825 (+3147.13%)
Mutual labels:  voronoi-diagram
gitchain
Blockchain concept implemented with git
Stars: ✭ 22 (-74.71%)
Mutual labels:  toy-project

Karta

Just playing around with Voronoi diagrams.

GoDoc

Karta progress 012

The goal is to create something similar to what is described in the article Polygonal Map Generation for Games

Installation

go get github.com/peterhellberg/karta/cmd/karta

Development

I spend most of my time in iTerm 2 and this project is no different.

This is how I preview the map in a split pane:

rerun -p "**/*.go" -c -x -b -- \
"go run cmd/karta/main.go -width 55 -height 55 && aimg -w 55 karta.png"

Karta development

Usage

The project includes two binaries karta and karta-server, the latter serving both PNG and JPEG.

Command line arguments

Usage of karta:
  -count=2048: The number of sites in the voronoi diagram
  -height=512: The height of the map in pixels
  -iterations=1: The number of iterations of Lloyd's algorithm to run (max 16)
  -output="karta.png": Output filename
  -seed=3: The starting seed for the map generator
  -show=false: Show generated map using Preview.app
  -width=512: The width of the map in pixels

Query string parameters

  • s - size
  • w - width
  • h - height
  • c - count
  • i - iterations

Progress

First i just plotted out random dots:

Karta progress 001

Then drew a voroni diagram:

Karta progress 002

Found the centroids:

Karta progress 003

Ran the diagram through Lloyd's algorithm:

Karta progress 004

A few iterations later:

Karta progress 005

Animating 0-16 iterations:

Lloyd Relaxation 0-16 iterations

Started coloring the map according to the distance from the center:

Karta progress 006

Added some randomness:

Karta progress 007

Added a different types of elevation:

Karta progress 008

Removed the centroid markers:

Karta progress 009

Started working on using Simplex noise for island shape and elevation:

Karta progress 010

Elevation based on noise + distance from center of map:

Karta progress 011

Tweaked noise and yellow beaches:

Karta progress 012

License

The MIT License (MIT)

Copyright (C) 2014 Peter Hellberg

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].