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.

How does everything relate?

I think I finally understand this scripting business! I am very proud of myself having finally got my head around some of the ideas and concepts - and it turns out they are much easier when you look at it as a different language rather than something alien and foreign and code-ish...

However, I'm still a tad confused because in my mind I am viewing the RMXP package as being three seperate entities; The Fields, the Database, and the Scripts. Yet if I'm understanding everything I've got thus far, the Fields and Database can both be expressed as part of the Scripts bit. I can't connect the visual parts to the text parts...

Generally I think this is a round-about way of asking how the visual 'stuff' such as the maps, and events on the field screen along with the visual database are expressed in Scripting terms....etc....

(I'm not really that articulate at expressing this)
 
regarding the field, it's all the matter with two things :
Game_Map and Spriteset Map but you for altering charset, I think it's in the Sprite_Character class...

but waht's this visual database? I thought database is a database, a thing that actually is pretty close to the scripting, like $game_item, $game_actors, etc...
 

Anonymous

Guest

Sort of. The database is a series of "flat files" that the scripts read and initialize some data from. The maps are as well, with the addition that the data taken from the map's events is checked to see if it should be interpreted, and possibly interpreted by the Interpreter.
 
LegACy, when I said "visual database" I mostly meant the little database tab and how you enter the little values in the little boxes and check the attributes... We used to colloquially describe the forms in a database as such.

So how is a typical map expressed in a flatfile? Are the events all listed by positions, the instructions they contain (which I suppose would be methods) conditions for activating them etc?

You're lost me a bit around the end ccoa: You've said "interpret" a lot... :)
 
I will tell you how it is;

When you click save all the data is saved to their own files. i.e. actors.rxdata.

When you click "RGSS Player", which is literally what it is, it calls the first script, which is Main.

From Main series of other scripts are called. You can see the;

Code:
  # Make scene object (title screen)
  $scene = Scene_Title.new
  # Call main method as long as $scene is effective
  while $scene != nil
    $scene.main
  end

Now go to Scene_Title and see;

Code:
    # Load database
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")

load_data is a built in function in RGSS Built-in Functions.

The data is then loaded from their respective files like above.

If you click new game;

Code:
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new

When those scripts start, most of them look at $data_whatever.

Loading and saving is a bit different but the same idea.

As for events;

They are saved to maps; RMXP reads them. Each command in an event is represented as numbers;
101 = Message

and so on

1 is page
01 is comman on the page.

My guess is, it just reads the data the way it saves it. Like in MArshal.Dump. Personally, I don't know how they did it exactly. I would have done it in a different way.

The map is not interpted from the interpter. It is read by Game_Map
Code:
@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))

Events read from Game_Map too.

I won't tell you how it exactly done tho.

Why do you want to know all this anyways? They are useless. You can't edit them because everything is save in binray format. If you edit them, you won't know what the hell you did.:-/

Anyways, thats how everything works. Its a big loop in Main.
 
Why do you want to know all this anyways? They are useless. You can't edit them because everything is save in binray format. If you edit them, you won't know what the hell you did.

Because back when I was using a different, it was always easier for me to understand everything as code - which it was. Knowing how all these things are connected and fundamentally just text makes it easier for me to see what happens, how it happens, why it happens etc.
 
A map is epxressed as a three level table. As in, it is a set of three tables within an array, one for each layer of the map. Added to this data is information such as tileset name, bgm, and battle encounters (I think). Map name is expressed elsewhere.

Each space on the table is assigned a number. Between number 40 and number 383 are all 7 autotiles. Each number can represent each individual 32x32 square representation of an autotile imaginable. There's those with top boundary lower left corner, no boundary, up-and-right corner with lower-left outer corner, etc.

The numbers past 384 are all individual tiles in the tileset. So, in tileset 001-Field01.png (I think that's what it's called) if you layed a grass tile that would be data 384. Anything past that is increased first by row then by column (in the tileset, expressed linearly as an integer)

This is all interpreted by the Tilemap class. The tilemap interprets every known dimension of the tileset and map and generates an image from the varying bitmaps in a plane within a viewport. Or, in layman's terms, it creates the image, then only gives you 640x480 pixels of it at a time, repeating the image if the boundaries are exceeded, and not outputig anything outside of the "viewport" of 640x480.

The tilemap class is very complicated. So complicated in fact, that I am having trouble properly reverse engineering it for my own purposes (and those of FF fangames everywhere). The parts that elude me particularly are priority and animation, but it will only be a matter of time before that is solved.

But that's how a map is taken from what you put into the RPG Maker, into a file, and onto your screen.
 

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