Limit abs coordinates to scripting?

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Kaks wrote:
edit: yes, I am -totally- confused too... luckily we're in good company here. Ahruman seems to have had a few problems with ranrot too!
Oh yes. The two PRNGs being used both for procedural stuff and for random stuff, and not being reset before each procedural thing, is the stuff of nightmares. Can we start again, please?
Last edited by JensAyton on Thu Mar 12, 2009 10:14 pm, edited 1 time in total.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

_ds_ wrote:
It looks like i386 is rounding down and amd64 is rounding to nearest; and amd64 is truncating the values from their internal representations to 32-bit before converting to int rather than just doing straight conversions.
This probably boils down to x87 FP vs. SSE FP. (Oolite for OS X x86 uses SSE despite being 32-bit; this is the norm on OS X, because its behaviour is closer to PowerPC behaviour and all Intel Macs have SSE3.)
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Post by Micha »

Ok, OS X on i386 gives exactly the same results as Linux 64-bit (confirming Ahruman's comment above), however it does give different results between PROCEDURAL and non-PROCEDURAL planet generation, confirming my earlier results. So I'm not sure how you got your results, Kaks.

In either case, I agree with Ahruman to start again, or rather, that we refactor the code to segregate the procedural 'random' functionality from the functionality which is truly supposed to be random. Whether we achieve this by resetting the seeds for the procedurally-random stuff or by running a new RNG for the truly random stuff and keeping RANROT for the legacy stuff I don't know. This would future-proof the code from further surprises such as this.
The glass is twice as big as it needs to be.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Micha wrote:
In either case, I agree with Ahruman to start again
I’m not sure I do – it was meant as a joke. Redoing it with a clear separation of “random” and “procedural” is conceptually the right thing, but making the right decisions will be difficult and painful. For instance, the way %R random-name tokens reset under various badly defined circumstances would probably change, and I’m pretty sure there are things that depend on that behaviour.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Micha wrote:
Ok, OS X on i386 gives exactly the same results as Linux 64-bit (confirming Ahruman's comment above), however it does give different results between PROCEDURAL and non-PROCEDURAL planet generation, confirming my earlier results. So I'm not sure how you got your results, Kaks.
Trunk does does indeed give different results between procedural and non-procedural on my system too, and I'm sure I've already said so. What I was saying is that my bracketed code & mac non-procedural was giving me the same positions. I had a bit of RL tonight, and on coming back I've done a bit more testing. As luck would have it, the planets I looked at last night were Lave(0, 0, 452760), Diso(0, 0, 677050) & Reorte(0, 0, 834470) . They show the same coordinates in 1.72.2. on a mac as they do on my homebrew 1.73 build on mac, linux & windows. On further testing, it turns out that it was an amazing string of bad luck on my part. Other systems in the neighbourhood, like riedquat(0, 0, 960450 in my homebrew 1.73 - 0, 0, 576270 in mac 1.72.2) and zaonce (0, 0, 387300 in my homebrew 1.73 - 0, 0, 464760 in mac 1.72.2) show a marked difference between the two versions!

I might be repeating myself here, but using my homebrew 1.73 code there's no positional difference across formats, and procedural/non-procedural ( and confusingly, the first 3 planets I looked at were positioned identically between my code & 1.72.2 mac) .

Of course, and still more confusingly, using trunk there are differences both between platforms & procedural/non-procedural within the same platform.

Here's the patch between my homebrew 1.73 & trunk v2089, there's a couple of non-planet related things in there, but I'm sure you can safely ignore those! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Post by Micha »

@Ahruman: Whoops, sorry, that one went straight over my head and into the stratosphere!

So I guess our biggest question moving forwards is whether or not we need to maintain backward compatibility with planet/station positions or not. And if so, to which platform do we maintain compatibility? If we fix planet positions to be consistent we'll always break compatibility with at least some pre-fix builds.
The glass is twice as big as it needs to be.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Wait! Let's recap the situation: so far we have 4 (or 6?) different planet/sun/witchpoint positions depending on platforms & procedural/non procedural textures.

No matter what we do, if we get to a single fixed position across platforms we will 'break' things one way or another. But are we sure there's going to be some real breakage if we do that?

We've already got 'some' drift from 1.65, so maybe keeping the planets' absolute position exactly as they were in 1.72 isn't going to be that vital, expecially if no more OXP is going to be affected one way or another.

Apart from Lave Academy, are there any other OXPs that rely on absolute positioning?
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Kaks wrote:
Apart from Lave Academy, are there any other OXPs that rely on absolute positioning?
The v1.02 doesn't rely on it, I recoded it to position everything in relation to the main station. It still spawns things using absolute, but the actual co-ordinates are calculated from the main station so moving things about in the z-axis won't hurt it.

Only people with v1.01 will be affected, and if it becomes a problem they can just update.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Ok, quick emergency editing:
Are there any OXPs that rely on absolute positioning?
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

...

Post by Lestradae »

Kaks wrote:
Ok, quick emergency editing:
Are there any OXPs that rely on absolute positioning?
I think none of the ship or equipment oxps do, that should narrow it down.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

It's going to be the ones that give new oribiting entities like stations and such. And there probably just the newer OXPs as "abs" hasn't been available for that long.

Just had a quick look in Cataclysm, and some of the entities there look to be positioned absolutely. So they'll be in a different place, although whether that matters in game-play terms is another question.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
Ok, quick emergency editing:
Are there any OXPs that rely on absolute positioning?
I don't think there could be many as this possibility is quite new and only a few oxp programmers worked with it. The only i can come up with is "save everywhere" from Frame. He stores the absolute position in a saved file. So when coordinate system changes and on old game is loaded there could be troubles.
But this won't be a to big problem as I assume most will only use it for a temporary saving a commander. It is still development work so I assume all players will also save a commander on the main station as backup.

None of my work uses it. All my uses of "abs" are with calculated relative coordinates.

-----
Looking through al that randomness I notice it wastes also a lot of time to repeat calculating known random numbers over and over again. It would make more sense to calculate them once on entering a system and store in an array.

I just noticed that every police asks every 10 seconds for the witchpoint location. And because that location is also a bit randomised, it does reset the seed for this calculation every time and recalculates that random location over and over again and for every ship again. It would make more sense to me to just redefine that entry point on system creation, making it a system property and only transmit that calculated coordinate on each request.
Last edited by Eric Walch on Fri Mar 13, 2009 12:41 pm, edited 1 time in total.
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Post by Micha »

If Cataclysm current depends on system-bodies being at specific coordinates then Cataclysm currently will break depending on which platform it's run on anyway. So it'll need to be fixed anyway.
The glass is twice as big as it needs to be.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Micha wrote:
If Cataclysm current depends on ....
Not if, it does!

Cataclysm uses it on two places to add stations in space. The second is in deep space so a difference would not be noticed. However, the other is a station in Galaxy 3. This station is located at the back of enrece in "abs" coordinates.

Code: Select all

system.legacy_addShipsAtPrecisely("cataclysm_enrece_station", 1, "abs", [-99221.3, -20562.3, 453026])
Strange he used this coordinates. As it is in planetary orbit the planetary radius based "pwp" system would have been more logic to me.
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Post by Micha »

Also, not sure about keeping a big array of random numbers in memory, but definitely cache the ones which keep being referenced such as the Witchspace-Beacon location.
The glass is twice as big as it needs to be.
Post Reply