Hellfire's G_G
Is winkio's bitch.
Moderator
Lexima Warrior
Level: 145
Offline
Posts: 2647
*Scripts some awesome power*
|
 |
« on: August 18, 2009, 05:08:38 PM » |
|
Tileset Merger Authors: game_guy Version: 1.0 Type: Tileset Merger Key Term: Misc System IntroductionEver needed a few tilesets merged for mapping? This script will merge any tilesets for you into one! Features- Merges any amount of tilesets into one tileset!
ScreenshotsVideo Demohttp://www.sendspace.com/file/ufkvn9 Script#=============================================================================== # Tileset Merger # Version 1.0 # Author game_guy #------------------------------------------------------------------------------- # Intro: # Ever needed a few tilesets merged for mapping? This script will merge any # tileset for you into one! # # Features: # Merges any amount of tilesets into one tileset! # # Instructions: # Import any tileset into the Tilesets folder that you want merged together. # Then run the game and it'll merge it for you. # Make sure all the tilesets have the same background color. # # Credits: # game_guy ~ making it # Fantasist ~ giving me a neat piece of code # 66rpg ~ Bitmap to Png code # GAX72 ~ Requesting merged tilesets #===============================================================================
=begin ============================================================================== Bitmap to PNG By 轮回者 ==============================================================================
对Bitmap对象直接使用 bitmap_obj.make_png(name[, path]) name:保存文件名 path:保存路径
感谢66、夏娜、金圭子的提醒和帮助! ============================================================================== =end
module Zlib class Png_File < GzipWriter #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- def make_png(bitmap_Fx,mode) @mode = mode @bitmap_Fx = bitmap_Fx self.write(make_header) self.write(make_ihdr) self.write(make_idat) self.write(make_iend) end #-------------------------------------------------------------------------- # ● PNG文件头数据块 #-------------------------------------------------------------------------- def make_header return [0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a].pack("C*") end #-------------------------------------------------------------------------- # ● PNG文件情报头数据块(IHDR) #-------------------------------------------------------------------------- def make_ihdr ih_size = [13].pack("N") ih_sign = "IHDR" ih_width = [@bitmap_Fx.width].pack("N") ih_height = [@bitmap_Fx.height].pack("N") ih_bit_depth = [8].pack("C") ih_color_type = [6].pack("C") ih_compression_method = [0].pack("C") ih_filter_method = [0].pack("C") ih_interlace_method = [0].pack("C") string = ih_sign + ih_width + ih_height + ih_bit_depth + ih_color_type + ih_compression_method + ih_filter_method + ih_interlace_method ih_crc = [Zlib.crc32(string)].pack("N") return ih_size + string + ih_crc end #-------------------------------------------------------------------------- # ● 生成图像数据(IDAT) #-------------------------------------------------------------------------- def make_idat header = "\x49\x44\x41\x54" case @mode # 请54~ when 1 data = make_bitmap_data#1 else data = make_bitmap_data end data = Zlib::Deflate.deflate(data, 8) crc = [Zlib.crc32(header + data)].pack("N") size = [data.length].pack("N") return size + header + data + crc end #-------------------------------------------------------------------------- # ● 从Bitmap对象中生成图像数据 mode 1(请54~) #-------------------------------------------------------------------------- def make_bitmap_data1 w = @bitmap_Fx.width h = @bitmap_Fx.height data = [] for y in 0...h data.push(0) for x in 0...w color = @bitmap_Fx.get_pixel(x, y) red = color.red green = color.green blue = color.blue alpha = color.alpha data.push(red) data.push(green) data.push(blue) data.push(alpha) end end return data.pack("C*") end #-------------------------------------------------------------------------- # ● 从Bitmap对象中生成图像数据 mode 0 #-------------------------------------------------------------------------- def make_bitmap_data gz = Zlib::GzipWriter.open('hoge.gz') t_Fx = 0 w = @bitmap_Fx.width h = @bitmap_Fx.height data = [] for y in 0...h data.push(0) for x in 0...w t_Fx += 1 if t_Fx % 10000 == 0 Graphics.update end if t_Fx % 100000 == 0 s = data.pack("C*") gz.write(s) data.clear #GC.start end color = @bitmap_Fx.get_pixel(x, y) red = color.red green = color.green blue = color.blue alpha = color.alpha data.push(red) data.push(green) data.push(blue) data.push(alpha) end end s = data.pack("C*") gz.write(s) gz.close data.clear gz = Zlib::GzipReader.open('hoge.gz') data = gz.read gz.close File.delete('hoge.gz') return data end #-------------------------------------------------------------------------- # ● PNG文件尾数据块(IEND) #-------------------------------------------------------------------------- def make_iend ie_size = [0].pack("N") ie_sign = "IEND" ie_crc = [Zlib.crc32(ie_sign)].pack("N") return ie_size + ie_sign + ie_crc end end end #============================================================================== # ■ Bitmap #------------------------------------------------------------------------------ # 关联到Bitmap。 #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ● 关联 #-------------------------------------------------------------------------- def make_png(name="like", path="",mode=0) make_dir(path) if path != "" Zlib::Png_File.open("temp.gz") {|gz| gz.make_png(self,mode) } Zlib::GzipReader.open("temp.gz") {|gz| $read = gz.read } f = File.open(path + name + ".png","wb") f.write($read) f.close File.delete('temp.gz') end #-------------------------------------------------------------------------- # ● 生成保存路径 #-------------------------------------------------------------------------- def make_dir(path) dir = path.split("/") for i in 0...dir.size unless dir == "." add_dir = dir[0..i].join("/") begin Dir.mkdir(add_dir) rescue end end end end end begin @time = Time.now @height = 0 @names = [] dir = Dir.new('Graphics/Tilesets/') dir.entries.each {|file| next unless file.include?('.png') @names.push(file); RPG::Cache.tileset(file)} for i in 0...@names.size @tile = RPG::Cache.tileset(@names[i]) @height += @tile.height end @bitmap = Bitmap.new(256, @height) @height = 0 for i in 0...@names.size @tile = RPG::Cache.tileset(@names[i]) @rect = Rect.new(0, 0, @tile.width, @tile.height) @bitmap.blt(0, @height, @tile, @rect) @height += @tile.height end @bitmap.make_png("MergedTile") print "Merged #{@names.size} tilesets together in \n#{Time.now - @time} seconds." exit end
InstructionsImport any tileset into the Tilesets folder that you want merged together. Then run the game and it'll merge it for you. Make sure all the tilesets have the same background color. Merged tilesets will appear in the root of the game folder. CompatibilityShould work with anything Not tested with SDK Credits and Thanks- game_guy ~ for making it
- Fantasist ~ giving me a neat piece of code
- 66rpg ~ BitmapToPng code
- GAX72 ~ requesting a few merged tilesets
Author's NotesGive credits and enjoy!
|
|
|
|
« Last Edit: September 22, 2009, 03:48:06 PM by game_guy »
|
Logged
|
Is winkio's bitch. Pokedex Entry: G_G has the power of awesome scripting. Once caught, will make scripts for you. However you don't receive your scripts until a month later you request them. Maybe even later. 
|
|
|
|
Hellfire's G_G
Is winkio's bitch.
Moderator
Lexima Warrior
Level: 145
Offline
Posts: 2647
*Scripts some awesome power*
|
 |
