Custom Radar Map

Started by umar4911, Apr 20, 2019, 05:52 AM

Previous topic - Next topic

umar4911

I got a map which is loaded perfectly and now I want to load its custom radar. What are sections and regions of map? How can I trace the section and region of a location?
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

D4rkR420R

[noae]
Quote from: GangstaRas on Mar 31, 2018, 05:49 PMThe entirety of the map with all 64 PNGs (00 to 63) equates to a resolution of 1024x1024, that means the map is divided into 8 rows and 8 columns (at 128x128 resolution). So from the top of the map to the bottom:

1st row -  00 to 07
2nd row - 08 to 15
3rd row -  16 to 23
4th row -  24 to 31
5th row -  32 to 39
6th row -  40 to 47
7th row -  48 to 55
8th row -  56 to 63


Now with your image editor of choice (I use GIMP), if you grid the image with rulers into 8 equal parts on the x and the y axis, the full map is now setup to have each of these individual sections. A result like this:



That would give you a general idea of the positioning of where you want to be. Now for the accuracy to get things exact (involves some maths):

The landscape of Vice City is 3900 m x 3900 m (in game units), with the coordinate range setup a specific way for the x and y axis:

X axis = -2350 to 1550
Y axis = -1950 to 1950

Whatever object you look at in Moo Mapper or MEd or KEd, the coordinates of the object will always fall within those X and Y boundaries. Anything that exceeds those boundaries is not on the map, it will be shown in-game but it cannot be accessed by the player. How you would translate this onto the map you're drawing is as follows:

1. Get the coordinate of whatever object you're referencing
- for example sake, let's say the ingame object has a coordinate of 540, 260

2. Calculate the position of the object in percentage
- This is the make or break step that determines whether things will work out moving forward

To calculate the percentage properly, you need to regard the layout of the boundaries. The X axis starts at coordinate -2350, NOT 0. Therefore, you have to calculate that 540 coordinate in relation to -2350, the starting point, and the total range, which is 3900. Forget the ending point of the X axis (1550) for now, it only proves that the total range is 3900.

So, position in percentage (X axis):

[ object coordinate - starting point ] / 3900 x 100%
[ 540 - (-2350) ] / 3900 x 100%
2890 / 3900 x 100%
= 74.10%

You do the same with the Y axis and its respective range and coordinates, so you should get:

[ 260 - (-1950) ] / 3900 x 100%
2210 / 3900 x 100%
= 56.66%


3. Apply these percentages to the pixel coordinates of your image in your image editor
- This is the final step to draw the position accurately onto your radar map

You take the respective X and Y axis percentage value and multiply it against the respective X and Y axis full image resolution, which is 1024 x 1024, NOT the little radar squares from the grid which is 128x128. Don't care about them as yet.

So the position to draw the point is:

74.10% / 100% x 1024 (X axis) = 758.784 = 759   (rounded to the nearest whole number)
56.66% / 100% x 1024 (Y axis) = 580.1984 = 580 (rounded to the nearest whole number)

Remember to round the numbers as there is no decimal pixel

So in your image editor, looking at the status bar to check where your cursor is currently located across the image, you draw your point or representation you'd like of the object on the map at 759 ,580 of the image.

From this coordinate you can also deduce which of the 64 images would likely be the one to edit and replace. This is done by dividing the respective X and Y coordinate by 128 pixels. So with this example you would get:

759 / 128 = 5.93 (X axis = column)
580 / 128 = 4.53 (Y axis = row)

Now with these numbers you need to count correctly. Count the image spaces not the grid lines. You should therefore get that this image lies in the 4th row and is the 5th image.

So, using the table I gave at the start, the 4th row means images 24 to 31 are the options, the 5th image in that row, is image 28, so you would be editing and replacing radar28 from this example.

Hope this helps, and any further questions on the matter, feel free to ask
[/noae]

umar4911

my axis are:
x = 1000
y = -1000
After the math formulas:
x = [1000 - (-2350)]/3900 = 0.86 * 1024 = 881/128 = 6.8 = 6th column
y = [-1000 -(-1950)]/3900 = 0.19 * 1024 = 195/128 = 1.5 = 1st row

means section5.png

Doesn't appear on that. What's wrong I am doing?
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

umar4911

RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter