Skip to content

feat: native mod framework + bunnyhopping and portal gun example mods - #66

Draft
kirjavascript wants to merge 6 commits into
murkantor:mainfrom
kirjavascript:cmods
Draft

kirjavascript wants to merge 6 commits into
murkantor:mainfrom
kirjavascript:cmods

Conversation

@kirjavascript

@kirjavascript kirjavascript commented Oct 21, 2026 •

Copy link
Copy Markdown

Primer

This PR is a forcing function for discussion of how a mod system could be implemented in Project Midas

I know it was suggested to support lua for mods; but I think we should support both native & lua mods

We can build the ability to support native mods first, then build the lua support on top of it: supporting both types of mods.

The mods are currently distributed as object files that you just need to put in Data to have them work. They can be enabled with a midas.ini edit, or with environment variables.

With this approach we get a lot of stuff for free: functions can just be external and immediately usable. We also get the full power and performance of using native languages.

Currently the examples are in C, but mods could be written in Rust or Zig, etc.

Legacy mods like goldfinger64 can be converted to this format still without too much trouble.

I expect to have feedback to action before merging this PR. It needs a cleanup, but I wanted to get others input befor committing to spending time on exactly how it should be. Certainly, more time needs to be spent on what exact hooks we should be using.

bhop.mp4
portal.mp4

GE has no jump; this adds one as a Port action so it works on any device and
respects the existing controls-live gate. The stan prop tests measure their
height window from the floor, so it is lifted by Bond's height above the floor,
and objects under him become his floor so a jump can land on crates.
[input] jump_height sets the peak; 0 restores vanilla behaviour.
Stan edges carry no height, so a ledge or railing refuses a jump like a wall.
While Bond is airborne and blocked by a tile edge, look for floor behind it
within a step of his feet and cross if he fits and the room geometry shows
no wall in the way. The bullet line test reports hits beyond the segment, so
only hits between Bond and the landing spot count. GE_LEDGEDBG=1 logs why
each attempt was taken or refused.
Jumping now keeps momentum: while airborne a CS-style velocity replaces the
walk animation's motion, air strafing builds speed, a quick re-jump keeps it
and holding jump auto-hops. Each part can be turned off (jumping,
jump_height, jump_ledges, bhop, auto_bhop, speedometer), from midas.ini or
the Port Options page, all on by default.

Also declares fabsf for GCC: the IDO math.h hides it, and the implicit int
version leaked an x87 stack slot per call until Bond's position went NaN
and the level stopped drawing.
Jumping/bhop and the Portal Gun were patched straight into bondview2.c,
joy_port.c and explosion.c, so every such tweak meant a rebuild and a
heavier engine. They now live in mods/ as shared libraries loaded from
Data/Mods at boot (port_mods.c, API in midas_mod.h), and the engine keeps
only generic hook points and registries for options, binds, console
commands, strings and spare item slots. A mod can be rebuilt without
rebuilding the game.

GE_MODS / midas.ini [mods] load= pick which mods run. Lua can later sit on
top of the same host as one more mod (mods/README.md).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant