Code Monkey home page Code Monkey logo

worldengine's Introduction

WorldEngine - a world generator

Build Status Build status Coverage Status Code Health codecov.io Coverage Status Coverage Status Requirements Status

The current stable version is 0.19.0

You can generate the data for your own world, including a number of images (heightmap, biomes, etc.).

For example:

worldengine world -s 1 -n seed1

Worlds are generated using plate simulations, erosion, rain shadows, Holdridge life zones model and plenty of other phenomenons.

The created world can be used for simulating the evolution of a civilization (see project civs).

It is also possible to generate additional maps, for example an ancient looking map:

worldengine ancient_map -w seed1.world

We started a Google group: Should you have ideas, problems, suggestions or want to contribute, please join us!

Manual

The Manual for Worldengine : http://worldengine.readthedocs.io/en/latest/

Interoperability (Python, Java)

We would love to see WorldEngine used together with other tools. Worlds generated by WorldEngine can be loaded into python applications using WorldEngine itself as a library. Java applications can instead use WorldEngine-Java, a java library to load WorldEngine files.

Worlds can be saved using the protobuf format or hdf5, for which there are libraries in several languages. We keep working on supporting more formats and always interested in ways to improve interoperability.

Binary packages

For Windows, Linux and Mac are available on the releases page.

Gui

An experimental (and limited!) GUI is available as a separate project: https://github.com/Mindwerks/worldengine-gui.

Install

Using Docker

First, git clone or download the code, then:

bin/run_in_docker.sh

Using pip

# Currently not yet released on pypi, you may want to still use Lands or WorldSynth
# or alternatively download the source
pip install worldengine

From source code

git clone or download the code

# for unit-testing: also clone worldengine-data
git clone [email protected]:Mindwerks/worldengine-data.git ../worldengine-data
nosetest tests

On Windows

If you want to install Worldengine on Windows you can read these instructions.

Executable file is also available under releases, but is currently out of date.

Note: you need also a copy of the worldengine src directory in the same folder as the exe.

Dependencies

The gui is based on QT, so you will need to install them

Output

The program produces a binary format with all the data of the generated world and a set of images. For examples seed 1 produces.

Elevation Map

Precipitation Map

Temperature Map

Biome Map

Ocean Map

There are several optional outputs and many options to control the result. The manual is your friend!

Usage

worldengine [options] [world|plates|ancient_map|info]

For details about all the possible options please refer to the manual.

For example these commands:

worldengine -s 4 -n an_example -q 25 -x 2048 -y 2048

Produce this output

Worldengine - a world generator (v. 0.19.0)
-----------------------
 operation            : world generation
 seed                 : 4
 name                 : an_example
 width                : 2048
 height               : 2048
 number of plates     : 25
 world format         : protobuf
 black and white maps : False
 step                 : full
 greyscale heightmap  : False
 rivers map           : False
 scatter plot         : False
 fade borders         : True

starting (it could take a few minutes) ...

Producing ouput:
* world data saved in './an_example.world'
* ocean image generated in './an_example_ocean.png'
* precipitation image generated in './an_example_precipitation.png'
* temperature image generated in './an_example_temperature.png'
* biome image generated in './an_example_biome.png'
* elevation image generated in './an_example_elevation.png'
...done

This is the corresponding ancient map

worldengine ancient_map -w an_example.world

Algorithm

The world generation algorithm goes through different phases:

  • plates simulation: it is the best way to get proper mountain chains. For this pyplatec is used
  • noise techniques are used at different steps
  • precipitations are calculated considering latitude and rain shadow effects
  • erosion is calculated
  • humidity in each zone is calculated
  • terrain permeability is calculated
  • biome is calculated using the Holdridge life zones model

Development

Using virtualenv you can create a sandbox in which to develop.

Python 2

virtualenv venv
source venv/bin/activate
pip install --upgrade pip setuptools
pip install -r requirements-dev.txt
python worldengine

Python 3

virtualenv venv -p /usr/bin/python3
source venv/bin/activate
pip install --upgrade pip setuptools
pip install -r requirements-dev.txt
python worldengine

Distribution

We use PyInstaller to wrap everything up into one binary.

This will create a binary located dist/worldengine that has all the required libs necessary to run.

Linux

Because of the libraries we use, it is best to use their develop branch.

pip install git+https://github.com/pyinstaller/pyinstaller.git@develop
pyinstaller --clean -F -n worldengine worldengine/__main__.py

OSX

You'll need to have brew installed, this should give you all the tools you'll need.