« Reply #1 on: August 21, 2009, 07:49:06 PM » |
|
any thoughts on it at all?
|
|
|
|
|
Logged
|
Is winkio's bitch. Pokedex Entry: G_G has the power of awesome scripting. Once caught, will make scripts for you. However you don't receive your scripts until a month later you request them. Maybe even later. 
|
|
|
|
Champion Blizzard
Where am I?
Administrator
Has over 9000 posts
 
Level: 351
Offline
Gender: 
Posts: 9509
South Park's Chinpokomon are more awesome.
|
 |
« Reply #2 on: August 22, 2009, 03:40:30 PM » |
|
It can definitely save some time and nerves that merging usually requires. xD
|
|
|
|
|
Logged
|
  Double 69.
|
|
|
|
|
Mad Scientist Fantasist
|
 |
« Reply #3 on: August 23, 2009, 01:02:18 PM » |
|
Make sure all the tilesets have the same background color. Well, that's not needed if the tilesets already have the background transparent. The PNG script takes care of the transparencies too. That means you can just use the script directly on RTP tilesets 
|
|
|
|
|
Logged
|
Stopped using RMXP until further notice.<br /> <br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br /> 
|
|
|
|
|
rpgmakerfanhaha
Guest
|
 |
« Reply #4 on: September 04, 2009, 01:58:52 PM » |
|
Will it work with default tilesets?
|
|
|
|
|
Logged
|
|
|
|
|
Jackolas
Celestial Dreamer
 
Level: 27
Online
Gender: 
Posts: 451
Its just me
|
 |
« Reply #5 on: September 04, 2009, 02:11:58 PM » |
|
game_guy made it... ofc it works on the default tiles
|
|
|
|
|
Logged
|
|
|
|
|
Elite Four Aqua
Global Moderator
Lexima Warrior

Level: 98
Offline
Gender: 
Posts: 2044
Quack!
|
 |
« Reply #6 on: September 04, 2009, 03:49:03 PM » |
|
You should run it in a new game - that way, there'll be sure to have no conflicting scripts.
Or... if you want it without error... Get the demo xD
|
|
|
|
« Last Edit: September 04, 2009, 04:25:03 PM by Aqua »
|
Logged
|
|
|
|
|
|
RoseSkye
|
 |
« Reply #7 on: September 06, 2009, 08:38:54 PM » |
|
add ons?
|
|
|
|
|
Logged
|
|
|
|
|
Hellfire's G_G
Is winkio's bitch.
Moderator
Lexima Warrior
Level: 145
Offline
Posts: 2647
*Scripts some awesome power*
|
 |
« Reply #8 on: September 22, 2009, 03:48:33 PM » |
|
*adds video*
Okay so theres no confusion I added a video to the screenshots so people can get a better idea on what it does
|
|
|
|
|
Logged
|
Is winkio's bitch. Pokedex Entry: G_G has the power of awesome scripting. Once caught, will make scripts for you. However you don't receive your scripts until a month later you request them. Maybe even later. 
|
|
|
|
DesPKP
Celestial Dreamer
 
Level: 2
Offline
Gender: 
Posts: 354
Pyhänkoski Productions!
|
 |
« Reply #9 on: September 30, 2009, 09:37:38 AM » |
|
This is cool. I´ll use this in my game, Rozarias Tale. With this i can create world maps with just the default RTP tiles, and so on...
|
|
|
|
|
Logged
|
|
|
|
|
Elite Four Aqua
Global Moderator
Lexima Warrior

Level: 98
Offline
Gender: 
Posts: 2044
Quack!
|
 |
« Reply #10 on: September 30, 2009, 09:50:54 PM » |
|
You don't use this in a game... O.o It's a graphics tool
|
|
|
|
|
Logged
|
|
|
|
|
Arceus
Epiq
Moderator
Astral Trancist
Level: 88
Online
Gender: 
Posts: 1540
I am lying.
|
 |
« Reply #11 on: September 30, 2009, 10:01:27 PM » |
|
This is cool. I´ll use this in my game, Rozarias Tale. With this i can create world maps with just the default RTP tiles, and so on...
You don't use this in a game... O.o It's a graphics tool
Aqua, he said he was going to use it to merge tilesets in his game. He made it clear that he didn't expect it to be a script IN the game, or anything like that.
|
|
|
|
|
Logged
|
|
|
|
|
Elite Four Aqua
Global Moderator
Lexima Warrior

Level: 98
Offline
Gender: 
Posts: 2044
Quack!
|
 |
