Kero Devlog #4 - May 2021

May 30, 2021

Progress Report

It’s been a while. Life got in the way for all these months, only just this month giving me some real time to get back into Kero. This month offers some massive new features that push Kero beyond a renderer and finally towards being a full engine, with the implementation of Bullet physics.

Notable changes

Many notable improvements this month. In date ascending order:

Removed gpu allocations from loader

On the surface this seems like a trivial change. But off the back of the first issue raised on the project regarding potential features, being able to run Kero in headless mode became a valuable idea I hadn’t previously considered. At this time, it was very much a renderer only, and I’d made a small effort in reversing some of the physcollide BSP lump, so headless would be functionally pretty useless. However it gave the opportunity to separate the parsing and transformation of game data from the various systems that use now rather than once they complexity grows again. This first step was moving all GPU adapter calls out of the loader code and into the renderer post-parse callback. This will enable future isolation of the renderer entirely from map loading.

Added convar support

Convars are a pretty fundamental part of Source. Support for console functions was added last year, but variables were not yet available. Early this month support for string, bool, int convars were added. The syntax is slightly different than Source though. For now at least they can be viewed and changed using get/set commands: set r_drawlightmaps true. THis will eventually be updated to mirror direct read/write without this prefix.

Support for the classic mat_leafvis debugging command

Another somewhat small one, but as proof of the projects progress the first console command that accurately reflects Source’s behaviour, mat_leafvis <0|1|2|3> is now available in Kero’s console. The rendering itself is incomplete (requires cuboid generation from AABB coordinates) but will draw diagonal lines across VisLeaf AABB’s. This also helps with stepping towards fixing the frustum culling bug.

prop_ entity rendering

For a long time, entity data was being parsed and Generic entity instances are created, but nothing was being done with them. This month, support for searching all propentities and rendering them in the same manner as staticprops is available. Right now, this covers `propdynamic,propdynamicoverride,propphysics,propphysicsoverrideandpropragdoll`. Other entities can be added at a later time, as work needs to be done to abstract prop-specific data and implementation from the generic entity struct.

Switch transform orientations to use quaternions

This was on the plate for a while, and should have been done ages ago. Honestly it should have been this way from the beginning, but the original code was part of the migration from which was written with much less experience and foresight.

The upshot of this is that all static mesh orientations are now working correctly (gimbal lock really reared its head in the stock Counter Strike: Source maps). This applies to both staticprops, and the newly supported entity props.

Implemented Bullet Physics

By far the largest and most impressive new feature is the introduction of a physics implementation. VPhysics is an unweildy beast, undocumented and only available through leaked 2018 source code. Not an ideal situation. Fortunately we don’t actually have to care about that as Bullet physics is available and comes to our aid! With a combination of acting as a base, a lot of integration and generation, and a hell of a lot of testing an initial BSP:entity sphere collision environment was available!

This was a great start, but we have to go further! What about actual entity prop collision models (that use .phy extension), and displacements, and staticprop models? Well fortunately we can solve those too! Turns out I’d written 90% of the phy format loader back in 2019 and forgot about it. Resurrecting that and completing it with a bit of effort and help from Crowbar to understand how collision meshes are actually scaled at compile time and we have displacement:physics entity collisions using their original mesh!

See below our de_dust2 test of some debris on a displacement.


  • Collect pre-gui initialization console log entries.
  • Better logging of parsed game initialization info.
  • Finally fixed a single OpenGL error on first render.