Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#26 2013-10-28 08:40:26

Miksy91
Member
Registered: 2010-10-16
Post 1,943/2,339

Re: Map Connection Editing

Skurbert wrote:

There should be an easier way to do this. Kudos to you guys, who has the patience to deal with all of these numbers. You are the true heroes of this game. But for now on, we other can only stand aside and hope for better times, until there are easier methods of editing connections and size of the maps.

Still struggling about our goals.

It's just pure mathematics. You don't need general programming knowledge at all to deal with this.

See why the values in original map connections already built in the game are what they are, and write notes about them. That way, you should catch how to write connections datas on your own.

Offline

#27 2013-10-28 14:52:42

Skurbert
Member
Registered: 2012-12-16
Post 62/95

Re: Map Connection Editing

Miksy91 wrote:
Skurbert wrote:

There should be an easier way to do this. Kudos to you guys, who has the patience to deal with all of these numbers. You are the true heroes of this game. But for now on, we other can only stand aside and hope for better times, until there are easier methods of editing connections and size of the maps.

Still struggling about our goals.

It's just pure mathematics. You don't need general programming knowledge at all to deal with this.

See why the values in original map connections already built in the game are what they are, and write notes about them. That way, you should catch how to write connections datas on your own.

Well, that's the problem = Mathematics. :P

When figuring out things, I always try to see a common pattern in the code. But in this, I can't see any pattern at all. There's just too much to keep track of and that confuses me.

But yeah, maybe in the future...

Offline

#28 2013-10-28 20:24:26

Miksy91
Member
Registered: 2010-10-16
Post 1,946/2,339

Re: Map Connection Editing

Skurbert wrote:

Well, that's the problem = Mathematics. :P

Hahha! :D

Skurbert wrote:

When figuring out things, I always try to see a common pattern in the code. But in this, I can't see any pattern at all. There's just too much to keep track of and that confuses me.

But yeah, maybe in the future...

True, this ain't one of the easiest things to deal with.
But play around with the values and see what kind of changes take place in the game when you change them. There is a pattern and you're bound to find it sooner or later if you make the effort to figure this out :)

Offline

#29 2014-01-20 06:16:48

Miksy91
Member
Registered: 2010-10-16
Post 2,053/2,339

Re: Map Connection Editing

I was talking with "Vitharix" on Facebook the other day, and he asked if I could help out with map connections, so I made an example of map connection between Cherrygrove City and Route 30 (only Cherrygrove (N)). The following is a just a copy pasted message I wrote.


Now I assume you can get your own hands on Johtomap and a gold/silver rom so you can follow my explanation based on that.
So anyway, these are the values attached to the map connection from Cherrygrove City (North).

Dest. Bank: 26
Dest. Map: 1
Width: 10
Height: 10
X Alignment: 246
Y Alignment: 53
Current Map Position: C708
Window: C8B1
Pointer to "Connection Strip"s Upperleft Block (Connected Map): 60E7

