Giter VIP home page Giter VIP logo

glimpse's Introduction

Glimpse

Procedural world generation

I've wanted to generate my own virtual worlds for a long time but haven't had much background on how to pursue it; this project demonstrates my latest progress. You can read more on the goals of this project here, and I'm writing up lessons learned for others in the wiki.

There are tons of great resources online for world generation, and many of the good ideas I've implemented have come from more experienced minds. You can see acknowledgements (and good links to learn from!) below.

Drawing Drawing
Drawing Drawing

Overview of PCG

Procedural content generation describes a process that generates data programmatically instead of manually; its commonly applied in video games and other forms of entertainment. I love it because it forces you to understand and represent systems -- to form lakes in a virtual world, you need to understand how lakes form in real life (at least well enough to fake it).

Project overview

This project generates virtual worlds from nothing and produces outputs in PNG and SVG format. Generated worlds may include forests, terrain, cities from one or more cultures (with generated names), rivers, named mountains and lakes, and other interesting features. Most world generation logic is stored in plug-ins to make it easier to reason about and learn from.

If you're trying to learn PCG from this project, start with the wiki or the acknowledgement links below.

Acknowledgements

Thanks to all who have taken the time to share their expertise. The following resources have been helpful as I've found my way:

glimpse's People

Contributors

anyweez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

glimpse's Issues

Visual mismatch between filled coast and border once interpolated

Similar to problem described here: https://azgaar.wordpress.com/2017/04/03/coastline/

Interpolation on coastlines looks pretty good and I want to keep it, but the fill is still being performed on pre-interpolation polygons which leads to some visual artifacts.

The post above describes one way to fix this with svg masks, but my first attempt will be to try to render landforms as single complex polygons. I expect the challenge will be rendering lakes but I think this will be a simpler solution overall if I can make it work.

Single cell forests can appear in oceans

The forest plugin seems to be adding forests to oceans, sometimes multiple times. Likely cause is we're not filtering out water cells as starting positions for forest generation.

Add basic climate (temperature, moisture levels)

Support more realistic terrain generation for larger worlds, as well as for identifying realistic locations for forests (#13) and potentially future formations like deserts.

Initial implementation will likely use latitude (assumes the world has a consistent equator) and elevation to determine a temperature distribution for a cell.

Create standalone language server

The language server is responsible for providing names for entities in any gen.py instances. Since each language has to have a training period, the idea is that this will allow the language server to be long-running and avoid training periods.

Add roads between towns

Once we've got towns (#15), we should add roads between them.

At this point, I'm thinking properties of towns will be derived based on the desirability / survivability of a place and that roads will inherit that, vs roads having any direct impact on the towns themselves. I think it should still "look right" in the simulation (bigger cities will have more roads, but not because the roads cause the growth of the city).

Improve city name quality

I'm seeing some lower quality (unpronounceable in english) names come through, as well as some that clearly lack context of where the city is ("Gully Harbor" isn't anywhere near water).

Add elevation impacts for plate tectonics

Since the latest refactor, tectonic plates no longer affect cell elevation. Simplex noise is the primary contributor to elevation, which lacks the "continental" look of the previous plate-based approach.

For reference, here are the Earth's tectonic plates:
https://en.wikipedia.org/wiki/Plate_tectonics#/media/File:Plates_tect2_en.svg

There are two specific properties of plate tectonics that I want to try out:

  1. Individual plates may be higher in elevation than others. All cells of certain plates should start with a base elevation.
  2. Each plate boundary may have certain elevation-impacting features, depending on the boundary type (divergent, convergent, transform).

Create public-facing website

