3 ms·
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 thr
by teraflop 5y ago
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/engine/surface_collision.c https://github.com/libsm64/libsm64/blob/master/src/decomp/en...
- cylon13 5y agoIn 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.
- raidicy 5y agoFrom 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.