Skip to main content

Murder continued

· 5 min read
beho

This is a post about the Murder game engine.

I've been playing around with this engine because it has a great feature set and is built by very talented people. I'm hoping that getting familiar with this framework will help me learn some game engine fundamentals.

My approach so far is to use the Murder engine to build a 2d side-scrolling platformer. I don't have a strong idea of what game I would like to make so I am focussing on getting basic platformer features down.

I am approaching this by:

  1. documenting the Murder codebase - I am new to ECS as a paradigm so taking a single class from the internals and adding comments for what each step is doing has been helpful in getting to understand it. The engine itself is sparse on documentation so potentially this work might be useful to contribute back.

  2. implementing my own ECS systems - there are many systems baked into murder already that can be used out of the box; many are advanced features that I don't understand or necessarily need yet. Some make a top-down assumption so gravity works in their simulated "z" direction but for me it is the y direction. I've found implementing my own systems to be a good way to learn.

    • For example I wrote a gravity system which adds a downward velocity on each time step and conversely a jump system which converts upwards intent / action into upwards velocity.
    • I implemented a "grounded system" to detect if a character is standing on something, which controls whether we can jump.
  3. learning about ECS more generally:

    • I read a book on Mastering ECS but it seems to focus more on architecture / performance of the system itself rather than how to architect the game design. In the article Archetypal ECS conisdered harmful by Evan “cosmonaut” Hemsley (the author an ECS called MoonTools) reframes the value of ECS as game logic organisation rather than game perforance - which is more aligned with my values.

    • Seeing how ECS has been used in past games: This forum post digs into the design of how Thief was made and a Data-Driven Game Object System is a talk by Scott Bilas about the architecture of the game Dungeon Siege.

The goal is to get something working so I am using delightful, prebuilt player animations and city scape assets by Dead Revolver on itch.io.

Example: the grounded system

I learned a few things in making the grounded system, which detects if the player is on the ground or in the air. It works like this:

  1. we take the player character (any entity with the PlayerComponent);
  2. we build a rectangular box around, and slightly beneath, the player's feet;
  3. we search the space to see if there is anything that overlaps with that rectangle;
  4. if we find a collision (that isn't the player character!) we mark the player as grounded by adding a GroundedComponent to the player entity.

In the process I've learned about how quad trees and how they are used to effeciently search 2D space (e.g. for collisions). A quad tree is like a binary tree except each node has four children. Each node represents a square in space and child nodes correspond to each quadrant (top-left, top-right, bottom-left, bottom-right) in it. All entities get assigned to a node in the tree based on its position in space.

I'm learning words like "coyote time" where a player is briefly stil considered grounded after wallking for an edge; this acts as grace period for input lag. I've also learned that comparing two rectangles as bounding boxes for collision detection is called AABB - short for axis-aligned bounding box.

What's next

I'll continue building out this project until I have an idea for game I'd like to make.

If I'm going to use this engine long term I'd like to be able to contribute back to it, but I'm not sure it's that kind of project. There are a few pull requests for the project that have been left open without comments. I can't see any CI running and the example project needs a bit of love.

I assume generally people make things open source to share and receive contributions. It's also fair to assume that the main priority for the developers is working on their own game. They certainly don't owe me their attention.

I'll open some pull requests of my own and see what happens. The alternative I guess is to maintain my own fork of the engine and then periodically pull in updates.


Thank you for reading.

Please post any comments on this bluesky post.