News:

As a consequence of the forum being updated and repaired, the chatbox has been lost.
However, you can still come say hi on our Discord server!

Main Menu

Editing encounters in a dungeon

Started by Mion Sonozaki, 16, November, 2014, 05:57:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mion Sonozaki

How can I edit which encounters the player will face in a dungeon, or particular area of the overworld? As in, which "groups" are encountered?

For example, what if I wanted Shrine of the Sea God to have its own unique encounters, instead of sharing its monster groups with the Overworld and Kandorean Temple?

Daddy Poi's Oily Gorillas

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Mion Sonozaki

#2
Quote from: Fox on 16, November, 2014, 06:02:44 PM
http://forum.goldensunhacking.net/index.php?topic=2024.0

So how do I edit which room uses what battle collection, and which groups are inside what battle collection?

-edits-

Lay Terms:
Lishy: awwww shitttt don't tell me this is like editing the idexed Elemental Res/Pow.  So each map has a "battle collection" and this battle collection is a table that tells which groups to spawn?

Teawater info:

The red box represents an entry. But I want to point to you the next THREE entries. They assign the same battle collection (x38)to the following maps: x94, x95, x96




Helpful from shoutbox:

Fox: 080EDACC + (Battle Collection # * 0x1C)

Today at 11:53:52 PM
Fox: 0x1C is the number of bytes in an entry. ; 080EDACC = Battle Collection #0 , 80EDAE8 = Battle Collection #1 , and so forth.


Fox: @World Map: Through another database that also indexes to the Battle Collections thing. ; "80EEDBC = Assigns World Map Battle Encounters" ; It's based on Movement Type, Terrain Type, and Storybook flag.


Daddy Poi's Oily Gorillas

#3
By the way, I think I might know two 16-bits in green.

0032 = Value to increment by.
0015 = Recommended average level of all PCs.  This may change the value to increment by slightly. It has a cap ranging a few levels. (For example, while this one is 0015, the caps are at 0015 to 001A) ... It's converted to 0-5 by doing *your average level - recommended level*  (Which is what "2nd value" is below.)

1st value + (2nd value * 5) //I think there are a couple more parts to this... so this isn't the full equation.

080CA0B2 = << 4 , - 0x10 , etc... were left out of my posted equation. Even left out a random number that is used in this equation that gets placed at 02030194. .... Since right now, it's current purpose is to make a point until I understand the rest of it.

When 0x00100000 is reached, a battle occurs.

It's likely that battles occur more often as you level up through there, as long as this value isn't converted in any other way before being written to RAM.


Which green 8-bit in the other memory viewer is used might be based on which tile you are on in the tilemap. ; [0x02010000+(pos*4)+3] & 4
Often used with tiles that do not cause battles. (Like when an encounter index is 00.) An example would be where Hover pads are in Jupiter Lighthouse.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Mion Sonozaki

Quote from: Fox on 27, November, 2014, 12:17:57 AM
By the way, I think I might know two 16-bits in green.

0032 = Value to increment by.
0015 = Recommended average level of all PCs.  This may change the value to increment by slightly. It has a cap ranging a few levels. (For example, while this one is 0015, the caps are at 0015 to 001A) ... It's converted to 0-5 by doing *your average level - recommended level*  (Which is what "2nd value" is below.)wss

1st value + (2nd value * 5) //I think there are a couple more parts to this... so this isn't the full equation.

080CA0B2 = << 4 , - 0x10 , etc... were left out of my posted equation. Even left out a random number that is used in this equation that gets placed at 02030194. .... Since right now, it's current purpose is to make a point until I understand the rest of it.

When 0x00100000 is reached, a battle occurs.

It's likely that battles occur more often as you level up through there, as long as this value isn't converted in any other way before being written to RAM.


Which green 8-bit in the other memory viewer is used might be based on which tile you are on in the tilemap. ; [0x02010000+(pos*4)+3] & 4
Often used with tiles that do not cause battles. (Like when an encounter index is 00.) An example would be where Hover pads are in Jupiter Lighthouse.

Wait... So our level actually affects how often random battles occur?

I'm a bit confused how the formula works though.

Random battle rate= 1st value + (Level * 5)

What does the 1st value represent?

I want to make sure to reduce battles in Golden Sun ReDux very drastically, so I need to make sure I know whether turning it up or down affects whether or not it reduces.

Also, is there ANY info which Battle Collections are unused? I'm assuming some are left over from gs1.... this would be INCREDIBLY useful to know! (Or at least, if you have any tips to easily look this up)

Daddy Poi's Oily Gorillas

QuoteWait... So our level actually affects how often random battles occur?
Yes.

QuoteI'm a bit confused how the formula works though.

Random battle rate= 1st value + (Level * 5)
Same, but only with the part I haven't figured out yet. It would be better if I posted the actual formula as a whole, but...

QuoteWhat does the 1st value represent?
It's this, the value itself:  0032 = Value to increment by.

QuoteI want to make sure to reduce battles in Golden Sun ReDux very drastically, so I need to make sure I know whether turning it up or down affects whether or not it reduces.
Like... 1st 16-bit should be 1, and second 16-bit should be like... 40+?

QuoteAlso, is there ANY info which Battle Collections are unused? I'm assuming some are left over from gs1.... this would be INCREDIBLY useful to know! (Or at least, if you have any tips to easily look this up)
0x46, 0x4D, 0x66-0x6A, 0x6C may or may not be used? The others all appear to be used. ; I quickly scanned the lists, so it's possible I could be mistaken, or the game uses these in some other way.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Mion Sonozaki

Quote from: Fox on 28, November, 2014, 12:10:48 PM
QuoteI want to make sure to reduce battles in Golden Sun ReDux very drastically, so I need to make sure I know whether turning it up or down affects whether or not it reduces.
Like... 1st 16-bit should be 1, and second 16-bit should be like... 40+?

So turning the first value down and the second value up, reduces the rate of battles?
Quote from: Fox on 28, November, 2014, 12:10:48 PM
QuoteAlso, is there ANY info which Battle Collections are unused? I'm assuming some are left over from gs1.... this would be INCREDIBLY useful to know! (Or at least, if you have any tips to easily look this up)
0x46, 0x4D, 0x66-0x6A, 0x6C may or may not be used? The others all appear to be used. ; I quickly scanned the lists, so it's possible I could be mistaken, or the game uses these in some other way.

Only those 5 values are unused? Bummer... REALLY Bummer...

Perhaps some are used in GS1?

Organizing a completely new random battles list, for the ENTIRE game, is going to be a huge pain in the @#$... I really hope we figure out what "other way" they're used, so that I don't end up messing something up hardcore...

Slightly offtopic, but how are backgrounds decided? Since a place like Madra has no combat BG... I think.

Misery

On the subject of random encounters - what does the Avoid psynergy check for? I suspect it's average party level vs recommended average for the current area, but I'd like some confirmation on it, and if possible, the mechanics of it. I wouldn't be surprised if this is in the documentation somewhere, but I couldn't find it when I searched for it.

What I do know is that Avoid doesn't "reduce" encounters as it says in the description - it either disables them, or has no effect on them. At least in practice, I don't know what happens in the code.

Mion Sonozaki

Quote from: Misery on 28, November, 2014, 01:11:15 PM
On the subject of random encounters - what does the Avoid psynergy check for? I suspect it's average party level vs recommended average for the current area, but I'd like some confirmation on it, and if possible, the mechanics of it. I wouldn't be surprised if this is in the documentation somewhere, but I couldn't find it when I searched for it.

What I do know is that Avoid doesn't "reduce" encounters as it says in the description - it either disables them, or has no effect on them. At least in practice, I don't know what happens in the code.

Very good question. I need to know this too, for golden sun redux.

Daddy Poi's Oily Gorillas

#9
QuoteSo turning the first value down and the second value up, reduces the rate of battles?
I hope so. As long as the code I didn't fully understand yet doesn't change that.

QuoteOnly those 5 values are unused? Bummer... REALLY Bummer...
0x46, 0x4D, 0x66-0x6A, 0x6C

There's a dash, there... I take it that you missed it.

QuoteI really hope we figure out what "other way" they're used
That was hypothetically speaking... I kind of doubt it myself.

QuoteSlightly offtopic, but how are backgrounds decided? Since a place like Madra has no combat BG... I think.
Via this table:

080EF984 = Assigns Battle Backgrounds to Maps
80000048 = Background index from Master File Table.
00000004 = Map: Venus Lighthouse
You can either assign another background be prefixing with 8*******, assign this background with another map as well (without the 8 flag), or end the list with 00000000.

You can look at the 16-bit at 02000436 to know what Battle Background you will get for the map you are currently on in-game.
Maps that aren't assigned a background get 0x49. (Because the last entry is 80000049 00000000.

---

The effect that boosts encounters, I believe makes encounters happen twice as fast.
Avoid's effect places 0x9600 at 020004A6 (I think it's actually 32-bit at 020004A4), just watching it count down makes it look like it's one per frame or something.
It temporarily disables them, because when the Avoid counter is used, the battle counter seems to stay still.

