Also, on the Wiki, for the New Galaxy Guide, there's a clickable sector map, and in the Wiki code page it has entries like this for each planet:
Code: Select all
{{ClickMapEntry|Name=Tibedied|Sector=1|XPos=2|YPos=90|XPosRel=7|YPosRel=136}}
Moderators: winston, another_commander
Code: Select all
{{ClickMapEntry|Name=Tibedied|Sector=1|XPos=2|YPos=90|XPosRel=7|YPosRel=136}}
There are two things that stop this working.phkb wrote:the standard geometric function SQRT((X2-X1)^2 + (Y2-Y1)^2) doesn't seem to match the actual distances in game.
Code: Select all
var dx = x1 - x2;
var dy = Math.floor((y1 - y2)/2);
return (Math.floor(Math.sqrt((dx*dx)+(dy*dy)))*0.4);
Can anybody help with this, please?cim wrote: ↑Mon Jan 12, 2015 7:22 amThere are two things that stop this working.phkb wrote:the standard geometric function SQRT((X2-X1)^2 + (Y2-Y1)^2) doesn't seem to match the actual distances in game.Here's a JS version of the formula.
- Both coordinates are measured 0-255, but the Y-coordinate describes half the distance
- For compatibility with Elite, the calculation uses integer maths to calculate in units of 0.4 LY
The XPosRel and YPosRel coordinates appear to have been normalised to put both X and Y into the same units, which I suspect - without checking - is "pixels on the map on the Wiki".Code: Select all
var dx = x1 - x2; var dy = Math.floor((y1 - y2)/2); return (Math.floor(Math.sqrt((dx*dx)+(dy*dy)))*0.4);
Code: Select all
== Map ==
[[Sector7/The Ceraso Hub (Region)|The Ceraso Hub]] consists of the systems [[Sector7/Anisinza|Anisinza]], [[Sector7/Ceraso|Ceraso]], [[Sector7/Ceerti|Ceerti]] and [[Sector7/Gebeti|Gebeti]].
Code: Select all
<div style="position:relative">{{ClickMapHeader|Sector=7|Image=Sector7_The_Ceraso_Hub_RegionMap.png}}
{{ClickMapEntry|Name=Anisinza|Sector=7|XPos=19|YPos=14|XPosRel=???|YPosRel=??}}
{{ClickMapEntry|Name=Ceraso|Sector=7|XPos=13|YPos=1|XPosRel=???|YPosRel=??}}
{{ClickMapEntry|Name=Ceerti|Sector=7|XPos=1|YPos=9|XPosRel=???|YPosRel=??}}
{{ClickMapEntry|Name=Gebeti|Sector=7|XPos=0|YPos=15|XPosRel=???|YPosRel=??}}
{{ClickMapFooter}}</div>
Code: Select all
{{SectorTableHeader}}
{{SectorTableEntry|Name=Anisinza|Sector=7|System=90|XPos=19|YPos=14|Government=3|Economy=6|Techlevel=7|Population=3.4|Inhabitants=Human Colonists|Productivity=7616|Hubcount=2|Description=The world Anisinza is scourged by deadly disease.}}
{{SectorTableEntry|Name=Ceraso|Sector=7|System=113|XPos=13|YPos=1|Government=5|Economy=1|Techlevel=11|Population=4.7|Inhabitants=Fierce Yellow Fat Humanoids|Productivity=30456|Hubcount=3|Description=The planet Ceraso is reasonably fabled for its exciting sit coms and its inhabitants' exceptional love for food blenders.}}
{{SectorTableEntry|Name=Ceerti|Sector=7|System=62|XPos=1|YPos=9|Government=1|Economy=3|Techlevel=7|Population=3.5|Inhabitants=Fierce Slimy Frogs|Productivity=8120|Hubcount=2|Description=This world is a revolting little planet.}}
{{SectorTableEntry|Name=Gebeti|Sector=7|System=126|XPos=0|YPos=15|Government=1|Economy=7|Techlevel=2|Population=1.3|Inhabitants=Large Green Lizards|Productivity=1560|Hubcount=2|Description=Gebeti is very fabled for its ancient Gebetian Et banana plantations.}}
{{SectorTableFooter}}
[[Category:Sector7/Region|The Ceraso Hub]]
{{RoutesAndRegionsSector7}}
I guess what you are after is ultimately an HTML Image Map.Cholmondely wrote: ↑Mon Nov 01, 2021 11:48 pmCan anybody help with this, please?
Cody & I want to finish off this page and get it up on the wiki.
This is the problematic bit: how on earth do I calculate the XPosRel & YPosRel values?Code: Select all
== Map == [[Sector7/The Ceraso Hub (Region)|The Ceraso Hub]] consists of the systems [[Sector7/Anisinza|Anisinza]], [[Sector7/Ceraso|Ceraso]], [[Sector7/Ceerti|Ceerti]] and [[Sector7/Gebeti|Gebeti]].
[/code]Code: Select all
<div style="position:relative">{{ClickMapHeader|Sector=7|Image=Sector7_The_Ceraso_Hub_RegionMap.png}} {{ClickMapEntry|Name=Anisinza|Sector=7|XPos=19|YPos=14|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Ceraso|Sector=7|XPos=13|YPos=1|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Ceerti|Sector=7|XPos=1|YPos=9|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Gebeti|Sector=7|XPos=0|YPos=15|XPosRel=???|YPosRel=??}} {{ClickMapFooter}}</div>
I have figured out how it works.Cholmondely wrote: ↑Mon Nov 01, 2021 11:48 pmCan anybody help with this, please?cim wrote: ↑Mon Jan 12, 2015 7:22 amThere are two things that stop this working.phkb wrote:the standard geometric function SQRT((X2-X1)^2 + (Y2-Y1)^2) doesn't seem to match the actual distances in game.Here's a JS version of the formula.
- Both coordinates are measured 0-255, but the Y-coordinate describes half the distance
- For compatibility with Elite, the calculation uses integer maths to calculate in units of 0.4 LY
The XPosRel and YPosRel coordinates appear to have been normalised to put both X and Y into the same units, which I suspect - without checking - is "pixels on the map on the Wiki".Code: Select all
var dx = x1 - x2; var dy = Math.floor((y1 - y2)/2); return (Math.floor(Math.sqrt((dx*dx)+(dy*dy)))*0.4);
Cody & I want to finish off this page and get it up on the wiki.
This is the problematic bit: how on earth do I calculate the XPosRel & YPosRel values?Code: Select all
== Map == [[Sector7/The Ceraso Hub (Region)|The Ceraso Hub]] consists of the systems [[Sector7/Anisinza|Anisinza]], [[Sector7/Ceraso|Ceraso]], [[Sector7/Ceerti|Ceerti]] and [[Sector7/Gebeti|Gebeti]].
Code: Select all
<div style="position:relative">{{ClickMapHeader|Sector=7|Image=Sector7_The_Ceraso_Hub_RegionMap.png}} {{ClickMapEntry|Name=Anisinza|Sector=7|XPos=19|YPos=14|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Ceraso|Sector=7|XPos=13|YPos=1|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Ceerti|Sector=7|XPos=1|YPos=9|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Gebeti|Sector=7|XPos=0|YPos=15|XPosRel=???|YPosRel=??}} {{ClickMapFooter}}</div>
Code: Select all
{{SectorTableHeader}} {{SectorTableEntry|Name=Anisinza|Sector=7|System=90|XPos=19|YPos=14|Government=3|Economy=6|Techlevel=7|Population=3.4|Inhabitants=Human Colonists|Productivity=7616|Hubcount=2|Description=The world Anisinza is scourged by deadly disease.}} {{SectorTableEntry|Name=Ceraso|Sector=7|System=113|XPos=13|YPos=1|Government=5|Economy=1|Techlevel=11|Population=4.7|Inhabitants=Fierce Yellow Fat Humanoids|Productivity=30456|Hubcount=3|Description=The planet Ceraso is reasonably fabled for its exciting sit coms and its inhabitants' exceptional love for food blenders.}} {{SectorTableEntry|Name=Ceerti|Sector=7|System=62|XPos=1|YPos=9|Government=1|Economy=3|Techlevel=7|Population=3.5|Inhabitants=Fierce Slimy Frogs|Productivity=8120|Hubcount=2|Description=This world is a revolting little planet.}} {{SectorTableEntry|Name=Gebeti|Sector=7|System=126|XPos=0|YPos=15|Government=1|Economy=7|Techlevel=2|Population=1.3|Inhabitants=Large Green Lizards|Productivity=1560|Hubcount=2|Description=Gebeti is very fabled for its ancient Gebetian Et banana plantations.}} {{SectorTableFooter}} [[Category:Sector7/Region|The Ceraso Hub]] {{RoutesAndRegionsSector7}}
Code: Select all
XPosRel = XPos / horizontal-range * (width - left-margin - right-margin) + left-margin - ((box-width - 1) / 2)
YPosRel = YPos / vertical-range * (height - top-margin - bottom-margin) + top-margin - ((box-height - 1) / 2)
Alas, while I think I vaguely comprehend what you are doing (margins, et al) I've no idea as to how to use it (we non-programmers...).PhantorGorth wrote: ↑Tue Feb 22, 2022 6:43 amI have figured out how it works.Cholmondely wrote: ↑Mon Nov 01, 2021 11:48 pmCan anybody help with this, please?
Cody & I want to finish off this page and get it up on the wiki.
This is the problematic bit: how on earth do I calculate the XPosRel & YPosRel values?Code: Select all
== Map == [[Sector7/The Ceraso Hub (Region)|The Ceraso Hub]] consists of the systems [[Sector7/Anisinza|Anisinza]], [[Sector7/Ceraso|Ceraso]], [[Sector7/Ceerti|Ceerti]] and [[Sector7/Gebeti|Gebeti]].
Code: Select all
<div style="position:relative">{{ClickMapHeader|Sector=7|Image=Sector7_The_Ceraso_Hub_RegionMap.png}} {{ClickMapEntry|Name=Anisinza|Sector=7|XPos=19|YPos=14|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Ceraso|Sector=7|XPos=13|YPos=1|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Ceerti|Sector=7|XPos=1|YPos=9|XPosRel=???|YPosRel=??}} {{ClickMapEntry|Name=Gebeti|Sector=7|XPos=0|YPos=15|XPosRel=???|YPosRel=??}} {{ClickMapFooter}}</div>
The image of the map has margins that it needs to make sure no star system is too close to the edge of the map. The click test image image on https://wiki.alioth.net/index.php/User:Treczoks is 774px x 390px (width x height). So assuming an even margin all the way round the margin value m must follow the equation (774 - 2m)/(390 - 2m) = 2 which gives a value of m = 3px. (If you are wondering why it equals 2, that is because the galaxy maps are 2 x 1 in shape.)
So there is an left-margin and top-margin for the image to the (0, 0) co-ordinate. 3px for both in this case. There would also be a right-margin and bottom-margin both 3px too.
By inspecting the page the clickable points are overlaid divs with dimensions 5px x 5px. So lets call this box to have box-width and box-height both equal to 5px in this case.
Taking the above into account and that the Y-axis is half the scale of the x-axis. Both co-ordinates for (XPos and YPos for the systems) range 0 to 256 each (therefore horizontal-range and vertical-range equal 256 each) from top left of the map then:
Given that the XPosRel and YPosRel are both integers in the examples on that page you may need to to round those calculated value to the nearest integer.Code: Select all
XPosRel = XPos / horizontal-range * (width - left-margin - right-margin) + left-margin - ((box-width - 1) / 2) YPosRel = YPos / vertical-range * (height - top-margin - bottom-margin) + top-margin - ((box-height - 1) / 2)
Looking at the image Cemave at the top has a YPos of 0 is at the fifth pixel from the top not 3 and Laeden at the bottom has a YPos of 254 and is at the fifth pixel from the bottom of the image. So It looks like the map has been shifted 2 pixels down to centre it vertically. There is likely to be a horizontal centring going on too so you would need to adjust the map width and height ranges (the horizontal-range and vertical-range) and margins accordingly. Please note that the values of XPosRel and YPosRel used by the page are not quite centred on the systems but as long as you get the ranges and margins correct my formulae above should work.
Phantor Gorth
You don't say!
Have you seen? Alnivel fixed our problems with the regional map for the Lizard's Claw!