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

[SOLVED] Overworld enemy groups: Treasure Isle, Dekhan Plateu issues

Started by Caledor, 12, June, 2016, 05:29:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Caledor

I just noticed that on the overworld, in the land outside Treasure Isle, the monster groups battled here are the same battled on land in the Western Sea instead of Eastern Sea. Basically, both Treasure Isle and Hesperia/Atteka/etc load the groups from 080EEECC-080EEEEA (groups 4E-4F).
My question is: does anybody know which instruction must be tweaked to change the encounters outside Treasure Isle (to match Western Eastern Sea for example)?

EDIT: fixed

Salanewt

I'm not sure on the specifics of this section, but the GS2 documentation has these lines which may help you out a bit. At the very least you can get an idea for how it works by taking a look; I would say more if I actually knew (my focus has been on other areas), so my apologies for that.

Quote080C9E48 = Assigns Battle Encounters to regular Maps
080C9F2C = Assigns Battle Encounters to World Map
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

#2
Quote
080EDACC = Battle Encounters
0000 = Encounter rate/frequency.
0000 = Recommended level for average PC. (Higher than this (up to +5) may makes battles happen sooner.)
0000 *8 = Monster Group indexes
00 *8 = Which battles are more common than the others.
Note: x080EE060 - Lemuria Ship random encounters(?)

080EE6D4 = Assigns Battle Encounters to Maps
000E = Room
FFFF = Door
FFFF = Story flag Index
0011 = Battle Encounters Index

080EEDBC = Assigns World Map Battle Encounters
0001 = Movement Type (0001=Felix, 0007=Ship, 0008=Ship+Hover, 0009=Sand; 0008/0009 don't cause battles.)
0004 = Terrain type
FFFF = Story flag Index
000E = Battle Encounters Index


080EEF54 = Djinn battles?
0001 = Battle Encounters Index
0001 = Group (Which of the eight monster groups? (0-7))
If the difference happens to be terrain, you may want to edit the map data. (Which is compressed.)

First, what is flag 0x8EF?

wait.
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! :)

Caledor

#3
I don't think it's a issue with terrain, but more with the "zone".

I mean... to give different portions of the map different group encounters, the world must be divided in sections somehow... and each section must have a value assigned that tells which monster groups to load (from the table that starts at 080EEDBC in fox's post, that i used to determine the addresses 080EEECC-080EEEEA that are used by the zones Hesperia, Atteka and outside Treasure isle to load certain enemy groups).

Given that premise (which is just a rough guess of mine), what i think is (another guess): there must be, somewhere in the code... a "treasure isle zone" with some instructions or value that affects which address to load from the table at 080EEDBC. That's what i want to change. I want that value/instruction to load another address, thus changing enemy groups encountered there.

I can't change the values at 080EEECC-080EEEEA themselves cause that'd have the side effect of changing encounters in Hesperia/Atteka as well and i don't want that.

Daddy Poi's Oily Gorillas

#4
Note to future readers: Conversation occurred in the chatbox, but I shall summarize:

Basically, I was referring to the difference between Eastern and Western, rather than Western and Treasure Isle...
The results were that the Eastern ones were using Movement Type 0004, and the Western/Treasure Isle were using Movement Type 0005.
As it turns out, Map data sets the Movement Type stuff, and also affects terrain type.

You can see World map data in RAM at 0x02020000. Only the section in which you are in is loaded here, though.... Each tile should be four bytes long... The fourth byte in each tile is what we're interested in. 6-bit for movement type. The other two bits are also used for something as well, but may not need any editing? Basically, I'm thinking you just change all the 5's to 4's, maybe. (Depends on if these are the only battles that are here, and the only ones you want to change.)

Unfortunately, map data is compressed, so you need some type of work-around... Options I see are:
-Compress the normal/most expected way.
-Read as uncompressed. (Code an exception.)
-Code something that reads the data a bit differently based on your X/Y location. (So if it gets 5 when your x/y location is over there, it becomes 4.)

I probably could do what I did with my Icon Compressor and make a simple console application to compress.... But depending on what the compression format is. (Will have to check which one it used first / if it is one that is as easy to make as the Icon Compressor one.)  Can't say when I'll actually create it, though... (Assuming I do?)
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! :)

