2 minute read

Final Live Code

Summary

WCCChallenge Blurb

Biz Biz Biz
Author Project Somedays
Title WCCChallenge 2025 Week 16 - Filter
šŸ“… Started 2025-04-19
šŸ“… Completed 2025-04-20
šŸ•’ Taken ~10hrs šŸ˜… and it’s REALLY not quite finished but I’ve well run out of time
🤯 Concept Quick! Abduct the stretch sheep Alpacas!
šŸ”Ž Focus Working with InstanceMeshes to take full advantage of Three.js’ WEBGL Performance
šŸ–„ļøRig Deets 24GB RAM, 13th Gen Core i9, NVIDIA GeForce GTX 1080

Made for Sableraph’s weekly creative coding challenges, reviewed weekly on https://www.twitch.tv/sableraph

See other submissions here: https://openprocessing.org/curation/78544

Join The Birb’s Nest Discord community! https://discord.gg/g5J6Ajx9Am

Bit off more than I could chew with some very unfamiliar ground to cover but learned a LOT.

Gemini was my tutor - I asked it lots of questions rather than relying on it to write my code - only half the time the tutor was getting it wrong…

So, pretty much like a REAL tutor 🤣

šŸŽ“Lessons LearnedšŸŽ“

  • When you’ve baked the texture in blender, you need to make sure each material channel has an image texture node referencing the texture you’re baking to
  • Make sure your uv unwrap has a bit of an island offset
  • How to add audio! Not too bad. Lots of boilerplate, but pretty straightforward. According to Gemini you can add positional sound in your scene. Three.js is NUTS.

Resources:

Stretch Goals/Extension Ideas

  • Tilt the saucer when moving in any given direction
  • Make the controls MUCH smoother… basic physics probably so it’s a bit tricky with overshooting
  • Make a safe zone to mark when alpacas have craftily escaped…
  • Different levels with faster sheep/alpacas

TODO:

Models

  • Set up a template
  • Find a sheep model
  • Adapt for alpaca
  • Bring into three.js
  • Get a walk cycle sorted
  • Import UFO
  • Make it spin
  • Bake the UFO texture

Code Structure/Biz

  • Refactor so we can work with TWO instancedMeshes
  • Work with Promises because loading

Controls

  • UFO Controls with arrow keys
  • Smooth out motion
  • Move the camera to a starting position off to the side at the right height to see the saucer

Gameplay

  • Work out abduction reset
  • Choose initial animals in positions by Math.random() < alpacaRatio
  • Update biz
  • Scoring
  • Display scoring?
  • Set up an end zone?

Audio

  • Add ambient sheep audio
  • Add abduction sound
  • Add ambient spaceship sound

🪵Dev Log🪵

2025-04-19 Most of the build… (or so I thought)

  • Alpacas are just stretch sheep, right?

Blender biz

  • Baking textures. Took a little bit to get my head around, but now it’s so handy… Texture Baking

  • InstancedMesh for the win

Stormtrooper Sheep

  • Changed the starting perspective and checked the alpacas… Hooray!

Stretch Sheep Success!

2025-04-20 Refactoring and finishing

  • Quite a bit of refactoring to work with TWO instancedmeshes
  • Refactoring for promises
  • Worked out how to distribute the alpacas among the sheep
  • Worked out how to import the textures with the refactored code
  • Added a html element to track scoring
  • Added REALLY rudimentary scoring mechanic