« Reply #12 on: September 30, 2009, 10:33:43 PM » |
|
This is cool. I´ll use this in my game, Rozarias Tale. With this i can create world maps with just the default RTP tiles, and so on...
The "in" makes it seem as if it's IN the game... :p A better word would have been "for"
|
|
|
|
|
Logged
|
|
|
|
|
Starrodkirby86
Pokemon Trainer
Global Moderator
Lexima Warrior

Level: 164
Offline
Gender: 
Posts: 2871
The adventure begins again at March 14th.
|
 |
« Reply #13 on: October 01, 2009, 05:27:33 AM » |
|
Nazi-ing English when you already know what he intended to say doesn't make you look cool...>.>
Unless he wants improvement on his English or something.
|
|
|
|
|
Logged
|
|
|
|
|
DesPKP
Celestial Dreamer
 
Level: 2
Offline
Gender: 
Posts: 354
Pyhänkoski Productions!
|
 |
« Reply #14 on: October 05, 2009, 09:50:33 AM » |
|
Blah... I wasn´t thinking straight since i was at the time and also i´m also at the moment in school... BTW... now that i downloaded this, i noticed that there were japanese kanji-symbols in it, so would G_G or someone explain this to me...
|
|
|
|
« Last Edit: October 06, 2009, 06:28:11 AM by Pyhankoski »
|
Logged
|
|
|
|
|
Jackolas
Celestial Dreamer
 
Level: 27
Online
Gender: 
Posts: 451
Its just me
|
 |
« Reply #15 on: October 06, 2009, 08:02:31 AM » |
|
Credits and Thanks
* game_guy ~ for making it * Fantasist ~ giving me a neat piece of code * 66rpg ~ BitmapToPng code * GAX72 ~ requesting a few merged tilesets 66rpg probably put them in there
|
|
|
|
|
Logged
|
|
|
|
|
DesPKP
Celestial Dreamer
 
Level: 2
Offline
Gender: 
Posts: 354
Pyhänkoski Productions!
|
 |
« Reply #16 on: October 17, 2009, 12:19:22 PM » |
|
Hey, how do i make it to merge all fify def. rtp tiles?
|
|
|
|
|
Logged
|
|
|
|
|
Jackolas
Celestial Dreamer
 
Level: 27
Online
Gender: 
Posts: 451
Its just me
|
 |
« Reply #17 on: October 17, 2009, 01:00:35 PM » |
|
one by one. so first merge 2 with each other. than add another 1, and another 1, etc
just remember if you load all in 1 it will get a slow game with loads of loading times. and kinda make your game crap. so only merge tiles that you need per map. and make multiple tiles.
|
|
|
|
|
Logged
|
|
|
|
|
|
Calintz
|
 |
« Reply #18 on: October 17, 2009, 01:07:20 PM » |
|
It's a good system, but I would never use it myself. A very long time ago, Blizzard and I discussed the practicability of larger tilesets as opposed to the time they consume to create the everyday maps for your game. I prefer standard size tilesets. Everything included in the originals is all that you need. It really is. If you want to make your game more original, then sure ... add a couple tiles, but you don't really need the mergers.
|
|
|
|
|
Logged
|
|
|
|
|
Hellfire's G_G
Is winkio's bitch.
Moderator
Lexima Warrior
Level: 145
Offline
Posts: 2647
*Scripts some awesome power*
|
 |
« Reply #19 on: October 17, 2009, 03:12:01 PM » |
|
Hey, how do i make it to merge all fify def. rtp tiles?
Easy but first one by one. so first merge 2 with each other. than add another 1, and another 1, etc
just remember if you load all in 1 it will get a slow game with loads of loading times. and kinda make your game crap. so only merge tiles that you need per map. and make multiple tiles.
Nope just place all tilesets you want merged together in tilesets folder it'll merge them all. So if you have 7 tilesets in there it'll merge it together then export it into the file "MergedTileset"
|
|
|
|
|
Logged
|
Is winkio's bitch. Pokedex Entry: G_G has the power of awesome scripting. Once caught, will make scripts for you. However you don't receive your scripts until a month later you request them. Maybe even later. 
|
|
|
|