Width stands for the width of the connected map, and Height stands for, how wide (in blocks) is the connection in the connected map. So in this case, we want to adjust the other values so that the connection begins at X coordinate 0 in the connected map and lasts till the end of the map (not sure if that just confused things since it's quite self-explanotary why would we set Height to 10). *these values are decimal of course.

Next, let's check Current Map Position which is actually the only difficult part about this. Like I have documented in my tutorial:
North: C703 + X Movement of Connection Strip

So X Movement of Connection Strip is 5. Why?

Let's check the map of Route 30. You can see a road block at X: 3, Y: 26 (Johtomap values), and there are 3 tree blocks on the left of it.
Then again, in Cherrygrove City map, the connecting road block is at X: 8 Y: 0, and if you now move 3 blocks to the left, you'll notice the position where the connection (should) begin. *You should be looking at the block of which X: 5 and Y: 0.

So now, we have actually found out the X Movement of Connection Strip. It's "5" because the connected map is "5 blocks away" to the right from the position where Cherrygrove City map starts (X: 0).

*I would imagine this value being (-5) if the connected map was 5 blocks away to the left, but I'm not sure.*
So now after checking this out, we can easily see why "Current Map Position" values is C708.

Next, let's calculate X and Y Alignments.

X Alignment (North/South): (X_movement_of_connection_strip_in_blocks * -2)
Y Alignment (North): (Height_of_connected_map * 2) - 1
--> X Alignment = 5 * -2 = -10 = 256 - 10 = 246
--> Y Alignment = 27 * 2 - 1 = 53


Next... Window.

Window (North): C701 + [Height of connected map] * [Width of connected map + 6]
--> C701 + [convert to hex] (27 * (10 + 6)) = C701 + [convert to hex] (432) = C701 + 1B0 = C8B1


And finally, Pointer to "Connection Strip"s Upperleft Block (Connected Map) which Johtomap should calculate accurately, but it doesn't. *It works in this situation, but if you try calculating it automatically from Route 30 - Cherrygrove connection (to South), it does not.*
So let's calculate it manually anyway.

Now, we have to open Route 30 and go first to the position where the connection start there. Since we adjusted X Alignment and X Movement of Connection Strip so that the connection should start in X coordinate 0 in this map (and Y Aligment is 53), the connection starts naturally at block (X: 0, Y: 26).

Now we'll have to adjust the pointer to point to the rom address of block at (X: 0, Y: 24). This is somehow related to the visibility of the area when you reach the connected map. So we (probably) point to the same X coordinate where the connection starts, but Y has to be that of minus 2.
*For reference check how this works for example between Route 29 and New Bark (or Cherrygrove City) map connections (since they're West-East).
(So since that tree-block at X: 0, Y: 24 is at rom address 0xAA0E7, the "Pointer to "Connection Strip"s Upperleft Block" is 60E7.

And that's about it.

Offline

#30 2014-09-10 14:14:20

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 206/450
Website

Re: Map Connection Editing

I will drop here the compilation of formulas that have always worked for me in case someone finds them useful. Some are set in stone, but others depend on what "feels right" for everybody. For example, I like to use a margin of three blocks in every side of the strip of connections to bigger maps, even though I think only two are needed in all sides but the right.

Anyway, the strip is an area that should cover all the possible blocks of the destination map that can be seen from anywhere in the origin map, whereas the strip pointer is the pointer to the block of the strip that has the lowest offset in the ROM (that is, the leftmost and upmost block of the strip). One could come up with formulas for the strip pointer for every type of connection, knowing the address of the first block of the destination map (like in the dissasembly of Pokemon Crystal), but I don't have them and it's easy regardless. Moreover if you are doing this with a hex editor it's much easier to just know the block's offset in the rom anyway.

Strip Destination:

North: C703 + X + V
West: C700 + (w+6) * (Y+3) + V
South: C703 + (h+3) * (w+6) + X + V
East: C6FD + (w+6) * (Y+4) + V

where:
h: Origin map's height
w: Origin map's width
Y: Y displacement (in blocks)
X: X displacement (in blocks)
V: 0 for Pokemon Gold / Silver and 100 for Pokemon Crystal

To calculate the X displacement (only N/S connections) you take the horizontal position (in blocks) of the leftmost block of the origin map minus the horizontal position (in blocks) of the leftmost block of the destination's map strip.
To calculate the Y displacement (only E/W connections) you take the vertical position (in blocks) of the upmost block of the origin map minus the vertical position (in blocks) of the upmost block of the destination's map strip.

V-align (yoffset in pokecrystal):

North: (h*2) - 1
West: (-2) * Y
South: 0
East: (-2) * Y

H-align (xoffset in pokecrystal):

North: (-2) * X
West: (2*w) - 1
South: (-2) * X
East: 0

Window:

North: C701 + (h) * (w+6) + V
West: C706 + (2*w) + V
South: C707 + w + V
East: C707 + w + V

Note that v- and h-aligns are not related to the strip so to calculate the X and Y displacements you have to take the leftmost and upmost block (respectively) of the destination map, and NOT of the destination map's strip unlike in the strip destination formulas (how confusing!). This is pure logic as the h and v aligns only have to do with the relative positions of the player in both maps.

Last edited by Crystal_ (2014-09-10 14:15:58)

Offline

#31 2015-02-23 05:54:35

Rocket Grunt
Member
Registered: 2014-12-27
Post 40/75

Re: Map Connection Editing

Like what Miksy91 said, it would be easier to do so in JohtoMap. Here is a list of Miksy91 <=> JohtoMap instruction:
He may has posted something like that above but this list looks more user-friendly :D
(Note: only JohtoMap 1.0.2 can edit map connection properly)

#1: [Bank of the connected Map] = Dest. Bank and in decimal
#2: [Number of the connected Map] = Dest. Map and in decimal
#3-4: [Pointer to "Connection Strip"s Upperleft Block (Connected Map)] = CSUBP in reverse order
#5-6: [Current Map Position] = OMDL in reverse order
#7: ["Bigness"] = Height and in decimal
#8: [Map Width] = Width and in decimal
#9: [Y Alignment] = Same but in decimal
#10: [X Alignment] = Same but in decimal
#11-12: [Window] = CMPDL in reverse order

You can also calculate CSUBP by using JohtoMap, and it's almost 99% accurate.

Last edited by Rocket Grunt (2015-02-23 06:12:30)


Today I won't steal Pokemon

Offline

Board footer

Powered by FluxBB