https://github.com/grena/odin
:star: :earth_asia: Odin - The Celestial Planet Generator
https://github.com/grena/odin
art generator planet procedural-generation space
Last synced: 9 months ago
JSON representation
:star: :earth_asia: Odin - The Celestial Planet Generator
- Host: GitHub
- URL: https://github.com/grena/odin
- Owner: grena
- License: mit
- Created: 2018-11-19T19:25:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-09T15:11:44.000Z (about 7 years ago)
- Last Synced: 2025-08-30T23:46:37.464Z (9 months ago)
- Topics: art, generator, planet, procedural-generation, space
- Language: PHP
- Size: 500 KB
- Stars: 8
- Watchers: 0
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```php
$planet = new Odin\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
```php
$moon = new Odin\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.
```php
$planet = new Odin\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.
```php
$configuration = new Odin\Configuration();
$planet = new Planet($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`.
```php
$configuration = new Odin\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.
```php
$seed = 42;
$moon = new Odin\Configuration(null, $seed);
```
## Launch the tests
```bash
./vendor/bin/phpspec run
```