pyinstaller --clean -F -n worldengine worldengine/__main__.py

At this time, it doesn't gather everything from protobuf. So you'll need to copy google/protobuf python to dist/google/protobuf and create init.py in dist/google

Windows

Turning your Windows into a developer environment is a long and drawn out process. I'll try to keep this as short as possible and to the point.

Remember, be consistent if you are either win32 or win64 and everything you download and install is either one or the other, but not both.

You'll want to install msysgit: https://msysgit.github.io/ which will get you a Linux like environment. After that, clone the repo and install Python 2.7 for windows: https://www.python.org/downloads/windows/ This will get you also pip which is required for the rest. You'll first need to pip install virtualenv.

The layout is a bit different than in Linux.

virtualenv venv
venv/Scripts/pip install -r requirements.txt

Numpy install will fail, so you'll need download a pre-compiled wheel file and install it with pip. http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy numpy‑1.9.2+mkl‑cp27‑none‑win_amd64.whl Pick one for your arch, 32 or 64.

venv/Scripts/pip install ../numpy‑1.9.2+mkl‑cp27‑none‑win_amd64.whl

Next step is to get pywin32 which are win32api hooks for python, when downloading, you'll need to pick either 32 or 64-bit otherwise it won't work. You'll also install it via pip. http://sourceforge.net/projects/pywin32/files/pywin32/

venv/Scripts/pip install ../pywin32-219.win-amd64-py2.7.exe

The last step is to get pyinstaller installed and this can be tricky because as of right now, we have to use a specific revision that "good-enough". The issue is being tracked here: pyinstaller/pyinstaller#1291

venv/Scripts/pip install git+https://github.com/pyinstaller/pyinstaller.git@67610f2
venv/Scripts/pyinstaller --clean --console -F -n worldengine worldengine/__main__.py

Do you have problems or suggestions for improvements?

Please write to us! You can write us at:

  • f dot tomassetti at gmail dot com
  • psi29a at gmail dot com Thank you, all the feedback is precious for us!

Projects using WorldEngine

WorldEngine is being used in several products and we are starting to list them here:

If you are using WorldEngine please let us know!

Contributors

This project is maintained by Bret Curtis and Federico Tomassetti.

All contributions, questions, ideas are more than welcome! Feel free to open an issue or write in our google group.

We would like to thank you great people who helped us while working on WorldEngine and the projects from which it was derived:

  • Evan Sampson contributed the amazing implementation of the Holdridge life zones model and improved a lot the ancient-looking-map, biome, precipitation and temperature generators. Thanks a million!

  • Ryan contributed the Windows binary version and discussed Lands on Reddit bringing a lot of users. Thanks a million!

  • stefan-feltmann made Lands depends on pillow instead that on PIL (which is deprecated). This could also help when moving to Python 3. Thanks a million!

  • Russell Brinkmann helped saving the generation parameters in the generated world (so that we can use it to generate the same world again, for example), improved the command line options and added tracing information (useful for understanding the performance of the various generation steps)

  • Joshua Coppola implemented the satellite view. Thanks a lot, it looks gorgeous!

  • Stephan made WorldEngine make heavy use of numpy, helping to speed up the generation. He also made world-generation much more reproducible and helped improve compatibility with Python 3.

  • Alex made things generally run faster and look cleaner by better employing numpy.

History

WorldEngine has been created by merging Lands and WorldSynth. Last Lands version was 0.5.3, last WorldSynth version: 0.12, first WorldEngine version has been 0.18.

License

WorldEngine is available under the MIT License. You should find the LICENSE in the root of the project.

worldengine's People

Contributors

abhyudaypratap avatar babetoduarte avatar c-w avatar devinrb avatar esampson avatar ftomassetti avatar himura2la avatar mm1nd avatar mrcasals avatar psi29a avatar rardiol avatar rbb avatar richardscottoz avatar sjbrown avatar solarizedred avatar stefan-feltmann avatar tcld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

worldengine's Issues

Error with the Greyscale file generation

As reported by Ryan

Downloaded the latest master and installed on Windows x64 with no issue. However, when trying to generate a Greyscale file with the current master build, it failed to produce the file with this error:

Traceback (most recent call last):
  File "C:\Python27\Scripts\worldengine-script.py", line 9, in <module>
    load_entry_point('worldengine==0.5.4', 'console_scripts', 'worldengine')()
  File "build\bdist.win-amd64\egg\worldengine\cli\main.py", line 304, in main
  File "build\bdist.win-amd64\egg\worldengine\cli\main.py", line 71, in generate_grayscale_heightmap
  File "build\bdist.win-amd64\egg\worldengine\draw.py", line 207, in draw_grayscale_heightmap
