Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Renders Isometric Maps!

GubiD's Isometric Map Renderer
Version: 1.0
By: GubiD

Introduction

This script takes an isometric map(predetermined by the isometric view script) and renders you a png of it including heights. This makes it easier to develop isometric tilesets and overall isometric maps. Cause it does all the placement etc for you.

Features
  • Renders Isomap to PNG file
  • Replaceable default tiles (IsoNode.png in the Pictures folder)

Screenshots
isodrawframe.jpg


Demo
Why Yes!

Script

[ruby]#==============================================================================
# Iso Node - The iso sprite
#==============================================================================
class IsoNode < Sprite
  def initialize(x,y)
    super(nil)
    @sx = x
    @sy = y
    @real_x = x*128
    @real_y = y*128
    @iso = $game_map.iso?
    self.bitmap = RPG::Cache.picture("IsoNode").clone
    @h = 0
  end
  def update
    @h = get_height
    self.x = screen_x
    self.y = screen_y
    self.z = screen_z
    super
  end
  #----------------------------------------------------------------------------
  # Get Height - Return Screen Tile Height for the current position
  #----------------------------------------------------------------------------
  def get_height
    return 0 if !@iso
    tile_id = $game_map.map.data[@sx,@sy,0]
    return 0 if tile_id == nil
    t_x = (tile_id - 384) % 8    
    t_y = (tile_id - 384) / 8
    th = t_x + t_y * 8
    return th
  end
  #----------------------------------------------------------------------------
  # Screen X - sets X based on current map position
  #----------------------------------------------------------------------------
  def screen_x
    if !@iso
      return (@real_x - $game_map.display_x + 3) / 4 + 16
    else
      return  (@real_x - @real_y)/4 + 32*$game_map.height - 0 - $game_map.display_x/4+2-32
    end
  end
  #----------------------------------------------------------------------------
  # Screen Y - sets Y based on current map position
  #----------------------------------------------------------------------------
  def screen_y
    if !@iso
      y = (@real_y - $game_map.display_y + 3) / 4 + 32
      return y
    else
      y = ((@real_y + @real_x) / 8 + 24 - $game_map.display_y / 4 - (@h) * 8) + 7 -32
      return y
    end
  end
  def screen_z
    if !@iso
      # Get screen coordinates from real coordinates and map display position
      z = (@real_y - $game_map.display_y + 3) / 4 + 32
      # If height exceeds 32, then add 31
      return z
    else
     
      z = @h * 8
      if screen_y < $game_player.screen_y
        if @h > $game_player.screen_h
          z -= 4
        end
      else
        if @h > $game_player.screen_h
          z -= 2
        end
      end
      return z
    end
  end
end
 
$drawn_iso_maps = []
#==============================================================================
# Scene Map Changes
#==============================================================================
class Scene_Map
  attr_reader :iso_sprites
  alias upd_gm_draw_iso update
  def update
    upd_gm_draw_iso
    update_iso_draw
  end
  def update_iso_draw
    if $game_map.iso?
      if !$drawn_iso_maps.include?($game_map.map_id)
        if @iso_sprites == nil
          draw_iso_frame
        else
          clear_iso_frame
          draw_iso_frame
        end
      else
        return if @iso_sprites == nil
        @iso_sprites.each {|spr| spr.update}
      end
    end
  end
  def clear_iso_frame
    @iso_sprites.each {|spr| spr.dispose}
    @iso_sprites = nil
  end
  def draw_iso_frame
    @iso_sprites = []
    for x in 0...$game_map.width
      for y in 0...$game_map.height
        @iso_sprites.push(IsoNode.new(x,y))
      end
    end
    $drawn_iso_maps.push($game_map.map_id)
    name = $data_map_info[$game_map.map_id].name
    MapScreenshotMaker.take_iso(name)
  end
end
 
#==============================================================================
# ** MapScreenshotMaker
#==============================================================================
module MapScreenshotMaker
  def self.take_iso(filename="IsoShot", dir = "Graphics/IsoMaps/")
    #create bitmap
    both = $game_map.width+$game_map.height
    bitmap = Bitmap.new(both*32, (both/2)*32)
    #save current display view
    sx, sy = $game_map.display_x, $game_map.display_y
    #set to 0
    $game_map.display_x, $game_map.display_y = 0,0
    #update sprites, and render to bitmap
    $scene.iso_sprites.each {|spr|
      spr.update
      bitmap.blt(spr.x, spr.y, spr.bitmap, Rect.new(0,0,64,32))
    }
    #save bitmap to file
    bitmap.make_png(filename, dir)
    #reset display view
    $game_map.display_x, $game_map.display_y = sx, sy
    #update iso sprites to location
    $scene.iso_sprites.each {|spr|
      spr.update
    }
  end
end
[/ruby]

Instructions

This script has a couple of requirements:
  • SDK
  • MACL
  • Isometric View
It would be best to use the demo, but you would simply place this script in a project with the above required scripts (which are included in the demo) and transfer your player to a map including the name of ISO and it will be rendered for you to the Graphics\IsoMaps folder of your project.

Compatibility
This will not work in VX

Credits and Thanks
Makers of the SDK and MACL for giving me the ability to write to PNG file.
McCaladtogel for his original Isometric script, which I modified into Isometric Views (XP/VX)
Seigfried for his help in nailing down Isometric height movement.

Author's Notes
This script is only for RMXP and cannot be used inside of VX. However you can render your maps in XP, and import the made tilesets to VX.
I dont know of any compatiblity problems. However do keep in mind that this script displays 100's of sprites on screen at once. This causes major lag, but shouldnt really matter, because it is intended for game dev only. As in to render the maps for you, so that you can turn them into what you want.

Terms and Conditions
Intended for Development use only(cause its too slow otherwise). Please do not repost this script elsewhere without my permission.
 

Atoa

Member

Quite impressive.
I already was planing to use the GTBS after you added the ismetric battle with height, now with this script it would be easier to create the maps.
 
Thank you for the comments. I hope to see some new iso tilesets evolve from this. At least that was my main goal. Plus it saved me huge amounts of time while making some of mine. I will release them once, I have polished them up a little bit.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top