Hi, here is a very technical game mechanic question. I am...

« Back

94 days, 2 hours, 27 minutes ago zacha
 Hi, here is a very technical game mechanic question. I am... Write Reply
Hi, here is a very technical game mechanic question. I am currently building a tool where I need to forecast exactly the positions of ships next turn.

References are
1. VGA planets nu host result (next turn real position of ship)
2. https://www.vgaplanets.ca/vga-planets-calculator/#minefields giving me the same result as per host.
3. It refers to the formulas given here http://phost.de/phost4doc/formulas.html#movement

Most of the time it works, but I have encountered following scenario:
Ship is at position: 1596 / 1272. Destination waypoint is: 1634/1505. It has Warp 9. No other effects have to be considered.
The correct position in next turn is 1609/1352 (as per Planets Calculator and as per game position of the ship in following turn).
However, my calclulations gives 1610/1352 - so 1 off on the x-axis. Calculation is done in Excel with formula: 1596+CEIL(81*SIN(ARCTAN((1634-1596)/(1505-1272))),0)

Maybe some internal rounding issue in excel? Or can anyone see what is throwing me off?
93 days, 20 hours, 17 minutes ago zacha
 RE: Hi, here is a very technical game mechanic question. I am... Write Reply
I think I found the simple answer - the calculator and apparently also Nu do not calculate the new coordinates like in PHost, but calculator has following code (referring to http://www.donovansvgap.com/help/details.htm#movement)
var newX = startX;
var newY = startY;
var deltaX = destX - startX;
var deltaY = destY - startY;
var distanceWaypoint = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
var distanceTraveled = 0;

var majorDelta = 0;
var minorDelta = 0;
if ((deltaX != 0) || (deltaY != 0)) {
if (Math.abs(deltaX) > Math.abs(deltaY)) {
// major direction = horizontal
majorDelta = Math.floor(((warp * warp * (gravitronic ? 2 : 1) * deltaX) / distanceWaypoint) + 0.5);
minorDelta = Math.floor((majorDelta * (deltaY / deltaX)) + 0.5);
newX = Math.round(startX + majorDelta);
newY = Math.round(startY + minorDelta);
} else {
majorDelta = Math.floor(((warp * warp * (gravitronic ? 2 : 1) * deltaY) / distanceWaypoint) + 0.5);
minorDelta = Math.floor((majorDelta * (deltaX / deltaY)) + 0.5);
newX = Math.round(startX + minorDelta);
newY = Math.round(startY + majorDelta);
}
}
distanceTraveled = Math.sqrt((majorDelta * majorDelta) + (minorDelta * minorDelta));

// The above formula only works if the waypoint can't be reached in 1 turn; it calculates how far the ship will go at in direction of *EVEN IF IT OVERSHOOTS THE TARGET*
// If distance is within 1-turn hop, just go there
if (distanceTraveled > distanceWaypoint) {
newX = destX;
newY = destY;
distanceTraveled = distanceWaypoint;
}
92 days, 21 hours, 22 minutes ago glynsalternate
 RE: Hi, here is a very technical game mechanic question. I am... Write Reply
PlanetsNu is based on TimHost code (but not the lastest version of VGAP, one before FircloudWebCrashChunnel was removed).

PHost is quite different since it was built from scratch and not didn't try to emulate TimHost perfectly.
92 days, 19 hours, 47 minutes ago zacha
 RE: Hi, here is a very technical game mechanic question. I am... Write Reply
yah I thought the Calculator uses PHost Formulae for the movement prediction, but there I was mistaken, it is using TimHost formulaes, which is basically same as NuHost.