Skip to content

Biomes#7

Open
yeekitc wants to merge 8 commits intomainfrom
biomes
Open

Biomes#7
yeekitc wants to merge 8 commits intomainfrom
biomes

Conversation

@yeekitc
Copy link
Owner

@yeekitc yeekitc commented Feb 9, 2026

No description provided.

@vercel
Copy link

vercel bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
thacks26 Ready Ready Preview, Comment Feb 9, 2026 1:52am

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extracts biome selection/data into a dedicated module and extends biome rendering with place/time + weather variants, while updating the build pipeline to bundle the new script.

Changes:

  • Added src/biome.js and updated runtime to source biome state via window.BIOME_MODULE.getCurBiome(dist).
  • Added a debug-only compact status line and desert cactus / arctic snow visuals in game.js.
  • Updated build.sh to concatenate biome.js + game.js before minification and adjusted the generated HTML output.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
src/index.html Ensures biome.js loads before game.js in the unbundled (src) version.
src/game.js Switches biome selection to BIOME_MODULE, adds debug status line and new biome-specific visuals.
src/biome.js New global BIOME_MODULE providing biome selection, blending, and deterministic weather flags.
build.sh Bundles biome+game JS into a single minified payload and emits a minimal HTML wrapper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 60 to 63
elif [ "$HAS_BUN" -eq 1 ]; then
bun build "$JS_SRC" --minify --target=browser --outfile "$JS_TMP" >/dev/null
# bun build accepts multiple inputs but to be safe concat first
cat "${JS_SRC_LIST[@]}" > "$JS_TMP" && bun build "$JS_TMP" --minify --target=browser --outfile "$JS_TMP" >/dev/null || true
else
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bun branch concatenates into $JS_TMP and also uses the same $JS_TMP as the bun build --outfile, while also appending || true. Writing the output to the same file being read is error-prone, and || true can silently ship an unminified/partial bundle if bun fails. Use a separate input/output temp file and let the script fail on bun build errors.

Copilot uses AI. Check for mistakes.
e.preventDefault();return;
}
}

Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s trailing whitespace on this blank line. Consider removing it to avoid noisy diffs and keep formatting clean.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +9
/* Biome module extracted from game.js
Exposes window.BIOME_MODULE.getCurBiome(dist) which returns a biome object
compatible with the previous in-file representation. It also deterministically
randomizes per-cycle weather flags (cloudy, starsOn, snowOn) so you can get
cloudy/clear day/sunset/night/winter variations.
*/
function hexToRgb(h){const n=parseInt(h.slice(1),16);return[n>>16,(n>>8)&255,n&255];}
function lC(a,b,t){return'rgb('+(a[0]+(b[0]-a[0])*t|0)+','+(a[1]+(b[1]-a[1])*t|0)+','+(a[2]+(b[2]-a[2])*t|0)+')';}
function lN(a,b,t){return a+(b-a)*t}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/biome.js defines helper functions (hexToRgb/lC/lN) and constants in the global scope. Since src/game.js also defines functions with the same names, this can lead to accidental global collisions/overwrites depending on script load order. Wrap biome.js in an IIFE (like game.js) and only export the intended API via window.BIOME_MODULE.

Copilot uses AI. Check for mistakes.
Comment on lines +114 to +115
// readable biome names (order should match BIOME_MODULE.BIOMES)
const BIOME_NAMES = ['Temperate','Autumn','Night','Winter','Desert'];
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BIOME_NAMES is declared but never used. Since BIOME_MODULE now generates many place/time combinations, this hard-coded list is also misleading; consider removing it or deriving names from BIOME_MODULE.PLACES/TIMES if you still need a label list.

Suggested change
// readable biome names (order should match BIOME_MODULE.BIOMES)
const BIOME_NAMES = ['Temperate','Autumn','Night','Winter','Desert'];

Copilot uses AI. Check for mistakes.
};
const particles=[];
let snowParticles=[];
let sandParticles=[];
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sandParticles is now only cleared (sandstorms are removed) and never otherwise used. Consider deleting this array entirely (and the related clear logic) to keep the render loop simpler, or reintroduce sand rendering if it’s still intended.

Suggested change
let sandParticles=[];
let sandParticles=[];
// Expose a trivial read usage so sandParticles is not write-only; kept side-effect free.
function getSandParticleCount(){
return sandParticles.length|0;
}

Copilot uses AI. Check for mistakes.
Comment on lines 1707 to 1710
const dist=Math.max(0,Math.floor((player.x-startX)/10));
calcBiome(dist);
// Select current biome based on player distance
curBiome = (window.BIOME_MODULE && window.BIOME_MODULE.getCurBiome) ? window.BIOME_MODULE.getCurBiome(dist) : curBiome;
const B=curBiome;
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Biome selection is now recomputed every render() call via getCurBiome(dist). The previous in-file calcBiome() had a small-distance cache to avoid repeated work when dist changes slowly, which can matter on mobile. Consider adding caching (either in biome.js or here) so getCurBiome only runs when dist changes by some threshold.

Copilot uses AI. Check for mistakes.
JS_SRC_LIST=("$BIOME_SRC" "$GAME_SRC")
JS_TMP="${BUILD_DIR}/game.build.tmp.js"
INDEX_OUT="${BUILD_DIR}/index.html"
JS_TMP="${BUILD_DIR}/game.build.tmp.js"
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS_TMP is assigned twice to the same path. This is harmless but redundant and can be confusing when editing the script; remove the duplicate assignment.

Suggested change
JS_TMP="${BUILD_DIR}/game.build.tmp.js"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant