Libsm64:作为外部游戏引擎库使用的马力欧 64
Libsm64: Mario 64 as a library for use in external game engines

原始链接: https://github.com/libsm64/libsm64

本项目为《超级马力欧 64》的移动和渲染引擎提供了一个简洁、可移植的接口,该接口源自 SM64 反编译项目。它通过提供共享库(`libsm64.h`),让开发者能够以极小的工作量将马力欧集成到外部游戏引擎或系统中。 该库在运行时需要一份官方的 SM64 美版 ROM,以提取纹理和动画资源。本项目包含一套完整的测试用例,用于演示集成方法。 **关键技术细节:** * **编译:** 支持 Mac、Linux 和 Windows(通过 MSYS2 MinGW),并初步支持 Emscripten(WebAssembly)。 * **依赖:** 测试程序需要 SDL2 和 GLEW。 * **使用:** 用户只需链接该库并包含头文件即可。构建过程使用标准的 `make` 命令来生成库、测试可执行文件或 WASM 构建版本。 仓库中提供了关于环境设置、依赖安装和构建目标的详细说明。本项目简化了将 SM64 标志性的控制方式和机制引入全新创意环境的过程。

**Libsm64** 是一个令人印象深刻的开源库,它允许开发者将《超级马力欧 64》中原汁原味的移动、物理和动画移植到外部游戏引擎和环境中。该库要求用户提供正版的《超级马力欧 64》ROM,通过在后台运行原始的游戏逻辑,并将其映射到宿主游戏的环境中,从而实现完整的碰撞检测和角色碰撞箱功能。 该项目在 Hacker News 等平台上获得了广泛关注,用户展示了马力欧被成功整合进《半衰期 2》、《索尼克:世代》、《我的世界》,甚至是 Meta Quest 3 的增强现实体验中。 评论者称赞该项目是对“元宇宙”的一种务实实现——即一种去中心化、可互操作的方式,无需依赖企业平台或加密货币炒作,就能让角色跨越不同的数字世界。虽然非程序员仍需具备一定的技术性模组修改技能才能实现,但该库极大地降低了将马力欧标志性物理效果带入几乎任何 3D 空间的门槛,成为了社区驱动的软件保存和创造性再利用的一个强有力范例。
相关文章

原文

The purpose of this project is to provide a clean interface to the movement and rendering code which was reversed from SM64 by the SM64 decompilation project, so that Mario can be dropped in to existing game engines or other systems with minimal effort. This project produces a shared library file containing mostly code from the decompilation project, and loads an official SM64 ROM at runtime to get Mario's texture and animation data, so any project which makes use of this library must ask the user to provide a ROM for asset extraction.

The entire external-facing API of the shared library can be found in libsm64.h. Any client project making use of the library must only include that header and load the library. There's a minimal example project under the test directory as well, demonstrating usage of the library.

Building on Mac and Linux

  • Ensure python3 is installed.
  • Ensure the SDL2 and GLEW libraries are installed if you're building the test program (on Ubuntu: libsdl2-dev, libglew-dev).
  • Run make to build. If you want to link musl libc instead of glibc run LIBSM64_MUSL=1 make instead.
  • To run the test program you'll need a SM64 US ROM in the root of the repository with the name baserom.us.z64.
  • Follow steps 1-4 for setting up MSYS2 MinGW 64 here, but replace the repository URL with https://github.com/libsm64/libsm64.git
  • Ensure the SDL2 and GLEW libraries are installed if you're building the test program.
    • 64 bits: pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-glew.
    • 32 bits: pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-glew.
  • Run make to build
  • To run the test program you'll need a SM64 US ROM in the root of the repository with the name baserom.us.z64.

Building for Emscripten (Web) (WIP)

Run emmake make CC=emcc.

If you want libsm64 standalone to call from JS (may not be that useful?), then run emcc dist/libsm64.so -o libsm64.js afterward to emit libsm64.wasm and libsm64.js.

Otherwise, dist/libsm64.so should be a compiled WebAssembly object that you can link into your own C project.

Make targets (all platforms)

  • make lib: (Default) Build the dist directory, containing the shared object or DLL and public-facing header.
  • make test: Builds the library dist directory as well as the test program.
  • make run: Build and run the SDL+OpenGL test program.
联系我们 contact @ memedata.com