Skip to content

Repository files navigation

Odin - The Celestial Planet Generator

Odin aims to render randomly generated planets, moons and star fields as PNG images.

Example

Here is an picture entirely generated by Odin:

Render a planet

$planet = newOdin\Planet();
$image = $planet
->diameter(300) // a 300px wide planet
->lava() // a planet with the lava biome
->render();
// $image is a \SplFileObject, you're free to do what you want with it

A planet can have the following biomes: toxic, forest, ashes, violet, lava, atoll, coldGaz, hotGaz, hydroGaz.

Render a moon

$moon = newOdin\Moon();
$image = $moon
->diameter(150) // a 150px wide moon
->render();
// $image is a \SplFileObject, you're free to do what you want with it

Render multiple times an object

It's possible to render the same planet several times (it works also for moons and star fields). You'll get the same image results.

$planet = newOdin\Planet();
$planet->diameter(300)->lava();
$firstImage = $planet->render();
// do some other stuff...$secondImage = $planet->render();
// $firstImage and $secondImage are two different files, but their content are identical

Configure how objects are rendered

Objects rendering can be configured.

$configuration = newOdin\Configuration();
$planet = newPlanet($configuration);

Render objects in a specific directory

It's possible to define where the images will be rendered. By default, they will be generated in /tmp.

$configuration = newOdin\Configuration('my/custom/path/for/images');

Render the same object later

It's possible to render the same object in different PHP processes or requests. To achieve that, you just need to pass the seed to your the configuration.

$seed = 42;
$moon = newOdin\Configuration(null, $seed);

Launch the tests

./vendor/bin/phpspec run

About

⭐ 🌏 Odin - The Celestial Planet Generator

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages