Perfect hitbox for Events and Player

Discussion in 'RGSS Script Requests' started by Andrea87Sky, Jun 2, 2019.

  1. Andrea87Sky

    Andrea87Sky Ah sh*t, here we go again. Veteran

    Messages:
    30
    Likes Received:
    1
    Location:
    Sicily
    First Language:
    Italian
    Primarily Uses:
    RMXP
    Hello, i'm searching a script that makes the hitbox of characters, events, player etc fully realistic by pixel per pixel.

    I mean something like this: https://cdn.discordapp.com/attachments/404764352785285120/584401661556949002/template.png

    The idea is to having a pefect hitbox that should be the exact sprite of the character's sprite, i don't know if the game can detect when a determined point of a sprite have a color and when the sprite don't have any (empty), but i'll ask anyway.

    That will be also useful for minigames like puzzles.

    This idea is also from a game called Undertale:
     
    #1
  2. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    11,575
    Likes Received:
    11,561
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    First of all, almost no game has a perfect hitbox, as the only way to do that is check every pixel the sprite takes up and see if every pixel of the object hits it. That gets really slow very fast. Even undertale (the game you reference) the hitboxes are not 100% pixel perfect, they use bounding boxes, which is the common approach as there is no other technique that is fast enough even on today's computers to detect a hitbox for every single pixel on the screen.

    If you want to see what I mean, for it to be pixel perfect a hit that only grazed the top of that heart where there is nothing shown would have to not count, and as far as I can tell it would count in undertale.

    Now, what I do think you mean is a request for a better hit box, to maybe say match a pixel movement script? That would be doable, and may already exist. But you may wish to clarify first.
     
    Last edited: Jun 2, 2019
    #2
    Heirukichi likes this.
  3. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,026
    Likes Received:
    376
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    What has been said is true, however, there are pixel movement scripts that allow you to set a custom hit-box for each character (event or not). You might want to take a look at GaryCXJk free movement script. I would not label it as "perfect", but I had to write a few compatibility script for that and I have to say that it does its job.

    Of course, using pixel movement scripts that screw up the grid also means that you have to handle events movement differently. If that script does not work for you, take a look at the master script list, you might have more luck there.
    If you have no luck there either, I am afraid you should commission somebody to write it for you. I am going to be honest here: a complete movement script with hit-boxes is not exactly a trivial matter, finding somebody willing to write that for free might be hard, especially considering the amount of people who are still willing to write scripts for VX Ace.
     
    #3
  4. Andrea87Sky

    Andrea87Sky Ah sh*t, here we go again. Veteran

    Messages:
    30
    Likes Received:
    1
    Location:
    Sicily
    First Language:
    Italian
    Primarily Uses:
    RMXP
    I know, I know, no games have a "perfect hitbox", but i wanted to ask anyway if it's possibile to do that.

    Umh yes, but i posted the post on RGSS Request Script, so I need a script for XP, not VX Ace. So sorry. :p

    And if this is the RGSS Request Script section, I hope if someone can make an hitbox system like that, maybe just modify it to make it compatible to XP, idk.
     
    #4
  5. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    11,575
    Likes Received:
    11,561
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    Fair enough. Only reason I mention what I did was I once was asked to code such a thing, and even after months of work the best it ran at was 11 seconds per frame. And no, that's not a typo, it was literally 11 seconds to draw each frame on the screen, even at it's peak (granted, this was also for a 3d engine, so it might be faster on a 2d engine, but not by too much). Now with raytracing graphics cards it might be doable soon on computer IF your game uses the GPU, and XP does not use the GPU at all.

    I have no idea if someone has made a better hit box script for XP though. Maybe try a search for event collision scripts and see what comes up?
     
    #5
  6. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,026
    Likes Received:
    376
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    Oh, my bad, I didn't notice the 3 at the end was missing. I don't know if there is any script with customizable hit-boxes for XP, but I am quite sure it does. XP has been around for quite a long time, and there are even pixel movement scripts that are compatible with both VX Ace and XP. Did you check the master script list? You might find a pixel movement script that has enough customization.
     
    #6

Share This Page