Updating the Engine
Since the engine is a submodule, pull in upstream changes with:
cd madnight_engine
git pull origin main
cd ..
git add madnight_engine
git commit -m "Update madnight_engine submodule"
v0.0.1: instance-based managers
The engine's managers used to be classes with static methods over static state. As of v0.0.1 they're non-static members owned by MadnightEngine, so every call site needs an instance to call through — the global g_madnightEngine:
// before
MeshBin *crateMesh;
co_await MeshManager::LoadMesh("crate", &crateMesh);
// after
MeshBin *crateMesh;
co_await g_madnightEngine.m_meshManager.LoadMesh("crate", &crateMesh);
The member names, all public on MadnightEngine unless noted:
| Manager | Member |
|---|---|
TextureManager | m_textureManager |
MeshManager | m_meshManager |
GameObjectManager | m_gameObjectManager |
ColbinManager | m_colbinManager |
SoundManager | m_soundManager |
ModSoundManager | m_modSoundManager |
AnimationManager | m_animationManager |
BillboardManager | m_billboardManager |
ParticleEmitterManager | m_particleEmitterManager |
FileLoader | m_fileLoader |
ArchiveHelper | m_archiveHelper |
ControllerHelper | m_controllerHelper |
Collision | m_collisionHelper |
Raycast | m_raycast |
SkeletonController | m_skeletonController |
DebugMenu | m_debugMenu |
PerfMonitor | m_perfMonitor |
Renderer (Renderer::Instance()) and Lighting (Lighting::instance()) are unaffected — they're still classic singletons.
CDRomHelper is now [[deprecated]] in favour of ArchiveHelper, and its instance (m_cdromHelper) is a private member of MadnightEngine — game code shouldn't reach for it directly.
A few other things changed alongside the static-to-instance move, worth knowing about when pulling in v0.0.1:
- Most name parameters across the API (mesh/texture/VAG/animation names, etc.) switched from
const char *toeastl::string_view. - Several types —
TimFile,VagEntry,Billboard— now store a hasheduint64_tname (nameHash()) instead of the full string. AHashName()helper (src/helpers/archive.hh) hashes a runtime string or folds a string literal to a compile-time constant, matching how these managers hash names internally — precompute a hash once with it if you're going to look the same name up repeatedly, rather than re-hashing a string_view/fixed_string every call. GameObject,Billboard,Particle, andParticleEmitterdefault constructors are nowprivate(protectedforBillboard, sinceParticlederives from it), with their owning manager (GameObjectManager,BillboardManager,ParticleEmitterManager) as afriend— andParticle's isParticleEmitter, not a manager, since particles are spawned by their emitter. They were already only meant to be created viaCreate*/their emitter, this just makes it compiler-enforced.ControllerHelper::IsPadAnalogis gone —GetNormalizedAnalogStickInputnow checks pad connection/analog support internally (via psyqo's ownhasAnalog) and safely returns0if the pad isn't analog, so there's no need to check first.Menu::Activate/Deactivatewere renamedEnable/Disable(andSetOnActivate/SetOnDeactivatetoSetOnEnable/SetOnDisable) to matchGameplayHUD's naming.Quaternion's components switched frompsyqo::GTE::Shortto fullpsyqo::FixedPoint<>("full fat int32_t") for more precision headroom;DotProductreturnspsyqo::FixedPoint<>to match.FindRotationQuatis commented out in-source and not currently available.GTEMathlostMultiplyMatrix33/MultiplyMatrixVec3— hot-path matrix/vector multiplication now goes throughpsyqo::GteMathdirectly instead of this wrapper; onlyProjectVectorOntoAxesremains onGTEMath.
See the API Reference for the updated per-class signatures.