(shouting)

LunaDLL/LunaLUA help thread

The second SMBX collab!
Kil
Posts: 13
Joined: 14 years ago

Re: LunaDLL help thread

Post by Kil »

No idea, but I'm guessing not really. Maybe you could try messing with player memory addresses that could stop them from sliding.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Kil wrote:NPCs can't trigger block trigger, because the way block trigger works right now is to collision check every single block in the level against demo's rectangle, and to do that with every single NPC in the level would almost certainly cause bigtime lag.
That seems very inefficient. Surely you only need to test those that are on screen at worst, and you could probably simplify it even more. Most collision engines that exist don't work by testing every single thing against every single other thing precisely because it's such an expensive thing to do. Usually, they'll narrow down what actually needs to be tested first, then do the more expensive operations on a bare minimum. In this case, you can discard any blocks that are off screen for testing against the player's hitbox immediately, then you can test the player's position relative to the section boundaries to further reduce the blocks you need to do accurate collision for. There's a system called "bounding boxes" which was built to help with this very system of narrowing down what needs detailed collision detection (though that system doesn't really help here because everything is using square hitboxes). There are better ways to do it than simply testing against everything that exists.
Image
Image
Image
Image
Image
Rixithechao
https://www.youtube.com/watch?v=BODxOghVmko
Posts: 1811
Joined: 10 years ago
First name: Mack
https://rixithechao.talkhaus.com/

Re: LunaDLL help thread

Post by Rixithechao »

Hoeloe wrote:
Kil wrote:Stuff
More stuff
I'm guessing it has to be that way because of how inefficiently SMBX is programmed or something? *shrug*
But yeah, if you can you should definitely narrow down the testing region to the player's/NPC's rectangle + a tiny bit over their max X and Y speeds.
Delightful Adventure Enhanced is out now!

Image

There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link

(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)


Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Rockythechao wrote:
Hoeloe wrote:
Kil wrote:Stuff
More stuff
I'm guessing it has to be that way because of how inefficiently SMBX is programmed or something? *shrug*
But yeah, if you can you should definitely narrow down the testing region to the player's/NPC's rectangle + a tiny bit over their max X and Y speeds.
It would, of course, but much easier to do efficiently if the blocks in the internal SMBX array were sorted sensibly. I don't believe this is the case, though, which makes things awkward, but there's always a way to improve over the brute force "test everything against every other thing".

It might be possible, for example, to create a second internal array which references the first, but sorted more sensibly. That way, blocks can be tested based on their position in the array, which is a lot faster. This does break down somewhat for moving and hidden layers, but it should be possible to determine, at any given point, which blocks are moving and which are hidden, and testing those separately, which is still cheaper than doing that for all blocks.
Image
Image
Image
Image
Image
Kil
Posts: 13
Joined: 14 years ago

Re: LunaDLL help thread

Post by Kil »

Hoeloe wrote:
Kil wrote:NPCs can't trigger block trigger, because the way block trigger works right now is to collision check every single block in the level against demo's rectangle, and to do that with every single NPC in the level would almost certainly cause bigtime lag.
That seems very inefficient. Surely you only need to test those that are on screen at worst, and you could probably simplify it even more. Most collision engines that exist don't work by testing every single thing against every single other thing precisely because it's such an expensive thing to do. Usually, they'll narrow down what actually needs to be tested first, then do the more expensive operations on a bare minimum. In this case, you can discard any blocks that are off screen for testing against the player's hitbox immediately, then you can test the player's position relative to the section boundaries to further reduce the blocks you need to do accurate collision for. There's a system called "bounding boxes" which was built to help with this very system of narrowing down what needs detailed collision detection (though that system doesn't really help here because everything is using square hitboxes). There are better ways to do it than simply testing against everything that exists.
You have to test the objects to see if they're on screen. That's what I'm saying. If you have 100 sprites and blocks, you're going to be doing at a minimum 100 x 100 tests of some kind, just to find what's eligible to be collided with. I already made a spatial partitioning system for csprites that doesn't do this but it's not hooked up to anything else yet.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Not if the blocks are sorted. If you know that every block beyond, say, the 100th in the array is to the right of that block, then you don't need to test any of those blocks.
Image
Image
Image
Image
Image
Rixithechao
https://www.youtube.com/watch?v=BODxOghVmko
Posts: 1811
Joined: 10 years ago
First name: Mack
https://rixithechao.talkhaus.com/

Re: LunaDLL help thread

Post by Rixithechao »

Also, multidimensional array. [section, block], [section, layer, block], etc.
Delightful Adventure Enhanced is out now!

Image

There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link

(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)


Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

Rockythechao wrote:Also, multidimensional array. [section, block], [section, layer, block], etc.
Fundamentally, there are a lot of ways you can represent the data that allow you to use facts about that representation to quickly reduce what you need to test. The method currently implemented is a brute force one because of the default SMBX block array, but it could be done faster if another way to reference the data existed, even if it's just another array containing the indices of the blocks in the SMBX array, which can be sorted at load time into something more useful for partitioning space.
Image
Image
Image
Image
Image
TiKi
Posts: 709
Joined: 10 years ago

Re: LunaDLL help thread

Post by TiKi »

Is it possible to:

1. Make an event happen when a boss is at a certain HP
2. Interrupt the player's death after a certain amount of frames has passed and transport them to coordinates, alive again?
Kil
Posts: 13
Joined: 14 years ago

Re: LunaDLL help thread

Post by Kil »

yes

1. Just read from the npc's hits memory
2. Just read from the player's death animation timer memory
DON'T PM me. Ask your question in the help thread so everyone can be answered.
TiKi
Posts: 709
Joined: 10 years ago

Re: LunaDLL help thread

Post by TiKi »

So I've been put in charge of some guy's project. It also has a modded exe, but it was from long ago, so it doesn't use lunadll. I was toying with not using lunadll of course, but I've decided the autoscroll is too invaluable because it makes airship levels WAY better. The other stuff doesn't hurt lol. So which is easier for you/me Kil?
A. Remake the mod's changes in a lunadll exe
B. Add lunadll to the mod exe

And before anyone accuses me of shoehorning it in, there are like 5 levels done, 2 or 3 of which I can use, and there's like 50 levels minimum in the project. So don't accuse me of shoehorning lunadll into a project that was fine without it, if anyone from SMBX.org is here.
LukasSMBX
Posts: 0
Joined: 10 years ago

Re: LunaDLL help thread

Post by LukasSMBX »

Is there a code that you keep being the legend of zelda fairy ? so if you get hidden you just keep being that fairy?
TiKi
Posts: 709
Joined: 10 years ago

Re: LunaDLL help thread

Post by TiKi »

So I've been

1. Using cheat engine on SMBX
2. Scanning double, unknown initial value without sonicstooslow
3. Compare last scan, rescan after I type the cheat

What am I doing wrong? There's always way too many results to sift through. Once 600+, then 3100+. I've been able to change health bars before in other games, so what's the deal?
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL help thread

Post by Willhart »

TiKi wrote:So I've been

1. Using cheat engine on SMBX
2. Scanning double, unknown initial value without sonicstooslow
3. Compare last scan, rescan after I type the cheat

What am I doing wrong? There's always way too many results to sift through. Once 600+, then 3100+. I've been able to change health bars before in other games, so what's the deal?
You could do something unrelated to the thing you are looking for, and then scan multiple times for any unchanged values. Most values will shift randomly, so you probably should to this after the steps 1-3.
TiKi
Posts: 709
Joined: 10 years ago

Re: LunaDLL help thread

Post by TiKi »

Hey Kil, could I please have a snippet that has a timer that subtracts one coin every 60 frames? Other than that this "super sonic mode" thing is going swimmingly :D
TiKi
Posts: 709
Joined: 10 years ago

Re: LunaDLL help thread

Post by TiKi »

Sorry for the double post.

Will it be possible to switch out a SMBX npc for a lunaDLL sprite... Even if it comes out of a block?
TiKi
Posts: 709
Joined: 10 years ago

Re: LunaDLL help thread

Post by TiKi »

Is there a "on npc memory" like OnPlayerMemory?
Kil
Posts: 13
Joined: 14 years ago

Re: LunaDLL help thread

Post by Kil »

Yeah. You can loop over all the NPCs in Lua.
DON'T PM me. Ask your question in the help thread so everyone can be answered.
User avatar
ztarwuff
What the heck is a flair and why am I being asked to write one for my profile?
Posts: 550
Joined: 10 years ago
Location: Within 2 miles of the Imperial Crypt of Napoleon III

Re: LunaDLL help thread

Post by ztarwuff »

I'm trying to get an action to trigger if a player lands on a specific type of block.

Code: Select all

#1
BlockTrigger,0,10,1,1001,0,0


#1001
TriggerSMBXEvent,0,0,0,0,1,UpStart

#END
This is the code, I've currently got. I actually wanted to use Block 447, because it was closer to the other blocks I wanted to use for the level but I've seen that the code works with 10, so I've tried using that instead. No luck. I've even copied code wholesale from Episode 1, modifying where required and still nothing.

Is it something to do with the values I set to 0? Does BlockTrigger only work for certain blocks? Any help would be greatly appreciated.
TiKi
Posts: 709
Joined: 10 years ago

Re: LunaDLL help thread

Post by TiKi »

Kil wrote:Yeah. You can loop over all the NPCs in Lua.
In auto code?
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Post by Hoeloe »

TiKi wrote:
Kil wrote:Yeah. You can loop over all the NPCs in Lua.
In auto code?
One of the many benefits Lua has over Autocode is the ability to loop effectively. I don't believe you can do it in Autocode.
Image
Image
Image
Image
Image
hacheipe399
Posts: 0
Joined: 9 years ago

Re: LunaDLL help thread

Post by hacheipe399 »

Hello! Is there a method to keep the power-up of the player permanently? ie: I have a leaf and I get hurt, but the player state is still the same...
User avatar
kitikami
Posts: 853
Joined: 10 years ago

Re: LunaDLL help thread

Post by kitikami »

This keeps the player's power-up constant even if you get hit. I think 4 is for the leaf, but you can set it to other power-ups if you want:

#0
PlayerMemSet,0,0x112,4,0,0,w

If you still want to have the player killable by enemies, you'll probably have to set up a separate death function, though, since I think that keeps the player more than one hit away from death (at least with Demo/Iris, I haven't tried it with the other characters). You could probably set up a variable that counts hits the player has taken and then activate the kill function when it reaches a certain number.
hacheipe399
Posts: 0
Joined: 9 years ago

Re: LunaDLL help thread

Post by hacheipe399 »

Well I made it, I used OnPlayerMem with 0x16 offset (number of hearts) < 2 to activate the event with the same action: PlayerMemSet.

Code: Select all

#1001
OnPlayerMem,0x16,2,2,1002,0,w

#1002
PlayerMemSet,0,0x112,1,0,0,w
Thank you!
User avatar
Willhart
Stalker, Doxxer, and Sexual Harasser
Banned
Posts: 2434
Joined: 13 years ago
Location: Finland

Re: LunaDLL help thread

Post by Willhart »

www.gamearchaeology.com is down. What does this mean for lunadll? I remember that some of the documentation was stored there.
Post Reply