Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Map screenshot VXA
Tsukihime
post Apr 27 2012, 02:29 PM
Post #1


Level 25
Group Icon

Group: Revolutionary
Posts: 559
Type: None
RM Skill: Undisclosed
Rev Points: 25




Here is a map screenshot script in progress.
The script allows you to create a bitmap that contains an image of some map. You can then do something with the image like maybe showing it on the screen, or you can export it, or other things you can do with a bitmap.

The following base features are planned to be supported

-draw layer 0 (autotiles) Not done
-draw layer 1 (autotiles) Not done
-draw layer 2 (the tiles on top of the autotiles) Done
-draw sprites (events, vehicles, characters) Done
-map scaling (all tiles will be scaled by a constant factor) Done
-drawing arbitrary maps by ID (draw_map(1) would draw the map with map_id = 1) Done

Additional options can be added, all of which interact with tiles
-damage tile highlighting
-region coloring
-...

Uses the png export from the map saver though I would prefer bmp export since it should be faster.

The script is still very inefficient (loop through every tile multiple times) and not suitable for generating images at run-time if you need previews for whatever reason. Needs to be optimized.

Looking for some help with retrieving the correct auto-tile so that I can draw it on the image.

Link to script: http://db.tt/0XSfT2iz

EDIT: ya, I would prefer bmp export. It takes less than 0.05 seconds to process all of the layer 2 tiles on a 39x48 map, but the export takes another 5-6 seconds.

A 100x100 map with nothing on it took only 0.3 seconds to read, but exporting took like a minute.

This post has been edited by Tsukihime: Apr 27 2012, 10:24 PM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
Tsukihime
post Apr 27 2012, 08:27 PM
Post #2


Level 25
Group Icon

Group: Revolutionary
Posts: 559
Type: None
RM Skill: Undisclosed
Rev Points: 25




Some research on how the tilesets are parsed. If anyone has already written a detailed tutorial on this (cause I'm sure some people want to create their own auto-tiles for VX or VXA), post the link.

It looks like each autotile layer (A1 through A5) have to be dealt with individually.



These are the numbers for A1, corresponding to the tile ID.
tile ID 0 are the 3 blocks in the top-left.
tile ID 1 is the 3 blocks just below that.

tile ID 2 is the single block.
Same with tile ID 3.

When I say "block", I mean the group of tiles that are associated with a single tile ID.

You can see that it goes top-down left-right
But then the other 3 quadrants are left-right top-down.

Like what? Why did they decide to even order it like this? Is there a nice formula that you can use to determine the coords? Doesn't seem like it. At the very least, we can at least hardcode each case, so if you see autotile ID 0, then it's (0, 0), while autotile ID 1 is (0, 96).

Would've been so much easier if I could just check whether it's even or odd. Well, I guess I could; I just have to check whether it's 0-3 or 4-15 just to separate the outlier.

I guess that's what I'll be doing to at least get a working implementation of the script.

The tile ids are fortunately cumulative, but...

CODE
A1 => 0 to 15
A2 => 16 to 47
A3 => 48 to 79
A4 => 80 to 119
A5 => 120 to ???


The fact that each layer has different number of tiles makes it more annoying.

I also have no idea how the layer 0 and layer 1 tile id's are assigned.
Layer 0 is the very bottom tile.
Layer 1 is the tile that is used just above it. So for example, tile ID 1 looks like it's got a bunch of transparent parts, but it actually uses tile ID 0 for layer 0 and tile ID 1 for layer 1.

Is it hardcoded?

For A2, I'm glad it is much more reasonable.
No silly random outlier to make things complicated.



Each block is 64x96, and the row/column is determined by the tile id. So A2 is easy to draw.

Similarly, A3 also uses a sequential order, with 64x64 blocks.

A4 is also sequential, but the block sizes are different.
Every odd row (1, 3, 5, 7), the block sizes are 64x96
Every even row (2, 4, 6, 8), the block sizes are 64x64

A5 has id's less than 2048.
The first one starts with 1536.
The last one is 1663

So the algorithm for map-drawing is roughly

QUOTE
Draw layer 0 tiles. Use auto-tile ID'ing to check which tileset it is. If it's less than 2048, then run some other formula to check which A5 tile it is.

Draw layer 1 tiles. Use auto-tile ID'ing to check which tileset it is. If it's less than 2048, then run some other formula to check which A5 tile it is.

Draw layer 2 tiles. Use tile formula to determine which tileset it is.

Draw sprites. Use sprite formula along with name and index to determine which character sheet to use.


For auto-tiles, determine which tileset is used (A1 to A5) and then for each category, run its own formula based on the dimensions given to determine where the origin should be.

The last problem now is the fact that auto-tiles behave differently depending on adjacent tiles. Don't know how it checks for this.

....

It might be useful to know how tilesets B through E are arranged as well.
Even if the id's go from 0 to 255, 256 to 511, etc (256 icons per sheet), it is not arranged left-right top-bottom.

Instead, they decided to go

CODE
0 1 2 3 4 5 6 7 128 129 130 ...
8 9 ...


Probably cause they wanted to have 8 icons per row and also wanted to have a 512x512 sheet...?
Well, that is only a minor issue but it helps me visualize how I might write the formulas cause I'm not much of a math person.

Fortunately the A tilesets don't cut it up ...

This post has been edited by Tsukihime: Apr 27 2012, 10:50 PM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
Tsukihime
post Apr 28 2012, 02:00 AM
Post #3


Level 25
Group Icon

Group: Revolutionary
Posts: 559
Type: None
RM Skill: Undisclosed
Rev Points: 25




Now to re-factor the code.



This post has been edited by Tsukihime: Apr 28 2012, 10:13 AM


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th May 2013 - 01:38 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker