Ember is discontinued. It still works, but it gets no more updates or support. Back to uayi.org
Home · Terrified Gorillas · Glimmerwood · Starfall Hollow · ‹ Prev Next ›
Ember
Download

Making games

Characters, cars and sound

The player character

character.lua is a complete third-person player on a rigged model:

Input
WASD / left stick walk, relative to the camera
Shift / left trigger sprint
Space / A jump (with a short grace period after walking off a ledge)
Mouse / right stick orbit the camera
Left mouse kick the prop in front of you
F get into / out of a nearby car

It turns to face where it moves, plays idle / walk / sprint / jump / fall animations, plays footsteps that match the ground and a sound on landing, and pulls the camera in when a wall is in the way. Easy mode's Player button and the Coin Collector, Sumo Arena and Town Roleplay templates use it.

Tune it with Script Fields: walk_speed, sprint_speed, jump_speed, air_control, turn_speed, mouse_sensitivity, cam_distance, cam_height, stride, kick.

Skeletal animation

Rigged glTF models play their own clips. Add Skeletal Animation (or just call play_animation on the object) and switch clips from scripts; changes crossfade smoothly:

self.entity:play_animation("walk", true, 1.2)   -- clip, loop, speed
print(table.concat(self.entity:animations(), ", "))

The bundled character (models/kenney/arena/character-soldier.glb, CC0) has idle, walk, sprint, jump, fall, drive, die, emotes and more. Animation is skinned on the CPU, which is fine for a handful of characters but not for crowds. There's no animation state machine, IK or root motion: scripts pick the clip.

Keyframe animation

View > Animation opens a timeline for the selected object. Press Record and move things to make keys. Clips (.anim) can animate position, rotation, scale, tint, emissive, visibility, light intensity, light colour, camera field of view and audio volume, with eight easings (linear, step, ease in, ease out, ease in-out, bounce, elastic, back). Event keys call on_animation_event(name). Relative clips play on any object, so one "bob" clip can serve every coin.

self.entity:play_animation("anims/door_open.anim")

Cars

car.lua turns a model with a dynamic box collider (Lock rotation on) into an arcade car. Give it an Audio Source with sounds/car_engine.ogg (loop, play on start) for the engine. The Stunt Drive, Time Trial and Town Roleplay templates have ready-made cars.

Crash deformation

Add Component > Crash Deformation (dents): hard hits push the model's vertices in around the contact point. Settings: softness, maximum dent depth, dent radius and the minimum impact speed. Scripts read entity.damage (0..1), dent by hand with entity:dent(point, direction, speed) and fix it with entity:repair().

This deforms the object's own copy of its mesh. It isn't a node-and-beam soft-body simulation like BeamNG's: there's no tearing, nothing falls off, and the collision shape doesn't change.

Sound

All bundled sounds are CC0: Kenney's starter kits, plus ambience and footsteps synthesised by Ember's own generator.

Ember 1.1 documentation. Found a mistake? The source of this page is site/docs/characters-and-vehicles.md in the Ember source.