Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewstyler committed Jul 6, 2023
1 parent 450c6d1 commit 43aae8b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 11 deletions.
50 changes: 43 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,53 @@
# Ruby Perlin 2D Map Generator
A gem that procedurally generates seeded and customizable 2D map using perlin noise. Map can be rendered in console using ansi colors or returned as 2D array of hashes describing each tile and binome. Completely customizable, use the --help option for full usage details.
A gem that procedurally generates seeded and customizable 2D map using perlin noise.

Include the gem in your project, or use the executable from the command line.

# Command line Usage
Map can be rendered in console using ansi colors or returned as 2D array of hashes describing each tile and binome. Completely customizable, use the --help option for full usage details.


![2D-maps](https://github.com/matthewstyler/ruby-perlin-2D-map-generator/assets/4560901/89b4f623-53e3-445e-8e5b-96f4fcf67af5)

# Customization examples

See Command line Usage for full customization, below are some examples. Alter the temperature, moisture or elevation seeds to alter these maps:

- Plains with random terrain evens: `ruby-perlin-2D-map-generator render`
- Desert (increase temperature, decrease moisture): `ruby-perlin-2D-map-generator render --temp=100 --moisture=-100`
- Mountainous with lakes (increase elevation, increase moisture) `ruby-perlin-2D-map-generator render --elevation=25 --moisture=25`
- Islands (decreaes elevation, increase moisture): `ruby-perlin-2D-map-generator render --elevation=-40 --moisture=25`
- Taiga map (decrease temperature, increase moisture): `ruby-perlin-2D-map-generator render --temp=-60 --moisture=30 `

## Common customization
```bash
--width=int The width of the generated map (default 128)
--height=int The height of the generated map (default 128)

--hs=int The seed for a terrains height perlin generation
(default 10)
--ms=int The seed for a terrains moist perlin generation
(default 300)
--ts=int The seed for a terrains temperature perlin generation
(default 3000)

--elevation=float Adjust each generated elevation by this percent (0 -
100) (default 0.0)
--moisture=float Adjust each generated moisture by this percent (0 -
100) (default 0.0)
--temp=float Adjust each generated temperature by this percent (0
- 100) (default 0.0)
```

# Full Command line Usage
```bash
$ ./bin/ruby-perlin-2D-map-generator --help
$ ruby-perlin-2D-map-generator --help
```
```bash
Usage: ruby-perlin-2D-map-generator [OPTIONS] (DESCRIBE | RENDER)

Generate a replayable seeded procedurally generated 2 dimensional map. Rendered
in the console using ASCII colours, or described as a hash containting each
tiles information.
Generate a seeded customizable procedurally generated 2D map.
Rendered in the console using ansi colours, or described as a 2D array of
hashes with each tiles information.

Arguments:
(DESCRIBE | RENDER) command to run: render prints the map to standard
Expand Down Expand Up @@ -59,5 +95,5 @@ Examples:
$ ruby-perlin-2D-map-generator render

Render with options
$ ruby-perlin-2D-map-generator render --i=false --t=10 --ms=10
$ ruby-perlin-2D-map-generator render --elevation=-40 --moisture=25 --hs=1
```
6 changes: 3 additions & 3 deletions lib/CLI/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class Command

no_command

desc 'Generate a replayable seeded procedurally generated 2 dimensional map. Rendered in the console ' \
' using ASCII colours, or described as a hash containting each tiles information.'
desc 'Generate a seeded customizable procedurally generated 2D map. Rendered in the console ' \
' using ansi colours, or described as a 2D array of hashes with each tiles information.'

example 'Render with defaults',
' $ ruby-perlin-2D-map-generator render'

example 'Render with options',
' $ ruby-perlin-2D-map-generator render --i=false --t=10 --ms=10'
' $ ruby-perlin-2D-map-generator render --elevation=-40 --moisture=25 --hs=1'
end

argument :command do
Expand Down
2 changes: 1 addition & 1 deletion lib/biome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def self.from(elevation, moist, temp)
DEEP_DESERT = Biome.new(name: 'deep_desert', flora_range: 1, colour: AnsiColours::Background::DESERT_LIGHT_YELLOW)
STEPPE_DESERT = Biome.new(name: 'steppe_desert', flora_range: 1, colour: AnsiColours::Background::DESERT_DARK_YELLOW)
SWAMP = Biome.new(name: 'swamp', flora_range: nil, colour: AnsiColours::Background::GREEN_SWAMP)
COASTLINE = Biome.new(name: 'coastline', flora_range: 5, colour: AnsiColours::Background::SANDY)
COASTLINE = Biome.new(name: 'coastline', flora_range: nil, colour: AnsiColours::Background::SANDY)
SHOAL = Biome.new(name: 'shoal', flora_range: nil, colour: AnsiColours::Background::SHOAL_BLUE)
OCEAN = Biome.new(name: 'ocean', flora_range: nil, colour: AnsiColours::Background::LIGHT_BLUE)
DEEP_OCEAN = Biome.new(name: 'deep_ocean', flora_range: nil, colour: AnsiColours::Background::BLUE)
Expand Down

0 comments on commit 43aae8b

Please sign in to comment.