Pack It Perfect

VR game internship

A VR puzzle game about packing a suitcase, made during my internship at AlterEyes in Belgium. I was the lead programmer in a team of three.

Top-down view of the items and the suitcase

Disclaimer: due to NDA reasons I can't share the game's code, so this page uses pseudocode and diagrams instead.

Role Lead programmer
Team 3: me, an artist, another programmer
Where Internship at AlterEyes, Belgium
Mentor An experienced programmer

The short versionGrid, rules and tools

problem

Pieces poke out of the box

When a piece snapped into place, parts of it could stick out of the suitcase. It had to go back in without breaking the items already packed.

approach

Nudge it back, step by step

An algorithm on the 3D grid moves the piece toward the box one grid step at a time, until every cube is inside.

tooling

Built to work without me

A rules system the other programmer never had to touch, plus tools that checked levels and prepared new items automatically.

Deep diveHow it works

A 3D grid under the puzzle

Items are sets of cells. Every item occupies a set of grid positions, so a banana and a toothbrush are just different shapes on the same grid.

The suitcase defines what's valid. The squares that need filling are the valid positions of the level.

One model for everything. The snap-back algorithm, the rules and the level checker all work from this grid.

What the grid around an item looks like

1

Look at the item

Step 1: a long rectangular item with the grid around it, viewed before placing it
Pick an item up and the grid around it shows the space it will take up.
2

Put it in the box

Step 2: the long rectangular item placed in the box where it overlaps, with the cells changing colour
Place it where it overlaps and the cells change colour to tell you.
3

Find the fit

Step 3: the long rectangular item placed correctly, fitting with no overlap
The correct solution: it fits with no overlap, and the cells show it.

This is the player feedback: the cells around the item change colour as you place it.

Putting a piece back in the box

Piece snaps some cubes outside the level
→
Find the nearest cube outside cube closest to the level
→
Find its target closest valid grid point
→
Move the piece one rounded grid step
→
Repeat until every cube is inside

Moving the piece as a whole means the items already in the suitcase aren't touched.

The algorithm

snap-back (pseudocode) programming
// Simplified. The game's real code is under NDA.
O     = cells the piece occupies
L     = valid cells of the level
O_out = O \ L                                  // cubes outside the level

while O_out is not empty:                     // repeat until O ⊆ L
    p = cube in O_out closest to L             // d(p) = min ‖p − q‖ over q ∈ L
    q = cell in L closest to p
    v = normalize(q − p)
    T = T + round(v)                           // T = the piece's transform in grid space
    recompute O and O_out

Why it matters: the piece is pulled toward the nearest valid spot, which is the best guess at where the player meant it to go.

A rules system the other programmer never touched

Mutable by design. Rules like "a shark can't look at a fish" or "nothing goes on top of an egg" had to be easy to add and change, without editing the rest of the game.

Composition and inheritance. Rules are built from shared parts, so a new rule reuses behaviour instead of copying it.

Observer pattern. Rules react to changes in the puzzle instead of being checked by hand everywhere.

Working around VR, and tools for the team

PC controls. Putting the headset on and off all day is slow, so I wrote a PC-based control scheme to test the game without it.

Level checker. A helper window with an algorithm that tests that every level can actually be solved.

Item grid tool. A tool that builds the grid around an item automatically, so the artist can import new items without my help.

The artist tool
Artist tool. Builds the grid around a new item automatically, so the artist can import items without my help.
Editor tool window 2
Tool window 1. A helper window made to make designing easier.
Editor tool window 3
Tool window 2. A helper window made to make designing easier.

Leading, and being mentored

Team of three. I was the lead programmer, with an artist and another programmer helping me.

A mentor. I was mentored by an experienced programmer during the internship.

My partWhat I did

01
systems

3D grid system

The grid behind the puzzle: items occupy cells, and the suitcase defines which cells are valid

02
programming

Snap-back algorithm

Moves a piece that sticks out of the box back inside, one grid step at a time

03
systems

Rules system

Composition, inheritance and the observer pattern, so rules can change without touching the rest

04
programming

PC controls

A PC-based control scheme for testing without the headset

05
tools

Editor tools

Windows that check every level is solvable and build a grid around imported items

06
production

Lead programmer

Led programming in a team of three, mentored by an experienced programmer

Looking for the design side? See the design breakdown →

Looking backTakeaways

Keep systems out of people's way

Building the rules to be easily changed meant the other programmer never had to touch them.

Build for how you test

VR is slow to iterate in, so a PC-based control scheme saved a lot of headset on-and-off.

Tools save everyone's time

With the grid tool, the artist could import items without me, and the level checker tested every level automatically.