Player position data on save game, how does it work?

Hi, I’m playing with an experimental map generation and I’m having some trouble figuring out how to change the player position. I started writting this post VERY confused but trying to explain it helped and I think I figured out! Still I would like to confirm it.

I’ve been able to make sense of the coordinate system for the file on the maps folder: each subfolder (segment?) contains 32x32 files each one with 2x2 submaps of 12x12 tiles. So each file corresponds to an overmap tile.

But for the player position we need to take regions (180x180 overmap tiles) into account and it gets weird. Looking at {saveId}.sav file I see:

  • "om_x" / "om_y": these seemed to be the overmap region. I.e.: if on the overmap it says LEVEL L, A'X, B'Y then { "om_x": A, "om_y: B }. But it’s offset by 60 tiles or 2,5 overmap tiles.
  • "levx" / "levy": these seemed to be the submap index in the given region. Again, offset by 60 tiles / 2,5 overmap tiles.

Making the conversion of the 60 tiles to 2,5 overmap tiles I realized that this is exactly the size of the reality bubble. So if I understand correctly, the position saved on the {saveId}.sav file is not the player position but the TOP-LEFT corner of the reality bubble, right?

EDIT: I found another weird thing. In {saveId}.sav the "player": { "posx": X, "posy": Y } values are always between 60 and 71. I think that’s because is the relative position from the top-left tile of the submap specified in "levx", `“levy”… right? O_o

Thanks!

Yes.

I’ve written about that in an older post, Save corruption proble - #3 by Valase, in the “Step by step guide to get the coordinates” spoiler at the end of that post.

I go a bit more into details in another post, but that’s basically it.

The reality bubble is always centered on the player. Therefore, the player always stays around the center in local coordinates.

1 Like

Thanks a lot, that guides are very good reference to test my code!

Regarding the 60-71 range values, I was editing my post when you replied and I think I got it:

Now it kind of make sense but oh boy I was confused by the 60 tiles offset.

1 Like

Yeah, it’s a bit confusing, it took me a while to figure out what was actually going on…
And if the reality bubble - for whatever reason - should ever be planned to get “detached” from the player (multiplayer, to just name one example, no matter how unlikely it is), the system might have to change…

1 Like