Adding a map creation plugin #57

Merged
CoCo_Sol merged 39 commits from map-generation into main 2024-02-21 20:10:03 +00:00
Showing only changes of commit 0caf97d9b8 - Show all commits

View file

@ -40,7 +40,7 @@ pub struct EndMapGeneration;
/// Generate each tiles of the map if the [StartMapGeneration] is received.
///
/// The map is generated using the [Perlin] noise function and the [HexSpiral].
/// The map is generated using a [Perlin] noise and a [HexSpiral].
CoCo_Sol marked this conversation as resolved Outdated

Perlin isn't a function

Perlin isn't a function
///
CoCo_Sol marked this conversation as resolved Outdated

Isize will not be great to use for networking because it's length depend on the system that runs the program.
Also you should use type to alias a specific type for the HexPosition used for the map.

Isize will not be great to use for networking because it's length depend on the system that runs the program. Also you should use `type` to alias a specific type for the HexPosition used for the map.

I use only one time the hex position, is it really better to create a new type ?

I use only one time the hex position, is it really better to create a new type ?

You will use it every time you want to make a Query on the HexPosition

You will use it every time you want to make a Query on the HexPosition

ok, you've convinced me

ok, you've convinced me
/// It's generated one tile at a time, until the spiral is finished.
fn generate_map(
@ -74,7 +74,7 @@ fn generate_map(
}
CoCo_Sol marked this conversation as resolved Outdated

This comment is wrong.

This comment is wrong.
CoCo_Sol marked this conversation as resolved Outdated

I still think you should take an HexPosition, this will be simpler and will make this function simpler to use.

I still think you should take an HexPosition, this will be simpler and will make this function simpler to use.
/// Returns the type of the [HexPosition] with the given noise.
fn get_type_tile(position: HexPosition<i32>, noise: &Perlin) -> Tile {
fn get_tile_type(position: HexPosition<i32>, noise: &Perlin) -> Tile {
CoCo_Sol marked this conversation as resolved Outdated

get_tile_type

get_tile_type
let pixel_position = position.to_pixel_coordinates() / MAP_GENERATION_ZOOM;
CoCo_Sol marked this conversation as resolved Outdated

This is not a Zoom, it is a Scale

This is not a Zoom, it is a Scale
let value = noise.get([pixel_position.x as f64, pixel_position.y as f64]);
match value {