Monday, January 25, 2010

New Stars Status

Hopefully things will pick up...

Here we have our first turn gen, and our first bug!
Our move code has place the destroyer and the probe in the same location, while Stars has them one light year apart. Bizarro. Must be a rounding problem...

I also had to fix the recent file LRU yet again. Hopefully it is correct now.

7 comments:

jdevale said...

Where does the pure math put it?

nedbrek said...

Maybe a rounding error:
Using atan, cos, and sin:
x y
probe 113.527485 85.81358845
destroy 113.5839011 85.45765354

Stars puts the probe at 1086, which is our 86.

jdevale said...

Well,

I didn't use the trig functions in an effort to be as fast as possible, so I use (double) math ratios of distance to range to calculate x and y vector components, blah blah blah.

In any case, the Locations are stored as a pair of doubles, so no rounding should be involved on the server end. What are the absolute locations the server recorded in the .xml turn files?

nedbrek said...

The start location is Finale, x=78, y=80.

The first end location is PiR2, x=133, y=89

The second end location is Tull, x=241, y=105

The distance traveled in both cases is 36 ly.

nedbrek said...

And the x coordinates should be 114 for both (which we have correctly).

One should be y=85, the other y=86. We have both as y=86.

jdevale said...

I found the culprit in placeable.h -- I return floor() of the coordinates for some reason. I will change it to floor(coord + .5) and call it good.

unsigned getX(void) const
{
return (unsigned)floor(xLocation);
}

unsigned getY(void) const
{
return (unsigned)floor(yLocation);
}

jdevale said...

I checked in the fix, also fixed the conditional ambiguity g++ has been bitching about in newStars.cpp