Game::TextMapper::Apocalypse - generate postapocalyptic landscape
use Modern::Perl; use Game::TextMapper::Apocalypse; my $map = Game::TextMapper::Apocalypse->new->generate_map(); print $map;
This fills the map with random seed regions which then grow to fill the map.
Settlements are placed at random.
Every mountain region is the source of a river. Rivers flow through regions that are not themselves mountains or a deserts. Rivers end in swamps.
The height of the map, defaults to 10.
use Modern::Perl; use Game::TextMapper::Apocalypse; my $map = Game::TextMapper::Apocalypse->new(rows => 20) ->generate_map; print $map;
The width of the map, defaults to 20.
use Modern::Perl; use Game::TextMapper::Apocalypse; my $map = Game::TextMapper::Apocalypse->new(cols => 30) ->generate_map; print $map;
The size of regions sharing the same terrain type, on average, defaults to 5 hexes. The algorithm computes the number hexes, divides it by the region size, and that's the number of seeds it starts with (rows × cols ÷ region_size).
rows
cols
region_size
use Modern::Perl; use Game::TextMapper::Apocalypse; my $map = Game::TextMapper::Apocalypse->new(region_size => 3) ->generate_map; print $map;
The chance of a hex containing a settlement, from 0 to 1, defaults to 0.1 (10%).
use Modern::Perl; use Game::TextMapper::Apocalypse; my $map = Game::TextMapper::Apocalypse->new(settlement_chance => 0.2) ->generate_map; print $map;
By default, the log level is set by Game::TextMapper from the config file. If you use the generator on its own, however, the log defaults to log level "debug". You might want to change that. The options are "error", "warn", "info" and "debug".
use Modern::Perl; use Game::TextMapper::Apocalypse; my $map = Game::TextMapper::Apocalypse->new(loglevel => 'error') ->generate_map; print $map;
This method takes no arguments. Set the properties of the map using the attributes.
To install Game::TextMapper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Game::TextMapper
CPAN shell
perl -MCPAN -e shell install Game::TextMapper
For more information on module installation, please visit the detailed CPAN module installation guide.