VXAce Seeking a script to make transparent areas of a tile passable

New to the site, so please excuse any errors in requesting help on my project.

The project that I'm working on involves a particular scale. I don't want to commit to the proportions used in VX Ace's default sprites, so my pixel art doesn't fill out the full 32 x 32 tile. This means that there's a considerable amount of blank space on the sides, as shown here. This also affects the tiles for decorations, as shown with this video where I demonstrate how much space is between the player and this stool.

I wish to find a script that allows the game to simply treat all the transparent space as walkable. Ideally, what I'm looking for can co-exist with the engine's default collision options, so anything labeled with an X is still impassable with the exception of the blank space.

It's fairly difficult to put all of that into words that make it easy to Google. Just to rule out the possibilities, I will say that I looked into Victor Engine's Pixel Movement script, which seems to be able to assign a hitbox to Events - but I can't seem to get it to work and I find the method a bit clunky to begin with. I also came across a map collision script by Hime Works, but this isn't what I'm looking for either.

It'd be more convenient if there was some way to simply have a script that marks every transparent pixel as passable. - something that is automatically applied to the tiles without needing an Event to queue up a script command, you know? "If blank, then passable."

EDIT: It occurs to me that what I'm asking for will need to co-exist with Victor Engine's Pixel Movement, or a similar script. You can't have passable pixels without also having the ability to walk outside of the 32x32 grid. So, I suppose what I'm asking for is a script to compliment VE's script, or something that does both these things I'm looking for.

