Freeride

Freeride

Behind the Code · Pixel Art, Lighting & C++

Our C++17 and WebAssembly snowboarding tribute to Windows 3.1 SkiFree: endless chairlift laps, five-style night floodlights, and Timber Lodge pixel UI.

If you grew up around a Windows 3.1 PC, you probably remember SkiFree: cruising down a bright white screen, dodging pines, and thinking you were safe right until the Yeti charged in from the edge of the monitor. Freeride turns that classic loop into a continuous mountain session where runs flow into a 360-person base lift line, a scenic chairlift ride back up the hill, and carry-over high-score laps.

Everything on screen shares a crisp 3-pixel grid without relying on external art editors. A Python software rasterizer builds all 16-angle riders, skiers, trees, lift houses, and treeline snow-gun masts from blocky 3D shapes, the red-eyed Yeti is typed out directly as 24x24 ASCII pixel rows, and the snow-capped Timber Lodge UI is baked in C++ code at startup. Explore the live sprite sheets, night lighting presets, chairlift loop, and UI boards below.

Play Freeride
Inspired by Windows 3.1 SkiFreeTimber Lodge Pixel UI5 Night Lighting StylesEndless Chairlift LoopC++17 + WebAssembly

Timber Lodge Pixel-Art UI

Snow-capped wooden signboards and bitmap fonts baked in C++
UI Screen:
src/PixelUi.cpp · 0 UI Sprite Sheets
Freeride Timber Lodge UI: Title Board (Day)

Snow-capped plank signboard on a 427x240 3x pixel grid, paired with the live rotating 16-angle x 5-pose YOUR RIDER outfit card.

427x240 Grid (3x Pixel Scale)

Night Riding & Five Switchable Lighting Styles

Press N on menus and F4 in-game to cycle piste floodlight looks
F4 Lighting Style:
Shader-free GLES2 / WebGL compositing
NIGHT 3 / 5: MOONLIGHT640x360 Half-Res Lightmap + Additive Shafts
Freeride night mode in Moonlight lighting style

High-visibility alpine moonlight across the mountain paired with compact, warm golden pools under each pylon crossarm and treeline lamp arm.

Preset Color Channels

Forest Ambient
#42547c
Piste Wash
50%
Lamp Pools
#ffce8c
Airborne Snow
0.70x Beam
Slope Lighting Hardware (3x Pixel Grid)
Centre-line ski lift pylon with dual crossarm floodlightsCentre Lift Pylon (Dual Crossarm Lamps)
Treeline floodlight mast with bolted fan snow gunTreeline Mast + Fan Snow Gun
Board carve spray draws on the ground pass before the lightmap multiply so riders never disappear inside a glowing wake, while snow-gun plumes and light shafts composite afterward with anamorphic lamp glare bars.

The Chairlift & Endless Resort Loop

From dense summit forest to a 360-rider base corral and back up the cable
03 / 360-RIDER BASE CROWD & SINGLES GATESingle-Batch GPU Sheet
360-Rider Base Crowd & Singles Gate

Runs flow straight into a lively 360-person base corral pre-baked into one GPU texture sheet. You brake at the end of the band and shove through the crowd to the singles gate while the front pair steps aside.

Wheel Houses & Cable Props

Base loading wheel house with operator hut and corral postsBase Terminal (216x252)
Summit unloading wheel house with packed snow apronSummit Terminal (216x252)
Uphill double chairlift benchUphill Chair
Wide snow kicker ramp with blue painted lip128x64 Kicker
Chair spacing is rounded so an integer count of chairs wraps the closed cable loop around both bullwheels. Every passenger who steps off at the top becomes an active downhill CPU skier or boarder in that exact outfit.

Interactive 3-Layer Rider & 24x24 Yeti Inspector

Pulling the live sprite sheets straight from the game
Character:
Jacket Color0 deg
Pants Color220 deg
Preset Outfits:
Board Angle (Facing 1 of 16)
Straight Downhill (0 deg)
Riding Pose:
Zoomed Preview (4x)
The green box at the bottom is the actual 20x12 hitbox where the board meets the snow.

How One Sprite Sheet Covers Every Outfit

01 Base Layer
Helmet, Skin & Boots
02 Jacket Shading
Tinted on the Fly
03 Pants Shading
Tinted on the Fly
04 Combined Sprite
64x64 Result

Drawing a separate sprite sheet for every outfit color would mean hundreds of PNGs. Instead, the jacket and pants are saved as plain grey shading. When the game draws a rider, it multiplies those two grey layers by whatever colors you picked, so every player and AI rider gets their own gear from the same three tiny images.

All 16 Angles (Ride Pose)Click any angle to inspect

What We Learned Building It

Excerpts straight from the Python art scripts and C++17 game loop
LESSON 01

Chunky 3x3 World Sprites and a 24x24 ASCII Yeti

Riders, skiers, trees, snowmen, kickers, wheel houses, and floodlight masts are posed as tiny blocky 3D meshes in Python and rasterized at one-third scale into chunky 3x3 pixel blocks, with soft blue-grey rims on snow surfaces instead of dark outlines. The revamped Yeti breaks that rule on purpose: he is typed out as ASCII letter rows on a 24x24 grid (sunken shoulders, red eyes, fangs, and claws) across 376 frames.

