generated from tipragot/rust
Adding a map creation plugin #57
|
@ -40,7 +40,7 @@ pub struct EndMapGeneration;
|
||||||
|
|
||||||
/// Generate each tiles of the map if the [StartMapGeneration] is received.
|
/// 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
|
|||||||
///
|
///
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
Isize will not be great to use for networking because it's length depend on the system that runs the program. 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.
CoCo_Sol
commented
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 ?
tipragot
commented
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
CoCo_Sol
commented
ok, you've convinced me ok, you've convinced me
|
|||||||
/// It's generated one tile at a time, until the spiral is finished.
|
/// It's generated one tile at a time, until the spiral is finished.
|
||||||
fn generate_map(
|
fn generate_map(
|
||||||
|
@ -74,7 +74,7 @@ fn generate_map(
|
||||||
}
|
}
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
This comment is wrong. This comment is wrong.
|
|||||||
|
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
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.
|
/// 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
tipragot
commented
get_tile_type get_tile_type
|
|||||||
let pixel_position = position.to_pixel_coordinates() / MAP_GENERATION_ZOOM;
|
let pixel_position = position.to_pixel_coordinates() / MAP_GENERATION_ZOOM;
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
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]);
|
let value = noise.get([pixel_position.x as f64, pixel_position.y as f64]);
|
||||||
match value {
|
match value {
|
||||||
|
|
Loading…
Reference in a new issue
Perlin isn't a function