It should go without saying, but you'll definitely be credited for any help provided if a new script is needed for this. The game is still in early production but I am keeping extensive notes anytime I find a new resource to add to it.
Hello, I believe that a pixel-perfect collision system would not be a good idea as it can be performance heavy:
Instead of doing a simple check for rectangle hitboxes, you have to perform one for each "pixel" of your character in a direction (by pixel, I mean accuracy of a movement, a pixel with Victor's script is actually 4x4 pixels).

If you still want something like this, here is something I wrote:
Ruby:
#==============================================================================
# Tileset pixel collision
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 14/03/2026
# Requires:
# - Zeus81's bitmap export
# - Victor's Engine - Pixel Movement
#==============================================================================

$imported ||= {}
$imported["TIM-TilesetPixelCollision"] = true

#==============================================================================
# Description
#------------------------------------------------------------------------------
# Allows more accurate collisions of tilesets, similar to Hime's Collision map,
# it will use a picture associated to each tileset's picture such that
# red means the tile's pixel is passable while transparent means the tile's
# pixel isn't. This will only apply to tiles B-E that are impassable (X), other
# passability remains unchanged by the picture.
#
# Note that this script is not plug and play, you must design a collsion sheet
# for each tileset graphic file, this script can generate automatically a
# default collision sheet for each used tileset if you set Generate to true and
# uses Zeus81's bitmap export.
#==============================================================================
# Installation: put it below the required scripts, you must create a collision
# file for each tilesheet in your tileset folder (use Generate option to
# generate them quickly)
#==============================================================================
# Terms of use: free to use in any game, please give credit
#==============================================================================

#==============================================================================
# TIM::TilesetPixelCollision
#==============================================================================
module TIM
  module TilesetPixelCollision
    module Sheets
      Generate = false #set to true to make new collision sheets for each
                       #graphic tileset in your database. (slow process)
      Overwrite = false #if generate is true, do you want to overwrite former
                        #collision sheets?
                        
      SUFFIX = "_collision"
      FOLDER = "Collision/" #in Graphics/Tilesets
    end #Sheets
    
    #color generated for impassable pixels, passsable color is (0,0,0)
    IMPASSABLE_COLOR = Color.new(255,0,0)
    
    #--------------------------------------------------------------------------
    # collide_name -> name of the collision file associated to tileset graphic
    #--------------------------------------------------------------------------
    def self.collide_name(tilename)
      Sheets::FOLDER + tilename + Sheets::SUFFIX
    end
    
    #--------------------------------------------------------------------------
    # pixel_impassable? -> when generating collisions, what makes a color
    # impassable?
    #--------------------------------------------------------------------------
    def self.pixel_impassable?(color)
      color.alpha > 0
    end
    
    #--------------------------------------------------------------------------
    # passable? -> when checking the collision, what makes a color passable?
    #--------------------------------------------------------------------------
    def self.passable?(color)
      color.red == 0
    end
    
    PIXEL_STEP = 4 #accuracy of checks, based on Victor's script, do not change
  end #TilesetPixelCollision
end #TIM

#==============================================================================
# TIM::TilesetPixelCollision
#==============================================================================
module DataManager
  #--------------------------------------------------------------------------
  # alias method: load_database -> generates collide files when option is true
  #--------------------------------------------------------------------------
  class << self; alias tim_tpc_load_database load_database; end
  def self.load_database
    tim_tpc_load_database
    generate_tiles_collision if TIM::TilesetPixelCollision::Sheets::Generate
  end
 
  #--------------------------------------------------------------------------
  # new method: generate_tiles_collision
  #--------------------------------------------------------------------------
  def self.generate_tiles_collision
    handled_names = []
    dirname = "Graphics/Tilesets/"+TIM::TilesetPixelCollision::Sheets::FOLDER
    Dir.mkdir(dirname) unless FileTest.directory?(dirname)
    $data_tilesets.each do |t|
      next unless t
      5.upto(8) do |i|
        name = t.tileset_names[i]
        next if name.empty? || handled_names.include?(name)
        gen_tile_collision(name)
        handled_names.push(name)
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: gen_tile_collision
  #--------------------------------------------------------------------------
  def self.gen_tile_collision(tilename)
    puts "Gen Collision of " + tilename
    md = TIM::TilesetPixelCollision
    output = md.collide_name(tilename)
    bexist = true
    Cache.tileset(output) rescue bexist = false
    return if !md::Sheets::Overwrite && bexist
    puts "Make new one..."
    data = Cache.tileset(tilename)
    return unless data
    out = convert_to_collider(data)
    out.export("Graphics/Tilesets/" + output)
    out.dispose
    puts "done!"
  end
 
  #--------------------------------------------------------------------------
  # new method: convert_to_collider
  #--------------------------------------------------------------------------
  def self.convert_to_collider(tilesheet)
    out = Bitmap.new(tilesheet.width, tilesheet.height)
    0.upto(out.height-1) do |y|
      0.upto(out.width-1) do |x|
        c = tilesheet.get_pixel(x,y)
        next unless TIM::TilesetPixelCollision.pixel_impassable?(c)
        out.set_pixel(x,y,TIM::TilesetPixelCollision::IMPASSABLE_COLOR)
      end
    end
    return out
  end
end #DataManager

#==============================================================================
# Dir4
#==============================================================================
module Dir4
  #--------------------------------------------------------------------------
  # overwrite method: passable_tile?
  #--------------------------------------------------------------------------
  def self.dir_to_vec(d)
    d -= 1
    dx = (d % 3) - 1
    dy = 1 - (d / 3)
    return [dx, dy]
  end
end #Dir4

#==============================================================================
# Game_CharacterBase
#==============================================================================
class Game_CharacterBase
  PIXEL_STEP = TIM::TilesetPixelCollision::PIXEL_STEP
 
  #--------------------------------------------------------------------------
  # overwrite method: passable_tile? -> clearly performance heavy
  #--------------------------------------------------------------------------
  def passable_tile?(x, y, d)
    p = Dir4.dir_to_vec(d)
    l = []
    x2 = x + (1 - self.bw) / 2.0 #actual x corner of hitbox
    y2 = y + (1 - self.bh) / 2.0 #actual y corner of hitbox
    if p[0] > 0 #going right
      p[0] = 0 #fix to only check pixels right after
      steps = (self.bh * (32 / PIXEL_STEP)).to_i
      sx = x2 + self.bw
      l = 0.upto(steps - 1).map{|i| [sx, y2 + i * PIXEL_STEP / 32.0]}
    elsif p[0] < 0 #going left
      steps = (self.bh * (32 / PIXEL_STEP)).to_i
      l = 0.upto(steps - 1).map{|i| [x2, y2 + i * PIXEL_STEP / 32.0]}
    end
    if p[1] > 0 #going down
      p[1] = 0 #fix to only check pixels right after
      steps = (self.bw * (32 / PIXEL_STEP)).to_i
      sy = y2 + self.bh
      l += 0.upto(steps - 1).map{|i| [x2 + i * PIXEL_STEP / 32.0, sy]}
    elsif p[1] < 0 #goind up
      steps = (self.bw * (32 / PIXEL_STEP)).to_i
      l += 0.upto(steps - 1).map{|i| [x2 + i * PIXEL_STEP / 32.0, y2]}
    end
    #you must check all listed pixels
    l.all?{|pos| sub_pix_passable?(*pos, p, d)}
  end
 
  #--------------------------------------------------------------------------
  # new method: sub_pix_passable? -> perform passability check for position x,y
  # in float, p is the added coordinate based on d
  #--------------------------------------------------------------------------
  def sub_pix_passable?(x, y, p, d)
    px = (x * 32).to_i + p[0] * PIXEL_STEP
    py = (y * 32).to_i + p[1] * PIXEL_STEP
    nx = $game_map.round_x(px / 32.0)
    ny = $game_map.round_y(py / 32.0)
    x = $game_map.round_x(x)
    y = $game_map.round_y(y)
    return false unless $game_map.valid?(nx, ny)
    return true if @through || debug_through?
    return false unless pixel_map_passable?(x, y, d)
    return false unless pixel_map_passable?(nx, ny, reverse_dir(d))
    return true
  end
 
  #--------------------------------------------------------------------------
  # new method: pixel_map_passable? -> check if pixels at x,y (floats)
  # can be crossed
  #--------------------------------------------------------------------------
  def pixel_map_passable?(x, y, d)
    px = (x * 32).to_i % 32
    py = (y * 32).to_i % 32
    $game_map.tile_pixel_passable?(x.to_i, y.to_i, d, px, py)
  end
end #Game_CharacterBase

#==============================================================================
# Game_Player
#==============================================================================
class Game_Player
  #--------------------------------------------------------------------------
  # override method: pixel_map_passable? -> use the original method for vehicles
  #--------------------------------------------------------------------------
  def pixel_map_passable?(x, y, d)
    case @vehicle_type
    when :boat, :ship, :airship
      map_passable?(x.to_i, y.to_i, d)
    else
      super
    end
  end
end #Game_Player

#==============================================================================
# RPG::Tileset
#==============================================================================
class RPG::Tileset
  #--------------------------------------------------------------------------
  # new method: page_pixel_passable?
  #--------------------------------------------------------------------------
  def page_pixel_passable?(page_id, subtile_id, px, py)
    tilename = TIM::TilesetPixelCollision.collide_name(tileset_names[page_id])
    data = Cache.tileset(tilename)
    return true unless data
    x = subtile_x(subtile_id) + px
    y = subtile_y(subtile_id) + py
    c = data.get_pixel(x,y)
    TIM::TilesetPixelCollision.passable?(c)
  end
 
  #--------------------------------------------------------------------------
  # new method: subtile_x
  #--------------------------------------------------------------------------
  def subtile_x(subtile_id)
    tid = subtile_id % 128 #get one side
    x = (tid % 8) * 32
    x += (subtile_id / 128) * 8 * 32
  end
 
  #--------------------------------------------------------------------------
  # new method: subtile_y
  #--------------------------------------------------------------------------
  def subtile_y(subtile_id)
    tid = subtile_id % 128 #get one side
    y = (tid / 8) * 32
  end
 
  #--------------------------------------------------------------------------
  # new method: pixel_passable?
  #--------------------------------------------------------------------------
  def pixel_passable?(tile_id, px, py)
    return false if tile_id >= 1024
    page_pixel_passable?(5 + tile_id / 256, tile_id % 256, px, py)
  end
end #RPG::Tileset

#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # new method: tile_pixel_passable?
  #--------------------------------------------------------------------------
  #x, y are in map coordinates, d is a direction, px, py are pixel accuracy
  def tile_pixel_passable?(x, y, d, px, py)
    bit = (1 << (d / 2 - 1)) & 0x0f
    all_tiles(x, y).each do |tid|
      flag = tileset.flags[tid]
      next if flag & 0x10 != 0            # [☆]: No effect on passage
      return true  if flag & bit == 0     # [○] : Passable
      return false if flag & bit == bit && !tileset.pixel_passable?(tid, px, py)
    end
    return false                          # Impassable
  end
end #Game_Map

This script requires Victor's pixel movement script along with Zeus81's bitmap export:
For each tilesheet in B-E of your tilesets, you have to make a collision picture corresponding to the cells, each red pixel will be a collision while transparent ones won't collide (note that the actual collision pixels will be uper-left pixels from each 4x4 squares of pixels).
Here is an example of a collision based on tilesheet Inside_C:
Inside_C_collision.png


Collision sheets are stored by default in Graphics/Tilesets/Collision as originalname_collision.png
Zeus81's script comes in handy here because my script can automatically generate a collision sheet for your used tilesets in the project if you set the Generate option to true (it can take some time so please disable this unless you want to make new collision sheets).
This generation is pretty naïve as it takes any non-transparent pixel and make it red, so you have to modify pixel_impassable? method or edit the collision pictures afterwards.

So with this, a pixel is impassable if the tile is X in your tileset and the pixel in the collision picture is red. This only applies to B-E tiles, all tiles of A follow the original's script passability rules.

I'm honestly not good with pixel-perfect moves and stuff so my script might generates some clunky behaviors, I don't really plan on providing support but anyone can take a look at it and maybe improve the script!
Ahh I appreciate your contribution here - thank you! This just leaves the character sprites unchanged - would you be able to help with that as well or is that a bit more tricky to code for?
Ahh I appreciate your contribution here - thank you! This just leaves the character sprites unchanged - would you be able to help with that as well or is that a bit more tricky to code for?
That's tricky for two reasons:
-character sprites are changing frequently (based on direction or movement animation), so their hitbox would change too, right? It could create some issues I believe.
-when two characters meet, checking their passability would be costly (in performances) as it would need to check pixel by pixel their collision.

I think using the event tag:
<event size: x, y>
From Victor's script would be preferable here. If you need an offset (like a rectangle that would be more on the right/left etc.) I can make one but otherwise I don't think I would make a pixel-perfect character collision system.
So I did a bit of searching and found a different movement script that does address my concerns on the player hitbox, these are the results.

I found that the bitmap hitbox script by Zeus81 doesn't work at all with this one put into place, but I'm not sure if I wanna try to do anything about that just yet. I think it might be okay to just stop tinkering with this aspect of the game for now so I can make progress.

I wanna thank you for helping out, even if it feels I may not be proceeding with these scripts. I'm documenting all of the resources I'm trying out, regardless of whether I actually use them in the final game, so I am keeping the name Timtrack on hand.

I guess it's okay for this thread to be closed since the initial query has been addressed.

Original thread: https://forums.rpgmakerweb.com/threads/seeking-a-script-to-make-transparent-areas-of-a-tile-passable.182812/