Skip to content
Evil Engine home

Walking around gm_construct

Garry's Mod's maps now draw through Source's own look, checked against the game's own frames, with water, bloom, decals and baked prop light, and gm_construct has collision you can walk, run and jump around on.


In Garry’s Mod’s materials, matched, Garry’s Mod’s content converted into Evil Engine’s own formats. Now its maps load from the Singleplayer menu, draw the way Garry’s Mod draws them, and gm_construct has collision you can actually walk around on.

Standing on gm_construct's lake shore in Evil Engine, with the city and the tower reflected in the water

Drawing it the way Garry’s Mod does

The engine draws Source maps through its own versions of Source’s shaders. To get them right, I capture Garry’s Mod’s own frames from fixed spots, with settings flipped from Lua where it helps, and write down what the game does as a spec. The shaders are then written from that spec alone and checked against the same frames.

What draws that way so far:

  • Brushes and painted displacements, through LightmappedGeneric and WorldVertexTransition
  • Both kinds of sky, including gm_construct’s painted one, which used to draw white
  • The 3D skybox behind the world, with its own fog
  • Fog, auto exposure and bloom
  • The light every static prop had baked for it by the map, for all 182 of gm_construct’s props, and gm_bigcity_dusk’s benches match the game at a median of exactly 1.000
  • Decals and overlays, so gm_construct’s floor numbers, posters and sprays land where Garry’s Mod puts them

gm_bigcity_dusk lands within 2 to 3 levels out of 255 of Garry’s Mod’s own frames, and gm_construct within 9.

gm_construct's poster wall drawn in Evil Engine, its posters laid onto the wall as overlays

Water

gm_construct’s lake reflects and refracts now, with the 3D skybox in its reflection, and from above it’s within 5 to 11 levels out of 255 of the game. Under the surface, the lake’s own fog and overlay take over the view, within 7 to 9 levels of the game.

gm_construct's lake from the shore, Garry's Mod on the left and Evil Engine on the right

The view from under gm_construct's lake, Garry's Mod on the left and Evil Engine on the right

Underneath, the lake is a liquid record, which is a new kind of thing in the engine. Quake’s water, slime and lava are liquid records too, so every game’s liquids are meant to float, slow and drown you the same way once swimming and physics bodies exist.

Collision and walking

Collision has its own format now, a .glb on glTF’s physics drafts (KHR_physics_rigid_bodies and KHR_implicit_shapes), plus an extension of mine for what a collider is made of and what it blocks. Every .phy in my Garry’s Mod install converts into it, apart from models/player.phy, which is empty.

When a map starts, the host builds its collision once: brushes as the exact convex hulls Source uses, displacements as one triangle mesh, and props by their own .phy. On gm_construct that’s 2,114 solids, the displacements and 35 props’ hulls.

The player controller was written from a spec of how Garry’s Mod’s players move, using numbers read off the game on gm_construct, like its friction of 8, stop speed of 10, 18 unit step and 0.015 s tick. It stands at all 33 of gm_construct’s spawn points, runs at exactly 10.16 m/s, jumps about 0.85 m, stops at walls, and runs up the hills and down to the lake bed.

  • WASD to move, Shift to run, Alt to walk, Ctrl to crouch and Space to jump
  • V to fly
  • Falling out of the map puts you back at the spawn

Pausing

Escape opens a pause menu over the map now, with Resume, Main menu and Quit. The host also gets Server Settings, which is where the tick rate, the sky and the server’s convars will go, but it’s empty until sessions exist.

The pause menu over gm_bigcity_dusk, with Resume, Main menu and Quit

What’s next

There’s nothing to push around yet, since physics bodies aren’t built, and there’s no session to play in with anyone else. Props’ reflections and anything that moves aren’t matched to the game yet either. For water, the light tint under the surface, the muffled sound and the split view when your eye crosses the surface are still to do, and swimming waits on physics bodies.