Jump to content

Overlay Maps: bringing layers back to Ace

Recommended Posts

This script allows you to create "overlay maps" on top of each other. In other words, map layering.


Overlay maps allow you to create much more visually attractive maps since you now have control over different "layers", though you are unable to walk from one layer to another. For now anyways.






Get it at Hime Works


Here is a demo: https://www.dropbox.com/sh/sz6mpw5n2d6zxi2/MhL6lunze4/Demo/Overlay Maps demo.zip


For overlay map zooming, get this add-on script.




Here are some tutorials that may be interesting



An overlay map is just another map, except it is drawn over your current map.

The overlay map comes with the following properties

  • It does not need to use the same tileset as your current map. This means you can merge multiple tilesets together in a single map


  • Events on the overlay map are processed in the current map, although you are still not able to reference events from different maps.


  • The player is unable to directly interact with the overlay map, or anything on the overlay map.


  • The player, however, can indirectly interact with events on the overlay map by setting switches or variables that will trigger the events.


  • To transfer between layers, you must use player transfer events


  • Map layers can re-use each other, so if one map uses another map as the top layer, then that map can use the previous map as the bottom layer


  • Each layer has its own screen effects



You can have an unlimited number of overlay maps, but note that having many map overlays will cause a significant drop in performance.




Create your maps as usual, taking into consideration how you want to layer them.


You might separate your maps into "floor" and "ceiling" or "floor, walls, ceiling", depending on how you like to organize things.

Note that because maps and overlay maps cannot interact with each other, all events on each overlay map are effectively bound to their own overlay map.


There are two types of note-tags: compact, and extended. The compact note-tag is short and easy to type, but the extended note-tag is probably better for organization.


Note that because maps and overlay maps cannot interact with each other, all events on each overlay map are effectively bound to their own overlay map.


To assign overlay maps to a map, tag the map with either



<overlay map: map order ox oy scroll_rate sync zoom>

<overlay map>
map: x
order: x
offset: ox oy
scrollrate: x
sync: 0/1
zoom: x 
opacity: x
</overlay map>
The map is the ID of the map that will be drawn as an overlay.

The order determines whether it will be drawn above or below the current map.

If it is negative, then it will be drawn under.

If it is positive, then it will be drawn over.

If it is not specified, then it assumes to be over, in the order that the

tags are specified.


ox and oy determine the offset of the origin. By default, the map's origin

is drawn at (ox = 0, oy = 0), but you can change this if necessary.

The x-value specifies the horizontal offset. Positive values shift it to the

right, while negative values shift it to the left.


The y-value specifies the vertical offset. Positive values shift it down,

while negative values shift it up.


The scroll rate specifies how fast the overlay map scrolls per step taken.

The default scroll rate is 32, which means it will scroll

32 pixels per move, or basically one tile. Higher scroll rates mean the

overlay map will scroll faster for each step you take, while slower scroll

rates results in less scrolling for each step you take.


Sync specifies whether the overlay map is synchronized with the current

map. This means that any screen effects such as shaking or weather will affect

the overlay map as well.

0 = not synchronized

1 = synchronized


The zoom value is a special option if you have installed the Overlay Map Zoom

script. Refer to that script for more details.


The opacity value specifies the opacity of the overlay map.




You can have multiple overlay maps by simply adding more tags. Note that the order they are drawn depends on the order you tag them.

Edited by Tsukihime

Share this post

Link to post
Share on other sites

So I am assuming that if you are not able to walk on mulitple layers yet that that is spesifically meaning that you cant have an event like guards on the walls of the castle while you are on the bottom layer?

Share this post

Link to post
Share on other sites

You can have guards on the other layers. It just means you can't talk to them directly because you can't travel between layers directly (you need to use map transfers to transfer between layers).


If you look at the first picture at the top, you can see there's a cat and a dog on the tiles above the player. It does not really demonstrate depth because...well, I don't know how to do that, so I put the party under the cat.


Speaking of transferring between layers, I have implemented layer ordering.


In the note-tag, you can specify a second number to indicate the order that they should be layered.

The current map is given an order of 0.

<overlay map: 2 -1> # draw map 2 one layer below the current map
<overlay map: 4 1>  # draw map 4 one layer above the current map
<overlay map: 6 -3> # draw map 6 three layers below the current map
You can use the layer order to determine which goes above and which goes below.

This is useful because a single map could be composed of many layers, and you could transfer to different layers at different times while simply re-using different layers for the overlays.


Also note that because event locations may have changed during the game, it is especially important to be able to synchronize different maps together, otherwise you will end up with consistency issues. By re-using maps, you avoid running into this issue altogether.

Edited by Tsukihime

Share this post

Link to post
Share on other sites

I have implemented a feature called "scroll rate" for overlay maps.

The scroll rate allows you to control how many pixels will be scrolled, for each move that you make.


To specify a scroll rate, you enter a third number for the note-tag

<overlay map: 1 1>       # draw map 1 one layer above with default scroll rate (32)
<overlay map: 2 -1 16>   # draw map 2 one layer under with a scroll rate of 16
<overlay map: 5 1 48>    # draw map 5 one layer above with a scroll rate of 48
By default, the tiles are 32x32 pixels, and each step you walk will scroll the map by one tile.

If you have a higher scroll rate, your overlay map will shift faster than your current map.

Similarly, if you have a slower scroll rate, your overlap map will shift slower than your current map.


This allows you to create perceptions of speed or depth: objects that are closer to you tend to be bigger and scroll faster, while objects that are further than you tend to be smaller and scroll slower. Or something like that.


Here's an example where I am on a sky island above a sky city. The overlay map is the city below, and it is scrolling much slower than the island