The old site linked from github (https://homeworld.surge.sh) is no longer relevant, and I'd like for there to be a project page of some sort.

Goals:

  • Describe what Glimpse does
  • Provide a gallery of examples, including from older versions
  • Capture lightweight release notes for major/minor versions

Web workers + immutable

60fps rendering is already causing a lot of extra work without any sort of population spawning (#2). If things get any more complicated we'll need to parallelize; it's honestly probably a good idea anyway once we start migrating to have a more complex UI.

Testing and continuous integration

World, Cell, and Population should all be pretty testable. There are also a lot of crazy ass dynamics that I'd like to have a constant eye on.

Integrate population spawning.

Basic components exist as of b8e4776 but I need to do some testing in the core application. Right now they're independent.

Current plan for population spawning is pretty rudimentary but I think it'll be fine over time w/ law of large numbers.

  1. Periodically spawn a random population and a random location. Do this pretty regularly (every 1 - 10 seconds).
  2. Periodically evolve populations with they migrate. Need to change names of the population when this occurs.
  3. Likely need to look into web workers to handle some of this work (#3).

Lakes are rendered as deep water no matter their depth

Need to figure out how to render the depth of lakes -- oceans use WaterlineHeight, but this doesn't work for lakes which form at elevations above sea level.

I think each lake may need its own calculated waterline height, and depth can be determined relative to that.

Measure desirability of worlds

We need a quantitive way to assess the quality of glimpse worlds to verify whether a set of changes are net positive or negative. This may change over time.

Initial proposal

Train a system that can provide a quality score for a given map. This score is likely to be more about aesthetics than anything else, so it may resemble an image classification problem (example to follow). The general implementation of testing the quality of a particular branch would be:

  1. One-time: manually label output maps based on their quality (high/low or a continuous score 0-1, most likely). Build up a training set of these examples -- they made need to be updated when major new features are added.
  2. One-time: train a model to score/classify new worldmaps.
  3. To test a set of changes, generate many (1000?) worldmaps and use the model from 2 to evaluate them. Its important to observe both the % of high quality items as well as average quality, with the former likely being more important since we can filter out low-quality maps using the same score.

Improve iconography

Need to do a quality pass on forest, mountain, and hill iconography. Supersedes #37.

Distributions are decent and may not need adjustments but the icons themselves aren't good enough yet.

  1. Ideally there's some minor variance between instances (each tree doesn't look exactly the same).
  2. Better designs overall. In the case of mountains there's nothing at the moment.

Convert to Typescript

This code is very functional w/ pretty explicit types and I'd benefit from some type checking.

Parameterize certain world generation variables

New worlds use a variety of important variables which are not currently exposed to users. These should be configurable.

Examples:

  • Aquifer depth
  • World size
  • Altitude variance

There will likely be others in the future. Note: at this point there's no user-exposed "seed" that will allow you to generate the same map deterministically, and its unclear that we'll ever include this.

Additional river rendering improvements

Following up on #32 there are still some improvements I can make to improve rendering quality of rivers.

  1. Each river segment (cell edge) is still a straight line. Add in some meandering to make it look more natural.
  2. Each segment's width is determined independently, and there can be sharp increases in width between segments.
  3. Due to interpolation with coastline rendering, rivers don't always visually terminate on coastlines (though the data structure suggests they will).

Useful notes:
https://azgaar.wordpress.com/2017/05/27/confluences/
https://azgaar.wordpress.com/2017/05/08/river-systems/

Add map labels

Any named entity should have it's name rendered. Optional but nice touch would be to approximate city size so bigger cities can have bigger text.

Missing dependency between forest gen and lake gen

Currently these two can run in either order, but this means that its possible to have a forest-filled lake. This is happening because the lake plugin is modifying the celltype cellprops, which it really shouldn't be doing.

Need to figure out how to resolve this, though I think the best solution will be to merge lake gen into the terrain plugin where cp_celltype is being set already.

Remove translucency from trees and hills

Forests and/or hilly areas can look like a mess when icons start overlapping, and I think some small visual tweaks like removing partial transparency will help

Add towns

Identify areas that are desirable for humans (or potentially another species). A subset of these locations should have towns, and towns should have names.

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.