0
votes

First off, I am not sure if this is the right place so I apologize if this belongs elsewhere - please let me know if it does. I am currently doing some prototyping with this in VB so that's why I come here first.

My Goal

I am trying to make a program to be able to log different types of information for a video game that I play. I would like to be able to map out the entire game with my program and add locations for mobs, resources, etc.

What I have

The in game map can be downloaded so I have literally just stuck this in as a background image on the form (just for now). The map that I get downloaded though is not exactly as the map appears in the game though since the game will add extra water around everything when scrolling around. This makes it a bit tricky to match up where the origin for the map is in game compared to where it would be on the downloaded map.

The nice thing though is that while I am in the game I can print my current coordinates to the screen. So I thought that maybe I can somehow use this to get the right calculation for the rest of the points on the map.

Here is an example image I will refer to now: Example Map

In the above map you will see a dotted bounding box. This is an invisible box in the game where once you move your mouse out of the longitude and latitude points will no longer show. This is what I refer to above when I mean I can't find the exact point of origin for the in game map.

You will also see 2 points: A and B. In the game there are teleporters. This is what I would use to get the most accurate position possible. I am thinking I can find the position (in game) of point A and point B and then somehow calculate that into a conversion for my mouse drag event in VB.

In VB the screen starts at top-left and is 0,0. I did already try to get the 2 points like this and just add or subtract the number to the x and y pixel position of the mouse, but it didn't quite line up right.

So with all this information does anyone know if it is possible to write a lon/lat conversion to pixels based on this kind of data?

I appreciate any thoughts and suggestions and if you need any clarification of any information I have posted please let me know and I will be happy to expand on it. I am really hoping I can get this solved!

Thanks!

EDIT:

I also want to mention I am not sure if there is an exact pixel to lat/lon point for the in game map. I.e. the in game map could be 1 pixel = 100 latitude or something. So I might also need to figure out what that conversion number is?

1
Is the size of the map same with the game? If yes, let say the point A in game is 123,123, and pin it as 0,0 in VB, then next point should be the lat/lon related to point A (123,123), i.e. point B (223, 223) should be (100, 100) in VBPrisoner
Ah I should have specified that. No the map sizes are waaay different. But going off of your idea, how would I pin a point to a certain value or how can I change the point of origin of the window in vb if possible?Nick Young
It should be scale instead of the size... btw, you mention you have tried to pin the Point A and Point B in your map, but not quite line up right, is the scale problem?Prisoner
Yeah I think that might be part of it. See my edit also, is that what you mean?Nick Young
If you can pin point A and point B, just calculate the distance between them in game and in VB, so that you can calculate the scalePrisoner

1 Answers

0
votes

Some clarifications about conversion between the pixel location to 'latitude and longitude'.

First the map in your game is in a geometry coordinate system, which means everything lies in 2D and you can measure the distance between two points by calculate the pixel position.

But when we talk about longitude and latitude, we are actually talking about a geography coordinate system, which is a '3D' model of the sphere oabout the surface of the earth. All the maps on earth are abstracted from 3D to 2D through one step called projection. Like google maps or your GPS. In this projection process, the 3D model converted to 2D model but there is always some part of the map will be tortured, so that same distance in pixels on a map could be different in length in reality.

So if you don't care about the accuracy then you can consider the geometry point as geography point. Otherwise, you need to implement some GIS library to handle the geodesic distance and calculate the geography point based on the projection coordinate system.