Repository navigation
Village critters
The Village walk has small lives in its meadow. Fireflies drift and blink over the pond and the grass at night. Butterflies flutter over the meadow by day. Neither flies in rain.
The module is extensions/village/critters.mojo. VillageGame builds Critters from PlayParameters.haunts, and runs them in each tick.
| Critter | What it is | When it shows | How it moves |
|---|---|---|---|
| Firefly | A mote 8 centimeters across. It is drawn unlit in yellow-green, so it glows. | The daylight is less than NIGHT, 0.3 |
It drifts slowly, 0.4 to 1.3 meters up. It glows for BLINK, 55 percent, of its time. |
| Butterfly | A dark body and four wings 24 centimeters across | The daylight is more than DAY, 0.6 |
It flutters 0.5 to 1.2 meters up, and faces the way it flies. It beats its wings at FLAP, 16 radians a second. |
A critter hides when the rain is more than WET, 0.5. The daylight comes from the day, and the rain from the weather.
The wings take one of four colors in turn: orange, cream, blue and yellow. wing_color gives them.
A Haunt is a round patch of the meadow, and how many fireflies and butterflies keep to it. Each critter flies its own loop round a point of its haunt.
from extensions.village.critters import Haunt
from extensions.village.play import PlayParameters
from extensions.village.quality import LOW, game_quality
from units.si import METER, Length
var parameters = PlayParameters(game_quality(LOW))
parameters.haunts.append(
Haunt(Length(0.0, METER), Length(10.0, METER), Length(5.0, METER), 8, 2)
)Haunt.check refuses a radius that is not from 0 to 100 meters. It refuses a count of fireflies or butterflies that is not from 0 to 64.
default_haunts gives four haunts. The pond has 14 fireflies and 2 butterflies. Three patches of the meadow, clear of the houses, have the rest: 26 fireflies and 9 butterflies in all.
A critter over the pond flies over its water, not over the floor of the basin.
A firefly is one mesh of 8 triangles. A butterfly is three meshes: its body and the wings on each side. The default village adds 53 meshes. A hidden critter is not drawn, so by day the fireflies cost nothing, and by night the butterflies cost nothing.
- A critter does not keep off the houses or the trees. Keep the haunts clear of them.
- The player cannot catch a critter.
- A firefly gives no light to the things round it.
Tutorials
How-to
- Install
- Run the checks
- GPU backend
- Coverage
- Measure examples
- Add a feature
- Add a scanned building
- Write documentation
Reference
- Scene graph
- Rotations
- Cameras
- Geometry
- Geometry addons
- Lofts and clipping groups
- Sculptor
- Procedural generators
- Meshes and assets
- Lines
- Points and sprites
- Helpers
- Scene objects
- Animated objects
- Raycasting
- Curves and paths
- Animation
- Skinning
- Materials
- Node materials
- TSL functions
- Lights
- Lighting addons
- Fog
- Textures
- Renderer
- Renderer hooks and material flags
- Rasterization
- GPU backend
- Render target
- Post-processing
- GPU computation
- Compute nodes
- Progressive light map
- Gaussian splats
- Voxel global illumination
- SVG renderer
- Image files
- Image decode queue
- Model files
- More model files
- Exporters
- Scene JSON
- Windowing and controls
- C ABI and hosts
- Math
- Norm consumers
- Math addons
- Units
- Coverage tool
- Commands
- Examples
- Benchmarks
- Extensions
- Shared physics
- Physics query snapshots
- Continuous collision
- Tick force restoration
- Water
- Vegetation
- Village
- Streamline
- Animals
- Buildings
- CARLA
- Femur
- Tibia
- Fibula
- Patella
- Knee
- Muscles
- Vessels
- Lymph
- Nerves
- Integument
- Leg
- Foot
- Pelvis
- Torso
- Arm
- Hand
- Head
- Genome
- Game humanoid
- Humanoid fidelity
- Mixamo animations
- Audio-aligned game faces
- Converted assets
- Mesh quality
- Garments
- Outfits and armor
- Cloth and spring bones
- Attire estimates
- Segment inertia
Explanation
- Software rasterizer
- Scene graph as an array
- Linear color
- Normals are not colors
- Perspective correction
- Fixed-point coverage
- Per-fragment shading
- Mipmaps
- Sorted transparency
- Types and checks
- Render hooks as a trait
- Shared CPU and GPU code
- Bands and threads
- PNG structure
- Extensions beside the port
- Scans as building models
- CUDA teardown hang
- Mojo compiler hang