PDA

View Full Version : RPGM1 Low-Level Memory Management


Czechs Mex
02-14-2005, 04:38 PM
Draygone's topic about the possibility of memory leakage got me thinking about this. I really have no idea if memory leakage exists, but over the course of time I've spent playing this game, I've found some fairly interesting stuff about memory management. Some of this stuff you may already know, and a lot of it may be useless. But it might come in handy if you're desperate to squeeze the ending cutscene into your game, or if you're trying to fit your game onto one less memory card so that people will actually download it. Mostly, though, I've just spent too much time playing this game, and now I'm curious about how it's insides work. If you've got any tips or observations to contribute, feel free. To start us out, here's a few things I've noticed:

1) Every dungeon you modify automatically takes up 34 system memory and 21 scenario memory. So if you make a dungeon, do absolutely nothing to it, and "update data", you will have wasted 34 system memory on nothing. The same goes for event data. (Note, however, that you can delete the entire dungeon to get back this wasted memory, so I wouldn't call it a memory leak. But if you're scrapping for memory, you might want to check for this).

2) The amount of blocks a game takes up on the memory card does NOT only depend on the amount of system/scenario memory used.
For example, I just created a dungeon that took up 252 system memory. I then copied the dungeon 442 times so that it took up all but 147 of the total system memory allowed. I then went to save, and the system data required 1 block of memory.

I then deleted everything and created a dungeon that took up 8484 memory. I copied this dungeon 13 times so that it took up all but 5659 total memory. I went to save, and this time, the system data required 7 blocks of memory (even though less total system memory was used).

I don't have this down to a science, but clearly dungeon size plays a large role in how many blocks are required to save the data. There could be other factors as well, though.

I'm really not sure if the same goes for scenario data, but I have a hunch that it does.

3) The maximum amount of memory any dungeon can take up is 8484 units, and the way this memory is used is ****ed up.
First of all, there's two different types of system memory that appear to be independent of each other - the background tiles and the foreground tiles. Each tile takes up memory, so placing a foreground tile so that it completely covers a background tile might be unwise. You'd be better off erasing the background tile first.

The foreground and background tiles can each take up 4225 memory at the very most. This seems to make sense, because there are 65x65=4225 squares in any given dungeon, so each tile takes up one unit of memory.

However, start up a dungeon and start plopping down tiles, and you'll see that each item does NOT necessarily take up 1 unit of memory. Sometimes it takes none, sometimes it takes 5. I really haven't figured out what this depends on. One thing I have noticed is that if you make a diagonal with tiles, every tile you place inside the square with that diagonal takes up 0 additional memory. What does this mean? I have no idea, and solving this puzzles probably has no practical purpose. It's just kind of interesting to figure out how things work.

And when you care about stuff like that, that's how you know you've played too much RPG Maker.

RPGD
02-14-2005, 05:51 PM
Interesting observations. I personally think some more research should be conducted in this area.

It looks to me like the Pavilion is heading in the direction of the Monster Rancher community.

Draygone
02-15-2005, 12:20 AM
I noticed some of those memory deals before, especially how a bunch of copied maps don't take up as much space on a memory card. I think I know how it works, though. I think each space on a map is stored as a variable on RPGM1. (Actually, that's pretty likely.) I believe that when you save your game, when it saves that variable, it checks if other maps have that same graphic in the same space, and in a way crunches it. Not exactly sure how, but I think that's the case. And with bigger maps, that means more variables it saves per map (which accounts for larger maps taking up a bit more space on the card).

Speaking of map size, I think the memory consumed is based on the dimensions of the map. However irregular the shape, a 20x20 map will always take up more memory than a 19x19 map, sans one having more upper tiles than the other. It also seems that when so much of a map has something on it, it starts taking extra memory, as I've noticed sometimes is the case with some of the Gobli maps.

Also, I did a little test once, and it seems that when you move the start point to another map, if the map doesn't have anything to begin with, even if the start point was still in the same map when moved, a little bit of memory is taken up. Yet when it's in it's original default position (which I think can only be done by deleting the scenario data for the map it's on), it doesn't take any extra memory at all.

You know, I once had a list that showed how much scenario data everything took up, ranging from empty events to commands to conditions. I don't have it anymore, though. Kinda was interesting, though, how varying some of the stuff was. Or not varying, in the case of Intro Events, which when empty, take up the same amount of memory as an empty regular event, even though it doesn't get placed anywhere on the map. I also found out how memory consumed from messages was done. In this message:

On my way to the
park I killed
a monster.

It takes up 45 MEM. 4 to start with, 16 on the first line (it includes spaces, and the spaces before "On" would also take up memory if there were any), 13 on the second line, 10 on the third line, and 2 MEM for having two lines used up after the first.

And didn't somebody here once find a way to exceed the memory limit? I know that it currupted the data by doing that, but was still interesting.

I also found out that there is a limit to how many custom graphics you can have in a game besides the max amount allowed. For the monsters, there's also a memory limit, separate from the System and Scenario memory (it's somewhere over 300,000 I think). I'm guessing bigger and more detailed monsters take up more memory than others. So potentially, one might not be able to fill in all 15 slots with monsters. I don't know how many really know that, but I figure that since from what I can tell custom monsters aren't a very common sight (aside from that secret monster in Anime Maker), I might as well mention it.

Valkysas
02-15-2005, 12:22 AM
well, you can always use multiple system datas. we got past memory limitations years ago.

Draygone
02-15-2005, 12:31 AM
Yeah, but that comes with a couple problems. For one, if you want to enable the player to go back to every place in the game even when at the end (for reasons like finding missed items or a subquest or something), that means you won't find memory to get rid of very easily. Plus it's kinda a hassle for the player to shut off the game and insert a different memory card, then finally load it back up again. Though that's certainly not too much of a hassle. Really, it's the first problem that's a real problem.

Karr Lord of Chaos
02-21-2005, 06:30 PM
dont forget to mention that EVERY T event is reset, that makes it possible to check every chest again (like i did in rones games).

other memory eaters are items, spells, which love to consume an outragous amount of space per items. dont forget the cap on events per dongen make it impossible to have huge maps with an event to leave everywhere on the outside edge (120 i think is max).