Products › BaseNode Packs › Game Art Tools › Tutorial: A game level

A game level

A small level for a game: a road winding over rolling ground, houses along it, a stream running beside it, trees around them. Every piece is laid the way a level artist lays it, and comes out ready for an engine: UV maps in metres, a trim sheet, a flowmap, a lightmap UV map, baked vertex colors, levels of detail.

A small level in daylight: a grey road with white lines winds in a gentle S between plastered houses on stone plinths, a guard rail along its bend, a blue stream on the right, groves of low-poly pines behind
Where we are going. Seven steps, each one a few lines more.

You will learn

This page goes faster on the basics than Lunar ground, which starts from a flat square: a noise, SetPosition, a material. Read it first if those are new to you.

Before you start

You need Blender 5, the Base Node add-on, version 0.13.1 or later, and the Game Art Tools pack: it carries the four modules this tutorial assembles. The pack is sold by the author of Base Node, apart from the open source project. The steps are free to read, copy and change; the modules they use are not.

ModuleKindWhat it gives
roadsgeometryroad: a mesh of lanes and shoulders along a curve, banked, laid on a terrain, mapped in metres; flatten_terrain and road_mask_on_terrain bring the terrain to it; terrain_height reads the ground under a point.
trim_sheetsgeometrytrim_faces: faces mapped to the row of a trim sheet their width calls for; trim_strip: strips along curves, mapped along their length.
flowmapsgeometry and shaderflowmap: a flow on a mesh, from its slope, along curves, around obstacles, stored as engines read it; flowmap_read and flow_texture: the two-phase blend in the material.
game_exportgeometrylightmap_uv, bake_vertex_color, lod_by_distance.

Every block below is a complete .bn file, its code beside the nodes it builds. Two ways to try a step:

The pictures are rendered from these exact files by render.py, under the same daylight sky and sun, from the same camera except where a caption says otherwise.

1. Rolling ground

The level is a grid, 240 m by 140 m, a point every 60 cm: dense enough for a road to be laid on it and for the ground to be flattened under the road. A slow noise lifts it into hills, 7 m from the lowest to the highest.

step1_ground.bn: game_level, haze, Ground

Green rolling ground fading into a pale haze at the horizon under a blue sky
Step 1. Rolling ground, and no seam where the level ends.

2. A road along a curve

A curve is the road's path: 221 points from west to east, swung 6 m either way by a sine, a long gentle S. road builds the road along it, on the ground.

step2_road.bn: game_level, Asphalt

A dark road with white lines winding over the green hills; its edges float above the grass in places and sink under it in others
Step 2. The road follows the hills, but the ground does not follow the road: here it hangs over the grass, there the grass covers its edge.

3. The ground under the road

The road keeps its shape; the ground must make room for it. Two lines on the ground, after the road is made:

step3_verges.bn: game_level, Ground

The road now sits on the ground along its whole length, its gravel shoulders bordered by worn dirt
Step 3. The ground fitted to the road, its verges worn.

4. Houses on a trim sheet

A trim sheet is how games texture whole towns with one texture: horizontal rows, each tiling along its length, a wall with windows, a guard rail, stone, a cornice. A face is mapped to the row that fits its width.

step4_houses.bn: game_level, house, Trims

Plastered houses with rows of windows and cornices stand on stone plinths along the road; a steel guard rail on posts runs along the bend
Step 4. Six houses, every face mapped by its width; a guard rail along the bend.

5. A stream on a flowmap

Water in a game is a flat strip whose texture moves. Which way it moves, at each point, is a flowmap: a colour on the mesh that the shader reads.

step5_stream.bn: game_level, Stream

A blue stream winds through the grass beside the road and the houses, streaked along its course
Step 5. A stream beside the road, streaked along its flow.
Close to the stream: streaks of light run along the water, around its bend, without stretching
The stream of step 7, close, time driven from 0 to 1 over 48 frames: one cycle of the blend, so the loop has no seam.

6. Trees, kept off the road

The masks that a road stores are also what a scatter reads. A wider mask of the road, the pads and the stream keeps the trees off them.

step6_trees.bn: game_level, tree

Groves of low-poly pines fill the hills around the road, the houses and the stream, never on them
Step 6. Groves around the level, none on the road, the stream or a house.

7. Ready for the engine

The level looks right; now it must leave Blender. Three lines of game_export, two on the houses and one on the ground.

step7_export.bn: game_level, Trims

None of this shows in a beauty render: the picture of step 7 is the picture of step 6, with grime at the foot of the walls. Here is what it adds, seen for what it is.

The unit square filled with small rectangles in the colours of the houses, none overlapping, tall ones for the walls and thin ones for the ledges
The lightmap UV map of the six houses, laid flat: each face in its house's colour, packed into the unit square.
The level from above: green ground near the camera on the left, yellow then orange bands further away, their cells drawn larger and larger
The level from above, the camera at its left edge: lod_level 0 in green, then 1 and 2, the cells drawn, wider with the distance.

The knobs

Every module has its inputs, on its node in the Geometry Node editor. A few worth turning:

WhereInputWhat it does
roadwidth, lanes, shoulderThe cross-section: how wide, how many lanes, how wide the shoulders.
roadbank_by_curvature, max_bankHow much the road leans into its turns, and how far at most.
roadsmooth, conformHow long a stretch the height is smoothed over; 1 to lay every point on the ground.
flatten_terraindepth, falloffHow far below the road the ground goes, and how gently it comes back.
trim_facessheet_size, rows, ratioThe texel density and the layout of the sheet: which row a face of a given width falls on.
flowmapslope, radius, blurHow much the water runs downhill, how far from the curve it follows it, how smooth the flow.
flow_texturestrength, cycleHow far the texture travels in a cycle, and how long a cycle lasts.
lod_by_distancenear, cell_size, levelsWhere the detail starts to go, how coarse the first level, how many levels.

Try: on step 7, set max_bank of road to 0.2 and bank_by_curvature to 8: a racing track. Set floors of house c to 6: its new walls take the same row of the sheet, with no other change.

To lay your own level, draw your own curves for the road and the stream, and replace the noise with your terrain: the modules only need a mesh dense enough to be flattened, and curves above it.

Take it to Blender

The finished level, in one file. Drag the card onto empty space in Blender's 3D Viewport and keep Instantiate the Example: a new object carries game_level. A click on the card downloads the file.

The steps before it, to start again from any of them:

The files, with the script that renders this page's pictures, are in examples/tutorials/game_level/.