AttributeError: 'str' object has no attribute 'set_pixel'`

Any obvious reason why that is failing, or is it an issue/incomplete feature with the current build?

Installed Lands; won't run. "DLL load failed:%1 is not a valid Win32 application."

I've been trying to run Lands for several days now, but I keep running into issues. I'm a newbie with Python (and coding in general), but I think I've installed it just fine. When I try to run it I get the following error:

C:\Users\User\Downloads\Lands\Lands-master>lands world -s 1 -n seed1
Traceback (most recent call last):
    File "C:\Python27\Scripts\lands-script.py", line 9, in <module>
        load_entry_point('lands==0.5.3.1', 'console_scripts', 'lands')()
    File "C:\Python27\lib\site-packages\pkg_resources.py", line 339, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
    File "C:\Python27\lib\site-packages\pkg_resources.py", line 2470, in load_entry_point
        return ep.load()
    File "C:\Python27\lib\site-packages\\pkg_resources.py", line 2184, in load 
        ['__name__'])
    File "C:\Python27\lib\site-packages\lands\generator.py", line 8, in <module>
        import lands.geo
    File "C:\Python27\lib\site-packages\lands\geo.py", line 4, in <module>
        from noise import snoise2
    File "C:\Python27\lib\site-packages\noise\__init__.py", line 12, in <module>
        from . import _perlin, _simplex
ImportError: DLL load failed: %1 is not a valid Win32 application.

I followed the wiki's instructions for installing on Windows, and I made sure I had 64-bit versions of everything (e.g. Python 2.7.9, pip, etc.) Let me know if I'm missing any important info.

Save seed (and generation parameters) in the world file

"There seems to be no easy way to check the seeds that are used to generate the map. A little thing, but very frustrating when I want to recreate a map whose seed I did not write down. Perhaps the parameters used to create the world could be embedded/commented into the images as they are created? Or, perhaps, could this information be extracted from the .world file? "

We should save all generation parameters and also the Lands version number

Update or delete erosion_generation and water_generator

Both sounds good but do something.

Right now the idea is that the command line application can be used to generate the world, deciding at which step to stop, while in the GUI the user can launch each step separately. What about the command line? Do we want to add separate utilities to run the steps individually?
So that the user can initially performs some steps (says A, B, C) and then if he wants he can load the generated world, run D and save it.

Export to Photoshop format (PSD)

On Reddit it has been suggested to support PSD files.

"I feel that a really vital tool could be creating an easy export to photoshop, complete with layer integrity -- ie, a terrain layer, an elevation layer, a water layer, and a line map layer (most important!)"

Continents size

Should depend on global world size and maybe it should be more "agglutinated"

Output a grayscale heightmap

"First, The elevation color scheme is not useful for converting to grey scale (For graphics programs like GIMP and Heightmap editors like Wilbur) The main issue is with the orange-brown color used for the mountains/highlands, which becomes darker (and thus lower in elevation) than the surrounding land when it is desaturated. This issue is also present, in reverse, when the light blue used for the shallow water near coastlines becomes a bright grey-white, thus forming mountainous outlines around the coastline. Is it possible that the palette could be adjusted, or the option to output greyscale elevation maps added?"

We could also want to support different formats (png and bmp I would say)

Improve/extract erosion

It could be a standalone library, maybe written in C.
Or maybe I could use some existing library, if it exists.

Precipitation error on the GUI

Traceback (most recent call last):
  File "C:\Python27\Scripts\worldenginegui-script.py", line 9, in <module>
    load_entry_point('worldengine==0.5.4', 'console_scripts', 'worldenginegui')()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 519, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2630, in load_entry_point
    return ep.load()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2310, in load
    return self.resolve()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2316, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "build\bdist.win-amd64\egg\worldengine\gui\main.py", line 27, in <module>
ImportError: No module named views.PrecipitationsView

As reported by Ryan

Speed Improvements?

I've been using lands to create some desktop backgrounds, and it is rather slow.

Seems like there is some low hanging fruit for optimizations.

There are a lot of constructs in the code like:

for y in xrange(factor*world.height):
        for x in xrange(factor*world.width):

according to pythoncentral, xrange is computationally expensive, but more memory efficient.

I can think of two easy speed improvements:

  • group tasks in the same for loop constructs into fewer loops (draw_oldmap_on_pixels() is ripe for this approach).
  • possibly replace the inner for x in xrange(factor*world.width) with a range call

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.