Possible asteroid array bug, issue doesn't arise in vanilla

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

glenmcd
Posts: 925
Joined: Sat, 16. Oct 10, 11:07
x3tc

Possible asteroid array bug, issue doesn't arise in vanilla

Post by glenmcd »

hi,
I am using many modified scripts, one of them creates asteroids in Savage Spur, using current asteroid positions as a template, creating asteroids in same 3D pattern but like 60KM away in X/Y axis. While testing this, I noticed that some of the mines that I built on created asteroids (type ice and silicon) were destroying themselves. Digging down further, I found that where each mine was, there was also two asteroids, at precisely the same X, Y and Z positions. I dug down further and looked at the original array of asteroids from original asteroids in the sector, at game start. Each X/Y/Z position of each asteroid was used 3 times. Looking at sector view and removing one asteroid at a time, no duplicates were found, yet in the array, there were 3 asteroids per X/Y/Z location, with identical yields, but not actually the same asteroids. I determined this by using "find" in array to determine whether the asteroids themselves were duplicated, and I found that none were, yet X/Y/Z were identical as well as yield. I haven't tested whether mineral type was identical for each of these sets of 3. For now, I'm using a workaround by creating a hash on the X/Y/Z and looking for its duplicate, skipping dupes. Posting here as it does seem to be a bug, even if it's unlikely to arise in the vanilla game, although may come up in some modified games. To duplicate this, simply use "get asteroid array from sector", use a loop that gets X/Y/Z positions, log them all, then search in the log for duplicate entries. I haven't tested in other sectors.

To paraphase the apparent issue: "get asteroid array from sector" is triple-listing each asteroid position, resulting in array being 3 times as long as the actual asteroid count. No actual asteroid duplicates exist within this array, but X/Y/Z and yield are duplicated.
Alan Phipps
Moderator (English)
Moderator (English)
Posts: 32643
Joined: Fri, 16. Apr 04, 19:21
x4

Re: Possible asteroid array bug, issue doesn't arise in vanilla

Post by Alan Phipps »

A dog has a master; a cat has domestic staff.
glenmcd
Posts: 925
Joined: Sat, 16. Oct 10, 11:07
x3tc

Re: Possible asteroid array bug, issue doesn't arise in vanilla

Post by glenmcd »

thanks Alan

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”