Endebert / squadmc-maps

repository for squadmc holding the only the map image files
MIT License
22 stars 14 forks source link

Question: Calculating map sizes in PS #13

Open sirdoombox opened 4 years ago

sirdoombox commented 4 years ago

I'd like to contribute, but I have precisely 0 idea on how you go about making accurate map size calculations for Post Scriptum, is there a resource for the methodology available somewhere?

sh4rkman commented 4 years ago

I'll let @Endebert answer properly, but i had to analyse this part of the calculation in Endebert's code.

Short answer : the SDK maps are already proportional in pixels to their real size in game, you have to calculate the ratio between your canvas where you draw the map and the image file.

For my fork of this project (https://github.com/sh4rkman/MSMC) i drawed a 250px*250px canvas, and applied to every distance calculated the ratio 250/map.height

sirdoombox commented 4 years ago

I managed to find a slightly more consistent and accurate way in Post Scriptum (seeing as the SDK isn't out yet and the map image files are all 4096x4096) with training mode + commands

It's extremely labour intensive, but without the SDK it seems like it's the only way. As for incorporating heightmap data I don't think that's really doable as it stands, whether or not it has any meaningful impact I've yet to test.

Endebert commented 4 years ago

Thanks for wanting to contribute! Here's my methodology:

  1. crop screenshot of fully zoomed out map with grid on: image
  2. count pixels of fully displayed 100m blocks
    • now you know x*px = y*100m
  3. extrapolate to full image width image
  4. do the same for height
  5. put the data in mapdata.json

Of course, this isn't perfect. In this example, 1px = ~3,601m, so the estimated map size might be off +-4m, which I think is acceptable.


Now heightmaps are a different league, and can only be extracted with the Squad SDK. But we don't have that for Post Scriptum (I think; I don't own the game), so no height offsets for that game unfortunately.


@sh4rkman nice fork!