Collision Maps

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

collisionMaps1

This script allows you to replace your tile passage settings with a collision map. Collision maps are optional; a map can use the default tile passage settings. However, you can only choose between one or the other.

The collision map is straightforward: it is an image the size of your map. Anywhere that is colored red is cannot be passed. The collision map can be created in any image editor of your choice.

This is a very simple collision map and only supports two passage settings: Passable, not passable.

Download

Script – Demo

Required: CollisionMaps.dll

You might want to use the Collision Map Overlay to see the collision maps right on your screen

Installation

Place this below Materials and above Main.
Place CollisionMaps.dll inside your project’s System folder

Usage

Setting up Passage Settings

If you want a map to use a collision map, note-tag it with

<collision map>

It will automatically use the associated collision map.
Currently you are unable to specify or change which collision map is used.

Creating Collision Maps

To create your collision maps

  1. Take a mapshot of your map and open it in an image editor.
  2. Create a layer on top of your image, which will be your collision map
  3. Anywhere that is not passable will be red. Anywhere that is passable will be black.
  4. Save the collision map and place it in the Collision Maps folder with the appropriate filename

This tutorial describes how you can create collision maps using Graphics Gale.

Storing your Collision Maps

By default, the collision maps are stored in the following folder

Graphics/CollisionMaps

The name of each collision map matches the name of the map as follows

map001
map002

And so on. You can customize these in the configuration if needed.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

43 Responses

  1. Jackus says:

    Does this work in conjunction with a Pixel Movement script, to make Pixel Passability?

  2. Looping says:

    Hi,

    Found your script amazing. (exactly what i looked for) After a little adaptation, it works fine with RM-VX.

    Just a question, in the way your code is done, is it possible to add a third color to the collision map so that color means that the last sprite on the pile at this coordinates is a star tile (the player pass under the sprite).

    • Hime says:

      The way it is currently setup, it basically hardcodes it so that black is 0, and non-black is 1. It would be better if users can specify which colors will be assigned what number. I don't know how you would specify that the player will pass under a sprite though.

      • Looping says:

        Well, it's not a problem, your code is still very useful. By adding some parts to it i was able to use a second map for superposition. (It's under testing with RM VX)

        here is the rought code
        https://github.com/Hime-Works/Requests/issues/209

        • Hime says:

          I've moved the code to an external location because it really stretches the comments. Maybe you want to use a pastebin or something else?

          • Looping says:

            Thanks, after I posted, lokked for the edit button for a long time ^^.

            I don't know what is a pastebin… All i know is that, i want to control the blit order of sprites with an outside map.

          • Hime says:

            I think using a separate map is a good option. I don't know whether there is a way to control whether a sprite should be drawn over a particular map tile, or under it, with only a single map.

          • Looping says:

            Another question : In your .dll, the algorithm needs to detect if color or black for each 32×32 pixcel square.

            Is it possible to do this test on the pixcel in the middle of the square?

          • Hime says:

            It is not obvious from the documentation but in the configuration you will see a tile height and tile width option. The table already stores a pixel representation of the bitmap. It's just the width and height that controls how the lookups are made.

          • Looping says:

            So… if I put
            Tile_Width =5
            Tile_Height = 5
            the dll wil check a 5×5 pix square every 32 pix or every 5 pix?

          • Hime says:

            That depends on how your map grid is set up, which by default is 32×32. So if you have a script that makes you move 5 pixels per step, then a 5×5 setup will mean the collision lookups will check the appropriate coords in the table.

  3. Gary says:

    Hey Hime I’m Having trouble with collision maps its tell me runtime error load library : System/CollisionMap.dll on line 103 could u help me thanks.

    • Hime says:

      Did you download the dll and put it in that folder?

      • wverdese says:

        Hi Hime! I’m having the same problem! And I’m sure the file is in the right folder! Any suggestion? Thanks

        • Hime says:

          There are two System folders: Graphics/System and one in the project’s root folder. I can’t think of any reasons why it would have an error trying to load the library (unless it actually can’t load the library, instead of not being able to find it)

          • wverdese says:

            Hi Hime, thanks for the reply. 🙂

            Actually I’m pretty sure that is the right System folder (not the one in Graphics). It’s the one where RGSS301.dll is. And if i delete RGSS301.dll and start the game it crashes complaining about its absence, so I’m sure that’s my project’s folder.

            I was thinking of a problem in loading the library too. Some compatibility issue with the OS? I’m running on Win7 Ultimate x64, emulated on VMWare (I’m a Mac user).

          • Hime says:

            Hmm I’m not sure what the problem could be since I’ve never tried running RM in a VM. Maybe you can try posting it in one of the forums and see if someone else might have an idea what’s going on.

  4. oliopro says:

    Hmmm. I’ve been thinking about it a fair bit and I think I’ll figure it our for myself.

  5. oliopro says:

    I’m curious as to the actual function of the .dll is in this script?

    • Hime says:

      Load the image and populate a table with 1 or 0 depending on whether it is passable or not..

      • oliopro says:

        I’m thinking of doing something more complicated along these lines. Could you remake the .dll to instead give the rgb results at the pixel? I intend to use that value to allow you to also reference each individual value for different reasons. The idea was red would be passable(255)/not passable(0), green would be regions(intervals of 4) and blue would be custom (ie. void or cliff from victor pixel movement v1.3 or to activate a switch or event remotely).

  6. thomas says:

    Hi Tsukihime, great script as always.
    i wanna ask u about these collision map, it worked perfectly, but the collision placement seems miss a bit, sorry if i cant explain it better. when i place a box and add a collision map, the collision is missplaced, can u help me?

  7. jimfalcon says:

    Well, no pressure. Here and there I try getting into coding, and to me it seems super hard, it always goes over my head. So, thanks for your info.

  8. jimfalcon says:

    I heard that this game manage to implement pixel collision, but they haven’t responded to me yet, And they give no clue as to how to they accomplished it. http://rpgmaker.net/games/3082/images/38623/

  9. jimfalcon says:

    Hmm. Maybe you can help then. I’m using a parallax map, and the only way to give my player places to walk, is to lay down some transparent 32×32 tiles. I do have a pixel movment script… but…. is there another way to create places for my player to walk? I’m new to this still.

  10. jimfalcon says:

    Hmm I must be doing something wrong. I’m trying to use this with a parallax map i created. Do I have to name my custom map map001 as well as the collision map?

    • Hime says:

      The collision map should have the same name as your map name (eg: map001.png will be assigned to map 1). Note that this script doesn’t provide any pixel checking, so you will need another script to actually use pixel collisions. The original purpose of this script was just so you don’t need to rely on tiles for the collisions.

  11. jimfalcon says:

    Do I place the collisoin map .dll in my Windows/System folder? cant find a “system folder” in rpg maker’s folder.

  1. March 30, 2015

    […] Collision Maps […]

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax