WohlSoft / Moondust-Project

Moondust Project by Wohlstand
https://wohlsoft.ru/projects/Moondust/
GNU General Public License v3.0
250 stars 39 forks source link

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

Open Wohlstand opened 4 years ago

Wohlstand commented 4 years ago

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

Alucard648 commented 4 years ago

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.

Wohlstand commented 4 years ago

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

Wohlstand commented 4 years ago

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