Collision Maps

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.


Note that this script only overrides the passage settings for a tile: all other tile settings (such as the * tile behavior) are preserved.





Download


Get it at Hime Works!
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I hope this can be made to work with the default (for the star passability and the other passability options like the directionals)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
This is just a prototype I quickly threw something together in hopes that someone will see it and go "ooh that is really easy I can make it better"


In fact it does not work with victor's pixel movement, though I am not too sure why.


For the script to be actually usable, that pixel checking function will need to be written in something faster than Ruby. At least, the way I have designed it you just need to load the passage settings once and all of it is cached.


At some point, I will add the ability to change the collision settings using script calls, so you can basically change the passage settings of each and every tile without actually swapping the tiles.


This script's goal is to separate passage settings from the tiles themselves.


EDIT: figured out why it doesn't work for victor's pixel movement: there are floats instead of integers.


So rather than just treating each pixel as a single (x,y) coordinate, it uses some strange mapping from tile coordinates to...some partial tile coordinates.
 
Last edited by a moderator:

djDarkX

Retro & Remastered Music Guru
Veteran
Joined
Jan 17, 2013
Messages
2,700
Reaction score
1,901
First Language
Music
Primarily Uses
RMMV
LOL!  Nice work.  Looks like me mentioning it in that other thread didn't fall on deaf ears. xD
 

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
Will you be making this compatible with victors now that you know what to do?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Will you be making this compatible with victors now that you know what to do?
I've tried a couple things, like multiplying each floating point value by 32 to get the pixel coordinates, but the pixel movement script does not seem to like it when I do that...


Not really sure if it's because my script is bugged or something else.
 
Joined
Apr 1, 2013
Messages
191
Reaction score
71
First Language
English
Primarily Uses
RMMV
I hope you're able to get it working with pixel movement... They'd be a great combination! TuT
 

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
victors pixel movement goes by every 4 pixels in case that helps, so the events movement can only be divided up to 8.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
victors pixel movement goes by every 4 pixels in case that helps, so the events movement can only be divided up to 8.
You're right, I just looked at the round_x methods and they're changing by 0.125 instead of 1.


One problem I'm having is the actual hit collision check: rather than checking whether the sprite collides with any red pixel on the collision map, I'm checking whether the character's position collides...which isn't right because your sprite is much bigger than one pixel (so you could literally walk halfway into a tree before you stop moving)


This may be related to why I'm unable to get it to work with the pixel movement script.


I'm not sure how to solve this.


The collision map script's only purpose is to allow you to create collision maps and load them into the game. It's not supposed to provide collision check functionality as that is specific to how your movement works.
 
Last edited by a moderator:

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
I know his script also allows an event to have a specific size depending on the comment call <event size: x y> inside the appropriate page, perhaps whatever method he uses to check the players collision and the events collision may help? The default for the collision of the event is also the size of the sprite.
 

ShadowFox

Adventurer
Member
Joined
Mar 13, 2012
Messages
255
Reaction score
10
First Language
English
Primarily Uses
I'm curious, can this script allow the player to move behind walls and buildings as well walk through hidden passage ways and be hidden by the correct tileset?
 

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
I believe this script only deals with walk passability, the over and under tiles would still be governed normally through the default scripts.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
actually, via the first statement, you need to choose between either this or the default...

Collision maps are optional; a map can use the default tile passage settings. However, you can only choose between one or the other.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
ShadowFox brings up a good question.

I'm curious, can this script allow the player to move behind walls and buildings as well walk through hidden passage ways and be hidden by the correct tileset?
Yes. In fact, you can set ALL your tiles to * and then use a collision map to specify where you can or cannot pass. Then you can be hidden behind ANY tile you want.


Ok, the editor prevents you from doing that by preventing you from setting auto-tiles to * passage, but we can always get around that by writing another script that specifies visual layering.

I know his script also allows an event to have a specific size depending on the comment call <event size: x y> inside the appropriate page, perhaps whatever method he uses to check the players collision and the events collision may help? The default for the collision of the event is also the size of the sprite.
I'll have to look into that at some point.


However I will leave that to a separate script for actual collision checks.

actually, via the first statement, you need to choose between either this or the default...
That statement only applies to passage settings, and not all tile settings.


You can still set it to O, X, or * and the graphics will still behave as usual.
 
Last edited by a moderator:

ShadowFox

Adventurer
Member
Joined
Mar 13, 2012
Messages
255
Reaction score
10
First Language
English
Primarily Uses
I see. Would love to have a demo of this script as it sounds very interesting.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I have updated the script.


The collision map creation is now done in a dll function so it should be faster.


For extremely large maps, you will still notice delay (for example, a 100x100 map takes me an extra 0.02 seconds to load, which is obviously slower than immediate)


Currently there is no "padding" done, so if you are working with 32x32 tiles, you must make sure that you are aligned to a 32x32 grid. If you partially color a tile, you will find that it is still passable.


I will figure out how to sample the tile at a later date.


I have also added a demo.
 
Last edited by a moderator:

Erojiji

none
Veteran
Joined
Mar 17, 2012
Messages
33
Reaction score
32
First Language
Indonesia
Primarily Uses
Wow, this is script I looking for, btw it is possible to reduce the collusion smaller than 32x32 tile?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
The collision map already supports pixel collision checks (1x1 in size), however it doesn't provide any functionality for the actual collision checks as the purpose of this script is to load the collision map.


You will need to look for another script that will provide the appropriate collision checking.
 
Last edited by a moderator:

Erojiji

none
Veteran
Joined
Mar 17, 2012
Messages
33
Reaction score
32
First Language
Indonesia
Primarily Uses
Ah, so I need another script, okay thanks for the information =w=/
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top