Caledor

So they differentiated the 2 by using different movement type ID? Wouldn't this mean that Tundaria, West Osenia, Northern Indra and Southern Indra have all different movement type ID?

Daddy Poi's Oily Gorillas

#6
Yes, pretty much...

Tundaria Tower uses id 0x4, though... But do take note... Terrain Type 0x5 and 0x6 is snow (land/forests), so that's where that one is different. The part right up near it is id 0x8, though... which doesn't have battles.
(The value being >0x28 in the map data is how it is labeled snow.)


Not sure about the others....

It's the 6-bit divided by 20 (0x14)... the remainder is what is used in comparison to the Movement Type values in the table....

00 = Unused
01 = Near Daila (And unused Angara.)
02 = (East of Osenia Cliffs)
03 = (West of Gondowan Cliffs)
04 = Eastern Lands
05 = Western Lands
06 = (Found in unused Angara.) (South of Gondowan Passage?)

07/08/09 = For water/boat tiles?
07 = Eastern seas (North of Gondowan Cliffs)
08 = Western seas (South of Gondowan Cliffs)
09 = Eastern seas near Lemuria (Possibly related to fog?)

0B = Starts just before Dehkan Plateau ... Includes near Madra.,... not sure if anywhere else yet. (East of Gondowan Cliffs ; west of Osenia Cliffs)

0C/0F = Desert
0C = Air's Rock

10 = Prox area

12 = Kibomba/Gabomba Statue

Terrain Types:
00 = -
01 = Grassland
02 = Forest
03 = Desert
04 = Beach
05 = Snowland
06 = Snow forest (Same as snowland bg. Below may have matching bgs too.)
07 = Beach
08 = Ship - Normal areas
09 = Ship - Snowy areas
0A = Ship - ? (Normal areas)
0B = Prox area - Storm snowy land..
0C = Prox area - Storm snowy forest..
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! :)

Caledor

#7
So... it looks like it comes down to changing certain 05s to 04s, which seems pretty easy. Too bad the compression is kinda letting me down... i don't think it'd be worth the effort.

EDIT: I'll try to see if i can at least make the northern reaches overword different from western sea.

Daddy Poi's Oily Gorillas

#8
The options I listed:
Quote-Compress the normal/most expected way.
-Read as uncompressed. (Code an exception.)
-Code something that reads the data a bit differently based on your X/Y location. (So if it gets 5 when your x/y location is over there, it becomes 4.)
Well, the type of compression is mainly just Distance Length.... And since I now know which one, I want to add another option....

-Put a "00" before every 8 bytes... (Basically reads everything as a constant, but makes the file-size 1/8th longer than uncompressed version since Distance/Length wasn't utilized.)

Note that if the data is taken from RAM, things may need to be re-ordered/etc., I think.... May not be in the same way that normal maps do it, but anyway. - Each World Map file is basically 16x16=256 tiles.... And it's 0x40 bytes for first, skip 0x40, next 0x40 for second... Something according to that....

Think I will try my hand at that console app....? Good idea? (It's like LZ77/LZ78, without the 32-bit header.) Maybe it be possible to automate the separation/make multiple compressed files? (Probably about 4 or 8 or something... (Depending on if the second layer is separate or not.)
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! :)

Daddy Poi's Oily Gorillas

#9
Congratulations on 500 posts, Caledor!


It's been 5-6 days, and I decided I wanted to post the compression program I've made... (Format 1)... Let me know how it goes.

Basically... You go to the area on the world map that includes data you want to edit/compress... You open memory viewer, go to 0x02020000, and dump 0x2000 bytes. (Or you could dump 0x800, 0x1000, 0x1800... for 2,4, 6... or 8 files respectively. I save them as out0000.dmp, out0040.dmp, out0800.dmp, out0840.dmp, out1000.dmp, out1040.dmp, out1800.dmp, out1840.dmp ; The numbers are based on the offset postions where they start in your dump.)

And to know which file is which might be as simple as comparing it to VBA's Map Viewer but may need to make sure. (0x02020000 is 4 files of the bottom layer, and 0x02021000 is four files of the upper layer.)

It is likely possible to add something that could change the 4's to 5's to make the editing process easier, but I left that out b/c this program is only for compressing.

(Oh, and the exe is in bin folder... you may choose Debug or Release.)


(I assume you know how to find the map data in the ROM... You can probably follow above (extracting from 0x02020000)... compress it without editing (raw)  and open a hex editor/search for it.... (Only if my program compresses an exact equivalent of what you search for... which might be likely, but one can't be 100% sure without comparing every file. That could be done programmatically.) The pointers pointing to the file are Relative Pointers, though... Not Direct Pointers.... But it is as easy enough as looking through the Master File Table (0x08680000 in GS2.) for the latest pointer that comes before the data you find.)
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! :)

Caledor

#10
Wow, thanks a lot Fox!

I'll give it a try right now and edit this post later to tell you how it goes.

EDIT 1: I've found some of the 05s that need to be changed to 04s (there's more than 1 bank)... which is a nice start. going to bed now will continue tomorrow

EDIT 2: about the dumps... are you sure that those are the right offsets? shouldn't they be 0x400, 0x800, 0xC00 etc? Don't really know, i'm just asking.
Also, about the values to change. Is there a certain way to know which values need to be changed? Cause i've found them but i'm not sure if they all need to be changed or some of those 05 have another purpose. ATM i just noticed that the 05 i'm looking for are in the even columns of the memory viewer when you set the starting address at 0202000 with 16-bit view (pretty easy to notice this way, cause those values are either 07 or 05).

Also, i tried compressing one of the 2 dumps, and i noticed that it's different from the data inside the rom despite being untouched... maybe it has to do with the relative/direct pointers thing, but i'll look into that another time.

Daddy Poi's Oily Gorillas

#11
@2: Yes, I am sure... The files are flip-flopping together like that..  I mean like.... 0x40 bytes of file 1 first.... then 0x40 bytes of File 2, then 0x40 bytes of File one... 0x40 bytes of file two again.. etc. (It's 0x80 bytes per row.. File 1/3 is the left side, File 2/4 is the right side.  I would think VBA's Map Viewer should help. Like if you replaced the pointer/reference to the compressed file to 00000000, and load world map. The files are like perfect squares. - Edit again: You could technically open your dump in hxd, and view 128 bytes/row as 32-bits if you wanted to... easier to read that way.

05 values... Basically 6-bit value / 0x14, remainder 5 is what you may want to edit... (So numbers like 0x19 count too.) But I'm not seeing anything other than it being the 5 at the Treasure Isle place...  and the 7s (or whatever) should be water.... Tiles are in 32-bits here... so I would have throught using 32-bit would be even easier than 16-bit?

@Last: I only checked one file... so it may or may not be perfect... but even if it doesn't match the compression, it might still decompress into the same data... (As long as you dumped it correctly. (From 0x02020000 for example.) I suppose you could check that.



Off-topic: Based off looking at Atrius's source code... I think GS might have another compression format I have not documented... but I will need to look into this.



---
@Regular Maps: Flip-flopping can be true with regular map layers as well. (At different offsets.) (However, regular maps are just a single file.) (Exception may be with larger maps... since the stride is always 0x200 bytes to get to the next row... Which means the maximum width a regular map can be is like 128/0x80 tiles.) However, regular maps also separate their data into three groups (For better compression, obviously.)... However, I suppose this is a bit off-topic.
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! :)

Caledor

#12
wait a min it's a single dump? i thought they were 2 dumps cause when you walk to the westernmost part some bytes in memory at 02020000 change.

I still don't think i've understood the
Quote0x40 bytes of file 1 first.... then 0x40 bytes of File 2, then 0x40 bytes of File one... 0x40 bytes of file two again.
part, cause i tried dumping, compressing right away and comparing, and the first 80 bytes of the 0x0000 dump do match with the rom.
basically it doesn't look like it's 40 from the first and 40 from the second.

Oh, and... is there some pattern for enemy groups tied to types of terrain? Like, certain enemy groups being more common/exclusive to beach/wood/field/whatever...?
Cause I noticed that for eastern sea's land areas non-forest terrains use 35 as enemy groups ID, while forests use 36. moreover, 34 and 37 call other enemy groups (respectively eastern sea while on boat and taopo swamp, coherent with the order displayed by the editor). So... how does that +1 affect which enemy group is chosen for battle?

Daddy Poi's Oily Gorillas

#13
Depends on how many files you need to edit.... Treasure Isle should only require one dump.

Quotecause when you walk to the westernmost part some bytes in memory at 02020000 change.
That would be the 0040 section changing... (Right side of Map Viewer.) A whole file should load at one time, but the Map Viewer may only load what may be necessary.... So that what I was saying is more clear, I've attached an image in the attachment.

For Treasure Isle, I think you'll only need out0000.... As the 0040 one is out in the ocean. (Whether it is ocean on the east side or west side depends on where you are on the island.)

Also, the compression may not be an exact match, unfortunately... But it may seem very close...  But I shall investigate. (Not sure if this ruins anything yet, though. Probably doesn't/Might still work fine. ... It appears to still be the same compression ratio... so that is a good thing, at least. It's possible something could be switched around... which might not break compression, but anyway...)



As for the table at 080EEDBC... It looks like it is mostly in order by story/gameplay.... :) Which seems interesting. It almost feels like 01/02/03 were continent specific...(?) and then they added in 0B/0C/12 for specific reasons later on... possibly for more variety.
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! :)

