gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > A question about zelda:lttp

#172211 - brave_orakio - Mon Jan 25, 2010 3:02 am

I remember Zelda:lttp in the dark world I think you could enter several dungeons in any order you choose.
What I never got to do was to try doing a dungeon half then going into another dungeon and doing half of that then going back to the other dungeon again and see what happens.
The question is, for something like this, do we keep a separate variable for each dungeon to keep track of what was already finished in each dungeon or just one variable and reset the variable if the player enters another dungeon and another to keep track of which dungeons have been fully finished?
Same question goes for say treasure chests. I suppose there is a variable(or several) to keep track of which ones have been opened?
Looking at other games like Boktai, obviously treasure chests are reset each time the layer enters the area.
_________________
help me

#172212 - gauauu - Mon Jan 25, 2010 3:43 am

Just a random guess, but I'd guess that "important" things like treasure chests, bosses, which doors were unlocked, etc are saved globally. (Probably just a huge array of flags, and each is associated with a flag?)

The other more minor things (each individual switch, which minor enemies have been cleared out, etc) are probably reset when the dungeon is entered. In this case, they might use an array of "local" flags that get reset when a dungeon is entered.

Of course, that's all speculation, I haven't looked at it carefully to see if that's the case.

(In my own homebrew Zelda ripoff, the game was small enough that I saved all those things in a big array of flags. If you pack them all into individual bits, you can save TONS of flags without using a significant amount of memory. (although I don't even think I packed them in bits, but I don't remember right now) Now my game was much smaller than a commercial game, and I didn't really care about being efficient with save space, but it wasn't an issue at all to just save everything willy-nilly)

#172216 - Dwedit - Mon Jan 25, 2010 7:07 am

A flag is a bit, so in 512 bytes, you can fit 4096 flags.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#172230 - brave_orakio - Tue Jan 26, 2010 2:48 am

I see. Not so complicated after all. I will probably use bits just to save on memory but it shouldn't be too big. Thanks for the replies!
_________________
help me