Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Blender Client for LibSM64 (github.com/libsm64)
96 points by tosh on March 13, 2022 | hide | past | favorite | 5 comments


Cool to see this on HN, it's a project of mine. After the SM64 decomp team released their C source for SM64, I wanted a project I could do to become familiar with the SM64 codebase, so I decided to extract Mario into a library so he could be easily[1] dropped into arbitrary programs. libsm64-blender and libsm64-unity are examples I built for this library, but since Blender is used by people making SM64 ROM hacks, it turns out the blender plugin is actually quite useful to people.

[1] https://github.com/libsm64/libsm64/blob/master/src/libsm64.h


This is awesomely cool!

I'm very curious about how the physics in libsm64 relates to the original ROM code, if you happen to know. Based on my quick browse through the code, functions like "find_floor_from_list"[1] seem to be just exhaustively iterating through every triangle in the scene to see which one has the closest intersection point. But that couldn't possibly have been efficient enough to do real-time collision detection on an entire level using N64 hardware -- could it?

Did the original game use a more sophisticated data structure that was stubbed out in the library version? Or am I overestimating how slow the brute-force approach would be?

[1] https://github.com/libsm64/libsm64/blob/master/src/decomp/en...


From what I understand the original sm64 codebase is very inefficient. There's a ROM hacker by the name of Kaze that has spent more than a year completely rewriting the engine. With his new engine he can achieve up to 60 FPS on original Hardware. Is very impressive.


In the original game, triangles are bucketed in a grid perpendicular to gravity. So to do collision, you take Mario’s position on that plane, do a 2d array lookup into a bucket, and then iterate over the few triangles that touch that bucket.

In the library version I just cut that system out to make my life easier while refactoring that stuff, but it would certainly be nice to do something better than ripping over every triangle at some point.


Wow, this looks really helpful for designing new levels. Especially to ensure some place is reachable with a certain move (regular jump, long jump, triple jump, etc).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: