Pages: 1
Posted on 07-05-13, 10:35 pm (rev. 1 by ImageBot on 11-21-16, 02:35 am)


Karma: 228
Posts: 14/22
Since: 10-18-12
So desmume supports Lua script (basically for making TAS videos). I have used it before to output bounding boxes in a few games to understand how they are working internally.

As you all know, NSMB has some very well written collision detection systems (allowing enemies to walk on platforms is one example). While talking to Treeki about how NSMBW worked with collision, he showed me some very interesting output from Newer, that could answer alot of how NSMB dealt with collision.
So I did a Lua script and he kept adding all kinds of cool stuff.
Now we got output that you all can monitor, test, and learn from:






From this script you can learn that Paragoombas, when being wingless, have ceiling collision detection, where normal Goombas don't. That tells us that wingless Paragoombas are not just Goombas but special Goombas. There is more to be seen, so grab the script and have fun!

Install desmume 0.9.9 and then download lua51.dll and lua5.1.dll from the "LuaBinaries 5.1.4 - Release 2" package at http://luabinaries.sourceforge.net/download.html
Then run the script from the menu Tools->Lua Scripting->New Lua Script Window...

And here is the script:
http://www.logotypes.se/tmp/Mario/nsmbds_out.lua

Credits to Treeki for his extreme knowledge of NSMB


One note: NSMBDS runs the game 3 frames ahead of the actual output on the screen. This makes it very complicated to output the information at the same time as it is being displayed. I wrote a frame queued cache system that remembers each data for any number of frames in the past that you choose, or 3 that is default. Now, the more frames you add, the more space the script will take up, making it slower and heavier. There are other settings available that can be changed, like turning off certain output to make things clearer, or change the colors of collision info.
Posted on 07-06-13, 07:56 am
Birdo


Karma: 2754
Posts: 579/2091
Since: 06-26-11
This is quite cool. Is there anything interesting you think I should try out?
Posted on 07-06-13, 08:11 am


Karma: 228
Posts: 15/22
Since: 10-18-12
Well I am quite interested in finding the level that has those expanding mushrooms. I have been searching all over the worlds for it but can't seem to find them.
They are more advanced than the ones in NSMBW because they move slightly upwards during contraction, where in NSMBW they are on the same level. I want to see what the platform really does.
Posted on 07-06-13, 10:13 am
Super Mario
( ͡° ͜ʖ ͡°)

Karma: 9979
Posts: 3505/4456
Since: 06-08-11
The level is 5-A.

I think them getting slightly thicker/higher is just graphical, the platform will probably stay the same.

Also are you really sure of the 3-frames in advance thing? Its very weird. I know that objects have stored the position of the current frame and the previous one. I can see that giving two (one?) frames of delay... But not three lol. Maybe the third one comes from the 3d swap buffers thing. Are you sure it isn't a desmume or lua glitch?

BTW this script is awesomeness. Thanks a lot for it, I can see it being very useful when debugging custom sprites in the future.
Posted on 07-06-13, 12:40 pm
☭ coffee and cream


Karma: 10398
Posts: 1027/2766
Since: 06-26-11
Nice!

Just tried it, and for some reason it's not displaying the hitboxes. Did I miss something?
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 07-06-13, 01:20 pm (rev. 1 by  Hiccup on 07-21-14, 02:10 pm)
Birdo


Karma: 2754
Posts: 580/2091
Since: 06-26-11
I used the 32 bit Windows version of DeSmuME and lua on windows 8, if it helps.
It works for me.
I might make a video of it (including the setup).
Posted on 07-06-13, 02:39 pm


Karma: 228
Posts: 16/22
Since: 10-18-12
Posted by Dirbaio
The level is 5-A.

I think them getting slightly thicker/higher is just graphical, the platform will probably stay the same.

Also are you really sure of the 3-frames in advance thing? ... 3d swap buffers thing. Are you sure it isn't a desmume or lua glitch?

Thanks for the level number! Yes they were only graphics changes, and not platform movement. I remembered incorrectly.

When I searched for the correct frame, I frame-advanced in desmume (pressing n key), and the position of objects were first changed in frame 1, then updated in OAM in frame 2 (Tools->View OAM), and finally shown on screen in frame 3. Might be a desmume emulator bug or design error. The script allows us to change the number of frames from 3 to any number by changing the variable NUM_FRAMES_OBJ.
Posted on 07-06-13, 05:23 pm (rev. 2 by  Arisotura on 07-06-13, 06:10 pm)
☭ coffee and cream


Karma: 10398
Posts: 1030/2766
Since: 06-26-11
Posted by Mega-Mario
Just tried it, and for some reason it's not displaying the hitboxes. Did I miss something?


It would really help me if I could get that working. I'm messing with custom sprites and I'd want to be able to interact with a custom sprite and such...

Edit- wait, it works fine with a vanilla ROM, but not with my hacked one. Shit.

Edit2- it doesn't work with ASM hacked ROMs because the camera structures aren't at the same place in RAM. I made a fix for that: http://pastie.org/8116138
_________________________
Kuribo64 - RH-fucking-cafe - Kafuka

zrghij
Posted on 07-06-13, 07:40 pm


Karma: 228
Posts: 17/22
Since: 10-18-12
Posted by Mega-Mario
Posted by Mega-Mario
Just tried it, and for some reason it's not displaying the hitboxes. Did I miss something?


It would really help me if I could get that working. I'm messing with custom sprites and I'd want to be able to interact with a custom sprite and such...

Edit- wait, it works fine with a vanilla ROM, but not with my hacked one. Shit.

Edit2- it doesn't work with ASM hacked ROMs because the camera structures aren't at the same place in RAM. I made a fix for that: http://pastie.org/8116138


I still don't know what camera values are used to output sprites (OAM) on the screen. I am very interested in actually using the values that the sprites are used, as that would give a more "true" result, other than reading the camera's position, as the camera object might be located somewhere else if spawned behind bigger/smaller objects.
There were several camera values in RAM (some being close to the zoom factor), but none of them gave any good output (scrolling looked messy), and none of them were used for the OAM placement.

So basically I don't know how the camera's position ends up being used to scroll BGs, output 3D models, and output OAM.
Maybe the camera is found from the player that it follows, kinda like Player::GetPlayerPtr(player_number)->GetCameraPtr() or something similar?
Posted on 01-18-14, 06:06 pm (rev. 1 by ImageBot on 11-21-16, 02:40 am)


Karma: 228
Posts: 18/22
Since: 10-18-12
Posted by Powerline
Collision Info Viewer now supports vertical and horizontal trapezoids:


That is collision hit detection that is not rectangular or round.

And here is the script:
http://www.logotypes.se/tmp/Mario/nsmbds_out.lua
Posted on 05-23-18, 11:58 pm (rev. 1 by  skawo on 05-24-18, 12:00 am)


Karma: 19752
Posts: 1077/1100
Since: 04-02-13
StapleButter's fix for hacked roms died, so here's a re-fix:

https://pastebin.com/z1YZQ1j3
Pages: 1