Project

General

Profile

Bug #20769

Waypoint list gets duplicates inserted on each scene switch.

Added by Dunbaratu about 2 months ago. Updated 22 days ago.

Status:
Confirmed
Priority:
Low
Assignee:
-
Category:
Application
Target version:
-
Start date:
12/28/2018
% Done:

10%

Version:
Platform:
Windows
Expansion:
Core Game
Language:
English (US)
Votes:
Arrow u r green
Arrow d r red

Description

This started happening with the five new stock waypoints added in KSP 1.6.
The end user won't notice this bug at first, but mod writers trying to work with the waypoint list will definitely notice this. It also may be causing a small memory leak.

WaypointManager.Instance().Waypoints has the same 5 duplicated waypoints appended to it again and again. The duplicates seem to be added each time you switch scenes.

The first time you launch a vessel to the launchpad, the list contains these 5 waypoints, as it should:

At index 0: "Island Airfield"
At index 1: "Woomerang Launch Site"
At index 2: "Dessert Airfield"
At index 3: "Dessert Launch Site"
At index 4: "KSC"

Then you switch to the tracking station, then back to flying the ship again, and now the list has 15 items in it like so:

At index 0: "Island Airfield"
At index 1: "Woomerang Launch Site"
At index 2: "Dessert Airfield"
At index 3: "Dessert Launch Site"
At index 4: "KSC"
At index 5: "Island Airfield"
At index 6: "Woomerang Launch Site"
At index 7: "Dessert Airfield"
At index 8: "Dessert Launch Site"
At index 9: "KSC"
At index 10: "Island Airfield"
At index 11: "Woomerang Launch Site"
At index 12: "Dessert Airfield"
At index 13: "Dessert Launch Site"
At index 15: "KSC"

The more times you have switched scenes, the more extra copies of these 5 waypoints exist in the list.

This is more of an "under the hood" game infrastructure problem that for now the user won't notice on the surface. But I mention it because it might cause trouble in other areas.

screenshot52.png View (1.84 MB) Dunbaratu, 01/28/2019 10:04 PM

43434

History

#1 Updated by nightingale about 2 months ago

Can confirm this one. Also, I'll likely put a workaround in the Waypoint Manager mod, since this bug causes serious problems for it.

#2 Updated by Nebbie about 1 month ago

  • Status changed from New to Confirmed
  • % Done changed from 0 to 10

#3 Updated by Dunbaratu 22 days ago

43434

Further information:

I discovered that the "duplicates" are not quite exact duplicates. The new waypoint copy often appears a few meters away from the previous one. And the next one a few meters away from that, and so on.

I have a screenshot of about 10 waypoints for the KSC runway, spread along the length of the runway. Some in the middle, some toward one end, some toward the other end. Interestingly they DO all have the same latitude, but not quite the same longitude. I wonder if this might be because I was performing scene switches going back and forth to the tracking station and to vessels, while those vessels were all the way out by Duna. Maybe that was far enough from home for the waypoints to start introducing a bit floating point error in their positions when they were getting spawned? I have no clue. But I do know that they weren't all exactly the same latitude/longitude. Just very close.

This was relevant because I wanted to introduce a workaround where I would scan the list for duplicates and cull them out of my own uses, but detecting duplicates is a problem when doing so requires a fuzzy match on "good enough" similarity instead of an exact equality match.

Note, the screenshot below uses the "waypoint manager" mod to display what I mean about the runway waypoints not all being the same exact spot. The mod does not cause the problem. I only installed it to help visualize the problem to make a screenshot. The problem was already there without it.

Also available in: Atom PDF