{"id":20279177,"url":"https://github.com/peterhellberg/karta","last_synced_at":"2025-04-11T06:18:49.898Z","repository":{"id":19159939,"uuid":"22391510","full_name":"peterhellberg/karta","owner":"peterhellberg","description":"Experiments with map generation using Voronoi diagrams","archived":false,"fork":false,"pushed_at":"2022-11-29T16:43:01.000Z","size":129,"stargazers_count":105,"open_issues_count":0,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-25T04:13:01.322Z","etag":null,"topics":["go","toy-project","voronoi-diagram"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterhellberg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-29T18:52:57.000Z","updated_at":"2024-11-15T02:23:28.000Z","dependencies_parsed_at":"2023-01-11T20:22:17.724Z","dependency_job_id":null,"html_url":"https://github.com/peterhellberg/karta","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fkarta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fkarta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fkarta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fkarta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterhellberg","download_url":"https://codeload.github.com/peterhellberg/karta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351607,"owners_count":21089313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","toy-project","voronoi-diagram"],"created_at":"2024-11-14T13:28:43.114Z","updated_at":"2025-04-11T06:18:49.859Z","avatar_url":"https://github.com/peterhellberg.png","language":"Go","readme":"# Karta\n\nJust playing around with [Voronoi diagrams](http://en.wikipedia.org/wiki/Voronoi_diagram).\n\n[![GoDoc](https://godoc.org/github.com/peterhellberg/karta?status.svg)](https://godoc.org/github.com/peterhellberg/karta)\n\n![Karta progress 012](https://assets.c7.se/skitch/karta_progress_012-20140823-155942.png)\n\nThe goal is to create something similar to what is described in the article\n[Polygonal Map Generation for Games](http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/)\n\n## Installation\n\n```bash\n# Basic command line tool\ngo install github.com/peterhellberg/karta/cmd/karta@latest\n\n# A web server generating maps based on query parameters\ngo install github.com/peterhellberg/karta/cmd/karta-server@latest\n```\n\n## Development\n\nI spend most of my time in [iTerm 2](http://iterm2.com/) and this project is no different.\n\nThis is how I preview the map in a split pane:\n\n```bash\nrerun -p \"**/*.go\" -c -x -b -- \\\n\"go run cmd/karta/main.go -width 55 -height 55 \u0026\u0026 aimg -w 55 karta.png\"\n```\n\n![Karta development](https://assets.c7.se/skitch/karta_development_iterm_vim_aimg-20140812-204452.png)\n\n## Usage\n\nThe project includes two binaries `karta` and `karta-server`, the latter serving both PNG and JPEG.\n\n### Command line arguments\n\n```\nUsage of karta:\n  -count=2048: The number of sites in the voronoi diagram\n  -height=512: The height of the map in pixels\n  -iterations=1: The number of iterations of Lloyd's algorithm to run (max 16)\n  -output=\"karta.png\": Output filename\n  -seed=3: The starting seed for the map generator\n  -show=false: Show generated map using Preview.app\n  -width=512: The width of the map in pixels\n```\n\n### Query string parameters\n\n  - **s** - size\n  - **w** - width\n  - **h** - height\n  - **c** - count\n  - **i** - iterations\n\n## Progress\n\nFirst i just plotted out random dots:\n\n![Karta progress 001](https://assets.c7.se/skitch/karta_progress_001-20140812-223244.png)\n\nThen drew a voroni diagram:\n\n![Karta progress 002](https://assets.c7.se/skitch/karta_progress_002-20140812-223300.png)\n\nFound the centroids:\n\n![Karta progress 003](https://assets.c7.se/skitch/karta_progress_003-20140812-223327.png)\n\nRan the diagram through [Lloyd's algorithm](http://en.wikipedia.org/wiki/Lloyd%27s_algorithm):\n\n![Karta progress 004](https://assets.c7.se/skitch/karta_progress_004-20140812-223344.png)\n\nA few iterations later:\n\n![Karta progress 005](https://assets.c7.se/skitch/karta_progress_005-20140812-223400.png)\n\nAnimating 0-16 iterations:\n\n![Lloyd Relaxation 0-16 iterations](https://assets.c7.se/viz/lloyd-relaxation.gif)\n\nStarted coloring the map according to the distance from the center:\n\n![Karta progress 006](https://assets.c7.se/skitch/karta_progress_006-20140812-223423.png)\n\nAdded some randomness:\n\n![Karta progress 007](https://assets.c7.se/skitch/karta_progress_007-20140812-223203.png)\n\nAdded a different types of elevation:\n\n![Karta progress 008](https://assets.c7.se/skitch/karta_progress_008-20140813-005713.png)\n\nRemoved the centroid markers:\n\n![Karta progress 009](https://assets.c7.se/skitch/karta_progress_009-20140813-005845.png)\n\nStarted working on using [Simplex noise](http://en.wikipedia.org/wiki/Simplex_noise) for\nisland shape and elevation:\n\n![Karta progress 010](https://assets.c7.se/skitch/karta_progress_010-20140813-010005.png)\n\nElevation based on noise + distance from center of map:\n\n![Karta progress 011](https://assets.c7.se/skitch/karta_progress_011-20140816-013747.png)\n\nTweaked noise and yellow beaches:\n\n![Karta progress 012](https://assets.c7.se/skitch/karta_progress_012-20140823-155942.png)\n\n## License\n\n**The MIT License (MIT)**\n\nCopyright (C) 2014 [Peter Hellberg](https://c7.se/)\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the \"Software\"),\n\u003e to deal in the Software without restriction, including without limitation\n\u003e the rights to use, copy, modify, merge, publish, distribute, sublicense,\n\u003e and/or sell copies of the Software, and to permit persons to whom the\n\u003e Software is furnished to do so, subject to the following conditions:\n\u003e\n\u003e The above copyright notice and this permission notice shall be included\n\u003e in all copies or substantial portions of the Software.\n\u003e\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n\u003e OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\u003e IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\u003e DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\u003e TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\n\u003e OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhellberg%2Fkarta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterhellberg%2Fkarta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhellberg%2Fkarta/lists"}