Moondust-Project icon indicating copy to clipboard operation
Moondust-Project copied to clipboard

[Engine] NPCs should have a "safe zone" of their hitbox

Open Wohlstand opened this issue 5 years ago • 4 comments

Recently, LxXzit did a small research and he has found that in Vanilla SMBX 1.3, NPCs having a safe zone which allows stomp them safer in a condition to not touching a side lower than 10 pixels (I guess, it may be a different scale in dependence from every NPC).

Here is a quote of research (formatted as a bug report for SMBX 38A):

I always felt like there was something wrong with "Small hitboxes", so today I checked and found it. The hurtzone of the NPCs is OK, but its "stomp" zone isn't.

Look at this image (38A 1.4.5): Honeycam-2019-12-29-16-38-50 Now look at this one (1.3): Honeycam-2019-12-29-16-37-51

Both have the same hurtzone, but in the first image the player doesn't stomp on the goomba and gets damage. The hitbox should be like this:

Green: "Stomp zone". The player can stomp the enemy at any part of this hitbox, it's not exclusively always from the top. (Height: 10px) Pink: Hurt zone

goomba

The original topic link: https://wohlsoft.ru/forum/viewtopic.php?f=64&p=19538

Wohlstand avatar Jan 01 '20 23:01 Wohlstand

This report has inspired another idea: Multiple Hitboxes per character, both player and NPC. Besides resolving stomping "safe zone" issue, this method can be used for other purposes, like advanced NPC physics, directional shields (hello, Buzzy Helmet!), headshot detecting etc.

Alucard648 avatar Jan 02 '20 05:01 Alucard648

Yeah, I think same: while one main hitbox means a physical collision, any extra hitboxes will be affectable via game logic.

Wohlstand avatar Jan 02 '20 09:01 Wohlstand

I guess, about jumping on NPCs, it works because it uses the "Easy-mode collision" call here: https://github.com/WohlSoft/smbx-experiments/blob/research/modCollision.bas#L115

Wohlstand avatar Feb 19 '20 10:02 Wohlstand