Page MenuHomeFeedback Tracker

Experimental update BaseRoad.GetPoints() invalid vectors
Closed, ResolvedPublic

Description

Game Version number: 1.2.0.23
Modded?: (Yes/No) No

Issue Description:
Seems that BaseRoad objects that could be returned from RoadNetworkManager.GetRoadsInAABB() call could return a lot of broken vectors (GetPoints() method of BaseRoad class) and encountering such error throws game engine validation error as soon as they appear in the script code.
Example code (coordinates are Arland main city):

private void TestRoads()
{
	SCR_AIWorld aiWorld = SCR_AIWorld.Cast(GetGame().GetAIWorld());
	if (!aiWorld)
		return;
			
	RoadNetworkManager roadNetworkManager = aiWorld.GetRoadNetworkManager();
	if (!roadNetworkManager)
		return;
		
        //arland beauwhatever city
	vector position = {3165.111, 11.576, 2798.563};
        float searchRadius = 500.0;
	vector minAABB = m_Location.GetOrigin() - { searchRadius , 0, searchRadius };
	vector maxAABB = m_Location.GetOrigin() + { searchRadius , 1000, searchRadius };
		
	array<BaseRoad> roads = {};
	roadNetworkManager.GetRoadsInAABB(minAABB, maxAABB, roads);
		
	for (int i = 0; i < roads.Count(); i++)
	{
		BaseRoad road = roads[i];
		array<vector> points = {};
		road.GetPoints(points);
			
		for (int j = points.Count() - 1; j >= 0; j--)
		{
			ESCT_Logger.InfoFormat("Vector: %1", points[j].ToString());
		}
	}
}

Log:

log
...
Vector: <-nan, 0.000000, 0.000000>
Vector: <-nan, 0.000000, 0.000000>
Vector: <0.000000, -nan, 0.000000>
Vector: <-nan, 0.000000, 0.000000>
Vector: <-nan, 0.000000, 0.000000>
Vector: <-nan, 0.000000, 0.000000>
Vector: <-nan, 0.000000, -nan>
Vector: <-nan, 0.000000, -nan>
Vector: <0.000000, -nan, 0.000000>
Vector: <-nan, 0.000000, 0.000000>
Vector: <0.000000, 0.000000, -nan>
Vector: <0.000000, -nan, 0.000000>
Vector: <-nan, 0.000000, -nan>
Vector: <-nan, 0.000000, -nan>
Vector: <0.000000, -nan, 0.000000>
Vector: <-nan, 0.000000, 0.000000>
Vector: <0.000000, -nan, 0.000000>

Also, there are some valid but strange vectors too.
These are perfectly valid and usable road points:

SCRIPT       : Vector: <2634.318848, 11.583458, 3167.178711>
SCRIPT       : Vector: <2638.656982, 12.729107, 3160.585938>
SCRIPT       : Vector: <2643.492188, 13.661993, 3155.991211>
SCRIPT       : Vector: <2647.750000, 14.206498, 3154.105225>
SCRIPT       : Vector: <2655.023438, 14.869566, 3152.913818>
SCRIPT       : Vector: <2669.623047, 15.996788, 3152.424316>
SCRIPT       : Vector: <2675.383057, 16.600000, 3151.453125>
SCRIPT       : Vector: <2678.991943, 17.212130, 3149.640625>
SCRIPT       : Vector: <2682.666504, 18.235767, 3145.931641>

And there is also this thing:

SCRIPT       :  Vector: <0.000000, 0.000000, 37555841551815736819712.000000>
SCRIPT       : Vector: <0.000000, 0.000000, 0.000000>
SCRIPT       : Vector: <0.000000, 3869335173849772195840.000000, 0.000000>

So, I'm not sure about BI implementation and if these points are even useful at all in internal BTRlike/road network side of things, but it seems that these "extemely long value" vectors and zero vectors are not useful to be used by scripters and BaseRoad.GetPoints() method could sanitize/remove those values.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce
private void TestRoads()
{
	SCR_AIWorld aiWorld = SCR_AIWorld.Cast(GetGame().GetAIWorld());
	if (!aiWorld)
		return;
			
	RoadNetworkManager roadNetworkManager = aiWorld.GetRoadNetworkManager();
	if (!roadNetworkManager)
		return;
		
        //arland beauwhatever city
	vector position = {3165.111, 11.576, 2798.563};
        float searchRadius = 500.0;
	vector minAABB = m_Location.GetOrigin() - { searchRadius , 0, searchRadius };
	vector maxAABB = m_Location.GetOrigin() + { searchRadius , 1000, searchRadius };
		
	array<BaseRoad> roads = {};
	roadNetworkManager.GetRoadsInAABB(minAABB, maxAABB, roads);
		
	for (int i = 0; i < roads.Count(); i++)
	{
		BaseRoad road = roads[i];
		array<vector> points = {};
		road.GetPoints(points);
			
		for (int j = points.Count() - 1; j >= 0; j--)
		{
			ESCT_Logger.InfoFormat("Vector: %1", points[j].ToString());
		}
	}
}
Additional Information

It it reproductible both when Road Network File property in SCR_AIWorld object filled and also when it's not filled (empty) at all too.

Event Timeline

Socrates updated the task description. (Show Details)
Socrates edited Steps To Reproduce. (Show Details)
Socrates updated the task description. (Show Details)May 25 2024, 1:10 PM
Geez changed the task status from New to Awaiting internal Testing.May 27 2024, 12:22 PM
Geez closed this task as Resolved.May 29 2024, 11:43 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Resolved for one of the upcoming updates.

This comment was removed by Socrates.