Caledor

#14
2 goddamn bytes: it can be summed up like this. The out0000.dmp after changing the 05s to 04s is 2 bytes bigger than the original compressed dmp. Everything else you said was correct: only 0000.dmp changes, and while the untouched compressed dump is different from the original, they are identical once decompressed.

Daddy Poi's Oily Gorillas

#15
Two god-blessed bytes... So that they go away in unity... Cursed bytes might come back and seek revenge for being cursed, right? :P

On a more serious note, what do you plan to do to remove the additional two bytes? Reshape Treasure Isle/Ocean slightly?
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! :)

Caledor

Quote from: Fox on 25, June, 2016, 10:32:59 AM
Reshape Treasure Isle/Ocean slightly?
Nice idea! I'll try making some random changes cause i have no idea how are the other bytes used (i'll learn while messing with it)

Daddy Poi's Oily Gorillas

#17
32-bit/tile... I may not know all the data... But I think the 2 bytes on the right are the graphic tile. (Index to the mini-tiles listed at 02010000.)  May or may not be exactly 16-bit.. (Forgot. Might be some bits in there for other things like priority.)... We mostly already know the byte on the left. (Pretty much Type/properties of the tile... The 6-bit should also affect the tileset loaded.... 0-19, 20-29, 30-39, 40-49 ... are the four tilesets, I think.)... I'm guessing the remaining byte (That is often 00 or FF) is probably collsion-based... But I didn't check to make sure.


@Type: 0x12 and 0x09 are specific for darkness/fog effect, I believe... 0802D0B0 (Fog), 0802D0CE (Darkness)... These values can be edited to make them darker/lighter. But I still need to look up the specifics on the snow effect near Prox.
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! :)

Caledor

Aaaand IT'S DONE!

Even better, I managed to make the whole thing 2 bytes shorter by FIXING a few beach/grass tiles: while i was tinkering with bytes here and there, i noticed that those Cs and 8s in the encounter byte (C5, 85...) affect random battles. The C disables encounters and 8 sets the terrain to beach. A few beach tiles had C instead of 8 and a grass tile had it's encounter byte set to 07 (sea) instead of 05/04, which disabled battles there (instead of showing sea monsters while walking).

Thanks a lot for your help and your efforts Fox, I really appreciated it.

Daddy Poi's Oily Gorillas

I was thinking the 0x40 flag indicated places you could get on/off ship from... but wasn't sure. (Didn't verify.) (And then the 0x80 flag was for Beach.)

In any case, if an index is used that isn't listed in the table... that is what I think disables battles... 06 isn't listed in the table, but it is used in latter part of the GS1 map for GS2.

Edit: I mean that the PC and Ship use separate tables.


You are welcome!
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! :)