For every step that I take, the city scrolls only 8 pixels, or 1/4 the scroll rate of the current map.




It provides a unique map traveling experience, when one layer is moving at a different rate from another layer.

Edited by Tsukihime

Share this post

Link to post
Share on other sites

Overlay offsets have been implemented.


In addition to the scroll rate and layer order, you can specify an ox and oy to determine where the origin of the overlay map should be.


I have determined that offset is more important than scroll rate, and so have changed the order of the arguments in the note-tag


It is in tile coordinates, where (x=0,y=0) is the upper-left corner of the map.

The x-value will shift it horizontally. Negative x values shift it left, while positive x values shift it right.

The y-value will shift it vertically. Negative y-values shift it up, while positive y-values shift it down.

<overlay map: 2 -1 -10 -15 16>
This will draw map 2 one layer below the current map, shifted to the left by 10 tiles, shifted up by 15 tiles, with a scroll rate of 16.

Share this post

Link to post
Share on other sites

One major bug fix, one update. Well, several updates. See the change log.


First, I have implemented proper overlay map looping. This means that if your overlay map is smaller than the current map, it will not automatically spill over and loop itself.


Now your maps will loop (or not loop) as you would expect.

An example of what I mean:


Here's my sky city with sky island overlay, without proper loop checking, you can see that the map repeats itself.




And here it is with loop checking implemented. The map is only drawn once.




Second, I have added an option called "map synchronization".

This allows you to specify whether the overlay map will "share" the screen of your current map or not.


For example, if the current map is shaking, you may or may not want the overlays to shake as well. If the overlays are supposed to be a part of your current map, then you would want it to shake with your map. By synchronizing the overlays with your map, you won't have any strange issues where your map is shaking, but the overlay is not.


The note-tag has been updated as follows

<overlay map: map_id order offset_x offset_y scroll_rate sync>
If sync is 0, then the overlay map is not synchronized with the current map.

If it is 1, then it is synchronized.


By default, all overlay maps are sync'd.

Share this post

Link to post
Share on other sites

Just an update on what I have been doing to this script


I've figured out how MGC's map zoom works and am working to integrate it with the overlay maps.

It is not possible to just take MGC's script and use it because it assumes all maps have the same zoom rate.


The overlay maps will come with a zoom option which you can set in the note-tag.

Each overlay map will thus have its own zoom value.


Here is an example of zooming in action, where the party is currently on Sky Island, and Sky City can be seen below.



Share this post

Link to post
Share on other sites

I really like this idea.  It adds a lot more depth and impact to regular mapping.  I would like to use this script, but before I download it I would like to ask one minor question.


Is it possible to change the transparency of maps above or below?  There are some situations where I feel this would be useful.


If not, it's something to consider and either way this is and impressive script you have developed.  Kudos to you.

Share this post

Link to post
Share on other sites

That is a good idea.

I have investigated the transparency issue and have implemented it.


The updated script now supports overlay map opacities as an option. It is only supported in the extended note-tag



Share this post

Link to post
Share on other sites

If your overlay map uses a different tileset, then any event graphics on that overlay map won't match since Sprite_Character#tileset_bitmap still uses $game_map.tileset instead of the overlay map's tileset.


A quick fix could be to

Add to Overlay_Maps:


class Sprite_OverlayCharacter < Sprite_Character
  def initialize(map, viewport, character = nil)
    @map = map
    super(viewport, character)
  def tileset_bitmap(tile_id)
    Cache.tileset(@map.tileset.tileset_names[5 + tile_id / 256])

And in Overlay_Maps Replace:

  def create_characters
    @character_sprites = []
    @map.events.values.each do |event|
      @character_sprites.push(Sprite_Character.new(@viewport1, event))
    @map.vehicles.each do |vehicle|
      @character_sprites.push(Sprite_Character.new(@viewport1, vehicle))


  def create_characters
    @character_sprites = []
    @map.events.values.each do |event|
      @character_sprites.push(Sprite_OverlayCharacter.new(@map, @viewport1, event))
    @map.vehicles.each do |vehicle|
      @character_sprites.push(Sprite_OverlayCharacter.new(@map, @viewport1, vehicle))
Edited by FiXato

Share this post

Link to post
Share on other sites

FYI, I wasn't able to get parallax backgrounds, balloon icon events or show picture events from the overlay map to show up in the current map. I think the only things that carry over are the stuff painted using real actual tilesets, and certain types of events.

Edited by posfan12

Share this post

Link to post
Share on other sites

Say im using a map with a scrollrate, if i have an action script that enables Me to jump and regions (holes) in my top layer i can jump into, the region records player location and does the transfer to the map below. How would i have to change the player x,y to compensate for the map below that has scrolled? So player location is correct when he lands on the layer below? Thanks for a rly cool script!

Share this post

Link to post
Share on other sites

Aah I didn't mean to confuse you by using the word region. No. I was merely asking if there was a simple way to translate the player x and y on current map to the correct location on the map below. So you could technically fall through map 1 to map 2 at certain places and would still end up at the proper location. I don't want to hardcode it, id very much like a system for it that I can use and reuse easily. 


Another unrelated question. 

Can I have different scrollrates for more than one layer of maps? I have this in the notes for map 77: 

<tile lock parallax>
    <overlay map>
      map: 78
      order: -1
      scrollrate: 64
      sync: 0
      opacity: 255
    </overlay map>
    <overlay map>
      map: 79
      order: -2
      scrollrate: 128
      sync: 0
      opacity: 255
    </overlay map>

But they don't seem to scroll differently for me o_O
Am I writing something wrong?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

Top ArrowTop Arrow Highlighted