The battle counter is also 32-bit and is located at 02000498, just so you know all this data is together.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Mion Sonozaki

Quote from: Fox on 28, November, 2014, 01:54:56 PM

QuoteOnly those 5 values are unused? Bummer... REALLY Bummer...
0x46, 0x4D, 0x66-0x6A, 0x6C

There's a dash, there... I take it that you missed it.

So only 8 free spaces?

That's really, REALLY tight...  Still not much wiggle room for people making dungeons :/

Do we at least have a list which Battle Collections are not shared with other maps/dungeon? (For example, the Battle Collections used in  Aqua Rock?)

Since I'm revising every encounter in Golden Sun 2, I may end up having to document this all myself....  But I really would appreciate if anyone has anything mapped, and may be willing to share. (I am really hoping no dungeons share Battle Collections with the Overworld... augh...)

Do you have any tips how to look up things easier? In a normal text document, you use ctrl+f, but I'm not sure what exists to isolate the index and look up what uses what. Any tips?

Misery

Quote from: Fox on 28, November, 2014, 01:54:56 PM
Avoid's effect places 0x9600 at 020004A6 (I think it's actually 32-bit at 020004A4), just watching it count down makes it look like it's one per frame or something.
It temporarily disables them, because when the Avoid counter is used, the battle counter seems to stay still.

That would be the duration, then. It only disables encounters if the party's levels are high enough, and that's the part I'm interested in.

Mion Sonozaki

Quote from: Misery on 28, November, 2014, 02:39:14 PM
Quote from: Fox on 28, November, 2014, 01:54:56 PM
Avoid's effect places 0x9600 at 020004A6 (I think it's actually 32-bit at 020004A4), just watching it count down makes it look like it's one per frame or something.
It temporarily disables them, because when the Avoid counter is used, the battle counter seems to stay still.

That would be the duration, then. It only disables encounters if the party's levels are high enough, and that's the part I'm interested in.
So avoid doesn't reduce encounters? Only disables them if higher level?

Daddy Poi's Oily Gorillas

#13
Ah. You seem to be on to something.
I purposely set the levels to be low, Avoid still sets the 0x96, but this time the battle counter goes up. Hmm... I wonder if it ever slows down the battle counter or not? (Even if other values are compared first...) Or if it has 0 effect.
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Misery

QuoteFox: Ah. I see where Avoid counter is skipped now... And you have to have an average level that is higher than the Recommended level.  ... I'm guess Avoid doesn't amount to anything otherwise.
Thanks, that's what I wanted confirmation on.

Quote from: Fox on 27, November, 2014, 12:17:57 AM
0015 = Recommended average level of all PCs.  This may change the value to increment by slightly. It has a cap ranging a few levels.
So for this map, whichever one it is, if
[sum of party's levels] / [members in party] > 21
then Avoid would take effect... correct?

Daddy Poi's Oily Gorillas

#15
@Misery: Yes.

Here are the basic functions for random battles:

Quote080C9E48 = Assigns Battle Encounters to regular maps
080C9F2C = Assigns Battle Encounters to World Map
080C9FD8 = Random battles(encounters index,?)
080CA164 = Reqular maps - Random battles(encounters index slot) Arg is 0 or 1.
080CA17C = World Map - Random battles(addr for x/y?)
080CA18C = get_encounter_group(encounter, group)
080CA1A4 = 080EEF54 is encounter+group list. ; For djinn
The first two are obvious, they read the the Map and World Map tables to assign the encounters.
The one I have bolded is responsible for calculating when a random battle should happen. When it doesn't happen, it returns 0, when it does, it returns the Group to use, I believe.
The next two are simple functions that get the encounters index and call the bolded function... ... Also, these two functions should be called by the function located here:

080CB2B8 = Field psynergy recovery, djinn recovery... Happens whenever the 16-bit value at 020301A0 loops back to 0.
080CB3E4 = Player state/movement mode restrictions: have to be in modes 0, 1, 6, or 7 for the value to increase (counter pauses otherwise)

...which likely has everything to do with stats and stuff when moving around? ( I have not fully researched it, though. ) Since that function stores the group number in RAM, I suspect there's a frame loop function that is responsible for actually initiating the battle.

The last two in the list should be for djinn, so it's probably of little interest here.

Anyway, the bolded function is where the Avoid skip is done. ; I also think that it's important to mention that a random number is generated every new room you go to, and is also part of the equation for incrementing the battle counter. (The random number can be negative as well.)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)