tools/make_world_sprites.pyPython
PIXEL = 3  # every drawn pixel is shown as a 3x3 block

def shoot(mesh, width, height, anchor, px_per_m=PX_PER_M):
    w, h = -(-width // PIXEL), -(-height // PIXEL)
    mat, tone = sg.rasterize(mesh, w, h, (anchor[0] / PIXEL, anchor[1] / PIXEL),
                             px_per_m / PIXEL, SS, fill=FILL)
    return chunky(sg.to_rgba(mat, soft_edges(mat, tone)), width, height)

T_BODY = {
    "front": ["..W..WWWW..W..",
              ".WWWWWWWWWWWW.",
              "WWWWDDDDDDWWWW",
              "WWWDRRDDRRDWWW",  # D = dark face, R = glowing red eyes
              "WWWWDDDDDDWWWW",
              "WWWWWDTTDWWWWW"], # T = fangs
}
LESSON 02

Tinting Grey Layers Instead of Exporting Outfits

Each human rider is three stacked PNGs: a color base layer for helmet, goggles, skin, and boots, plus two greyscale shading masks for the jacket and pants. At runtime, the C++ renderer snaps destination coordinates to whole pixels and multiplies those grey layers by HSV colors. For the 360-rider base lift corral, LiftStation::BakeCrowdSprites pre-tints every outfit into one GPU sheet at startup.

src/Player.cppC++17
void Player::DrawSprite(Vector2 centre, float size, Direction dir, RiderPose pose,
                        float lift, Color tint) const {
    const Rectangle src = { (float)dir * RIDER_CELL, (float)pose * RIDER_CELL,
                            RIDER_CELL, RIDER_CELL };
    // Snapped to whole pixels so all three layers sample the same texels.
    const Rectangle dest = { floorf(centre.x + 0.5f),
                             floorf(centre.y - lift + 0.5f), size, size };
    const Vector2 origin = { size * 0.5f, size * 0.5f };

    DrawTexturePro(textures[0], src, dest, origin, 0.0f, tint);
    if (textures[1].id != 0)
        DrawTexturePro(textures[1], src, dest, origin, 0.0f, mul(jacketColor, tint));
    if (textures[2].id != 0)
        DrawTexturePro(textures[2], src, dest, origin, 0.0f, mul(pantsColor, tint));
}
LESSON 03

Baking the Timber Lodge UI on the Same 3-Pixel Grid

Instead of stretching a 9-slice sprite sheet, src/PixelUi.cpp draws every menu, HUD board, and scoreboard directly on a 427x240 virtual grid (3 screen pixels per UI pixel). Snow-capped wooden planks, icicle drips, brass corner nails, proportional 5x7 and 3x5 bitmap fonts, key caps, and the wooden speedometer dial are baked once into tiny GPU textures.

src/PixelUi.cppC++17
const GlyphDef kBody[] = {
    { 'A', ".###. #...# #...# ##### #...# #...# #...#" },
    { 'B', "####. #...# #...# ####. #...# #...# ####." },
};

Texture2D BakePanel(int w, int h, bool alert) {
    const int oy = kSnowRise;
    Image im = GenImageColor(w, h + oy, BLANK);
    const Color* planks = alert ? kRedPlank : kPlank;
    for (int j = 0, yy = 1; yy < h - 1; j++, yy += 6) {
        const Color c = planks[j % 2];
        ImgRect(im, 1, oy + yy, w - 2, (h - 1 - yy < 6) ? h - 1 - yy : 6, c);
        ImgRect(im, 1, oy + yy, w - 2, 1, Shade(c, 18));
    }
    for (int i = 0; i < w - 2; i++) { // lumpy snow cap along the top edge
        const int hgt = 3 + (((i * 7 + (i / 5) * 3) % 5) == 0) + (((i * 13) % 11) == 0);
        for (int j = 0; j < hgt; j++) ImageDrawPixel(&im, 1 + i, oy - 1 + j, kSnow);
    }
LESSON 04

Shader-Free Night Mode With Five Switchable Looks

To guarantee identical rendering in desktop OpenGL and browser WebGL/GLES2 without custom shaders, night riding builds a half-resolution 640x360 lightmap with an even piste wash band and smooth rlgl ring-mesh floodlight pools, multiplies it over the world, and then composites volumetric light shafts, anamorphic lamp glare bars, and airborne snow on top.

src/main.cppC++17
BeginTextureMode(lightmap); // half-res 640x360 bilinear target
ClearBackground(Color{ dim(look.ambient.r), dim(look.ambient.g), dim(look.ambient.b), 255 });
BeginMode2D(lightCamera);
TrailLights::DrawTrailBand(camera.target.y, look);
SkiLift::DrawLightmap(player.GetPosition().y, look.pylon);
TrailLights::DrawLightmap(player.GetPosition().y, look.mast);
EndMode2D();
EndTextureMode();

// Multiply lightmap over ground & riders, then draw airborne snow + beams
BeginBlendMode(BLEND_MULTIPLIED);
DrawTexturePro(lightmap.texture, srcFlip, fullScreen, Vector2{ 0, 0 }, 0.0f, WHITE);
EndBlendMode();
BeginMode2D(camera);
effects.Draw(look.airborneTint, EffectsManager::DrawPass::Air);
SkiLift::DrawBeams(player.GetPosition().y, renderCfg.nightBeams, look.pylon);
TrailLights::DrawBeams(player.GetPosition().y, renderCfg.nightBeams, look.mast);
EndMode2D();
LESSON 05

Joining Endless Runs With a Live Chairlift Loop

Runs no longer end at a static finish screen. Chair spacing is rounded so an integer count of chairs wraps the closed cable loop around both bullwheels, feeding riders out of the 360-person base crowd and unloading them onto the summit apron as active CPU skiers and boarders (with one in eight comically wiping out on the ramp).

src/LiftStation.cppC++17
loopLen = 2.0f * span + 2.0f * kPi * kWheelR;
const float n = fmaxf(4.0f, roundf(loopLen / 310.0f));
spacing = loopLen / n; // whole number of chairs round the cable loop

Vector2 LiftStation::LoopPoint(float u) const {
    const float arc = kPi * kWheelR;
    if (u < span) return Vector2{ -kWheelR, bottomY - u };
    u -= span;
    if (u < arc)  return Vector2{ -kWheelR * cosf(u / kWheelR),
                                  topY - kWheelR * sinf(u / kWheelR) };
    u -= arc;
    if (u < span) return Vector2{ kWheelR, topY + u };
    // ...At the top wheel house: getting off a chairlift is famously hard.
    // u.willFall = Rand(rng) < 0.125f;
}
LESSON 06

Ground-Plane Hitboxes and Readable White Snow

Sprites stand upright, but collisions happen on the flat snow plane underneath them, so every hitbox and shadow anchors to the tiny footprint where board or trunk meets the snow. Meanwhile, carve spray draws on the ground pass under the rider while high-arcing mast snow guns switch between vivid granular daylight mixes and lit night billows.

src/Collision.hpp + src/EffectPresets.hppC++17
inline Rectangle MakeGroundHitbox(Vector2 groundAnchor, float width, float height) {
    return Rectangle{ groundAnchor.x - width * 0.5f,
                      groundAnchor.y - height,
                      width, height };
}
constexpr float TREE_W   = 14.0f, TREE_H   = 12.0f; // trunk only, never canopy
constexpr float PLAYER_W = 20.0f, PLAYER_H = 12.0f; // board underfoot (+20px Y)

// Daylight drops dark blue-grey billows in favor of dense ice-blue pixel grain:
c.billowEvery   = night ? 14.0f : 0.0f;
c.ratePerSecond = night ? 280.0f : 440.0f;
c.grainKind     = fx::Kind::Pixel;

How the Pieces Fit Together

Python Art Generators

Build Tool
tools/spritegen.py + make_world_sprites.py

Rasterizes 16-angle rider atlases, chunky 3x3 trees, lift terminals, and treeline snow-gun masts alongside the 24x24 ASCII Yeti.

C++17 & Raylib Engine

Game Code
src/LiftStation.cpp + PixelUi.cpp + TrailLights.hpp

Drives carving physics, range-queried y-sorted world queues, closed-loop chairlift crowds, 5-style night lighting, and procedural PCM audio.

WebAssembly Delivery

60 FPS Browser
Emscripten + Fixed 1280x720 Canvas

Packs world sprites into one 2048x2048 atlas, renders straight to screen at native size, and paces frames via requestAnimationFrame.

Under the Hood at a Glance

Inspired ByWindows 3.1 SkiFree (1991)
Language & LibraryC++17 and Raylib 5.5, compiled to WebAssembly with Emscripten
UI ArchitectureTimber Lodge code-baked pixel UI (src/PixelUi.cpp) on a 427x240 3x grid, zero UI sprite sheets
Rider Sprite Layout16 board angles x 7 poses (ride, carve, crouch, air, tuck, crash, grab) across 3 HSV-tinted layers
Yeti Sprite Grid376 frames across 8 directions, typed on a 24x24 pixel grid and upscaled 3x to 72x72
Night Riding (N / F4)5 shader-free lighting looks (Classic Pools, Even Wash, Moonlight, Sodium, Crisp Floodlit) + mast snow guns
Mountain LoopSummit clearing, shaped trails (30/70, 80/20, 10/90), 360-rider base crowd, closed-loop chairlift
Sound Effects16-bit 44.1 kHz PCM audio synthesized in RAM (carve edge hiss, alpine wind, bush thuds, crashes)
Play in Browserhttps://freeride.dualcorsoftware.com

Take a Run Down the Mountain

Play Freeride right in your browser. Pick your outfit on the Timber Lodge signboard, toggle night riding with N (and cycle floodlight looks with F4), ride the chairlift between laps, and outrun the Yeti past 2,000 meters.

Play Freeride