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.

RMXP Map Exploring System

Script Title:
RMXP Map Exploring System
(This is more a request for an idea than for a full script.)

Detailed Description:
Ok, here's the thing. The game I'm attempting to make is a dungeon-exploring game, in which the player enters a dungeon and all he can see is the 8 tiles that immediately surround him (The rest are blank tiles). As he moves along, he can see more and more of the map, and he can always see what he has previously explored. Similar to the Strategy Warcraft games, for example. There's a screenshot below that explains it better.

Now, I've tried everything and I can't figure out how to do it. The simplest solution would be events, but it would require an event per tile and my maps are 58 x 58 so even if it were possible, lag would be hell. Now, about scripts, I'm an experienced programmer, but I haven't tried my hand much at RGSS yet. I don't know about any commands that would alter a tile's appearance in real time.

If you guys could help me get an idea on how to solve this, it would be magnificent. I repeat, you don't need to write a whole script if you don't want to ;)

Thanks in advance!

Screenshots:
These are taken from an old PC game, Castle of the Winds.
exploring.jpg

I hope it's clear: As he moves, more of the map gets revealed.
 
*Bump*
C'mon you guys, what's the matter, don't you like a good challenge? ;)

I'm seriously considering using a totally different engine to create my game now, RMXP seems just too incompatible. :( What do you guys think?
 
As far as I'm aware the system you are trying to create is easily done with events, a simple screen tone change and sprite of light ontop of the player would create this effect if the light sprite was large enough. I'm not entirly sure if this is what you mean but if you're not willing to give RMXP a chance, you won't get anywhere fast as other languages are far more complex than Ruby a huge bonus with RMXP is that you can create things like this from events which are far easier than coding a system. Maybe an experienced eventer will give you a more detailed walkthrough but I'm pretty sure its easy to do using this method. Hope I've been some help.
 

Zeriab

Sponsor

A challenge? For you perhaps.
Since you are a programmer I'd hazard the guess that you will enjoy the program more if you solve the problem yourself.

The area of interest is the $game_map.data Table, which is a 3-dimensional table structured as $game_map.data[x, y, layer] (There are 3 layers)
Here is a little script which creates a more human readable string representation of Table objects(You may have to remove the line numbers to copy the script properly)
[rgss]class Table
  ##
  # Gives a special string representation. (For debugging purposes mostly)
  #
  def to_s
    if ysize == 1
      begin
        return to_s_1d
      rescue # In the rare case where you have a 2- or 3-dimensional
      end    # table with ysize = 1
    end
    if zsize == 1
      begin
        return to_s_2d
      rescue # In the rare case where you have a 3-dimensional table
      end    # with zsize = 1
    end
    return to_s_3d
  end
 
  ##
  # Returns a representation of the 1-dimensional table as a string
  # Assumes that the table is 1-dimensional. Will throw an error otherwise
  #
  def to_s_1d
    str = '['
    for i in 0...(xsize-1)
      str += self.to_s + ', '
    end
    str += self[xsize-1].to_s + ']'
    return str
  end
 
  ##
  # Returns a representation of the 2-dimensional table as a string
  # Assumes that the table is 2-dimensional. Will throw an error otherwise
  #
  def to_s_2d
    str = '['
    for j in 0...ysize
      str += "\n["
      for i in 0...(xsize-1)
        str += self[i,j].to_s + ', '
      end
      str += self[xsize-1,j].to_s + ']'
    end
    str += "\n]"
    return str
  end
 
  ##
  # Returns a representation of the 3-dimensional table as a string
  # Assumes that the table is 3-dimensional. Will throw an error otherwise
  #
  def to_s_3d
    str = '{'
    for k in 0...zsize
      str += '['
      for j in 0...ysize
        str += "\n["
        for i in 0...(xsize-1)
          str += self[i,j,k].to_s + ', '
        end
        str += self[xsize-1,j,k].to_s + ']'
      end
      str += "\n]"
    end
    str += '}'
    return str
  end
end
[/rgss]

You can for example try to use p $game_map.data after inserting that script into a new section somewhere above main in the script editor.
I can't remember how the value => tile mapping works so you probably have conduct some research yourself.

@Desecration: It's nowhere fast enough. Eventing is definitely not the way to go in this matter.

*hugs*
- Zeriab
 
@Zeriab: Thanks a lot for your feedback, I wasn't aware of the array you mention!

I'll go conduct some research as you suggested, and report back when I find something out. Thanks a lot!
 

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