diff --git a/front/index.js b/front/index.js index 4b7a1d5..8e7e3c0 100644 --- a/front/index.js +++ b/front/index.js @@ -54,7 +54,7 @@ async function init() { console.log(frame); instance.exports.frame_entry(); - //requestAnimationFrame(render); + requestAnimationFrame(render); } canvas.onclick = render; diff --git a/justfile b/justfile index 94a1a71..e700948 100644 --- a/justfile +++ b/justfile @@ -37,7 +37,7 @@ zip: build run: build python3 -m http.server & - firefox http://0.0.0.0:8080/build/index.html + firefox http://0.0.0.0:8000/build/index.html clean: cargo clean --manifest-path pirates/Cargo.toml diff --git a/notes.md b/notes.md index da59cfe..f7bf65a 100644 --- a/notes.md +++ b/notes.md @@ -4,7 +4,7 @@ https://localhistories.org/a-history-of-pirates/ caravel (1200s) crew simulator with piracy mechanics? takes place on the english channel - very small scale, crossings no more than 2 minutes - - model ~15 ports + - model ~15 ports https://www.reddit.com/r/MapPorn/comments/8kf22u/new_version_medieval_trade_networks_of/ - map edges could be nasty storms - essentially pioneer but not in space diff --git a/pirates/src/lib.rs b/pirates/src/lib.rs index b67f846..d21b2a2 100644 --- a/pirates/src/lib.rs +++ b/pirates/src/lib.rs @@ -70,9 +70,11 @@ fn render_frame(buffer: &mut [u32; WIDTH*HEIGHT]) { for y in 0..HEIGHT { for x in 0..WIDTH { - let point = Vector2::new(((x as usize + (15 as f32 * 64.0 * (12.0 + 3.0)) as usize + 1630) as f32),(y+ 1830) as f32)* 4.0; + let point = Vector2::new(x as f32, y as f32)* 4.0; + let offset = Vector2::new(64120.0, 7320.0); + let point = point + offset; let mut n = 0.0; - n += (sample_map_inter(point / 64.0, &MAP)-0.5)* 0.7; + n += (sample_map_inter(point / 64.0, &MAP)-0.5)* 0.6; n += noise::noise(point / 64.0, rand) / 1.0; n += noise::noise(point / 32.0, rand) / 2.0; n += noise::noise(point / 16.0, rand) / 4.0; @@ -80,8 +82,13 @@ fn render_frame(buffer: &mut [u32; WIDTH*HEIGHT]) { n += noise::noise(point / 4.0, rand) / 16.0; n += noise::noise(point / 2.0, rand) / 32.0; //buffer[y*WIDTH + x] = (((n*0.5+0.5)*256.0) as u32) << 16| 0xFF005000; - buffer[y*WIDTH + x] = if n > 0.04 { + buffer[y*WIDTH + x] = + if n > 0.1 { 0xFF00FF00 + } else if n > 0.04 { + 0xFF44FF44 + } else if n > -0.03 { + 0xFFFF1111 } else { 0xFFFF0000 }