Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lines showing vehicle destination only appear after vehicle begins moving #1426

Open
dethstryke01 opened this issue Apr 24, 2024 · 1 comment
Labels
Alien Dimension An issue relating to something in the Alien Dimension overview part of Apocalypse Better Design Required The current implementation is not ideal. We'd be better off with a new design for a solution. Cityscape An issue relating to something in the City overview part of Apocalypse Graphical User Interface (UI/GUI) A ticket that relates to how the user interacts with the game through the UI Not Yet Implemented This fix or feature is not yet implemented or merged with trunk Pathfinding An issue relating to pathfinding of units Quality of Life (QoL) A feature or change that makes playing the game more streamlined Roadmap A an issue containing features that need to be completed for a "full" gaming experience. UnitAI / Behaviour Something relating to the behaviour of Units in the game Verified / Replicated This issue has been verified or replicated by a developer

Comments

@dethstryke01
Copy link

In the original they appeared as soon as the order to move had been given.

In OpenApoc:

https://youtu.be/ICiHQ0unP1k?t=1800

In the original:

https://youtu.be/T-XUNuXMzkM?t=29

OpenApoc 20240410
Extended Weapons Mod 9.01
Falcon Weapons Platform 1.4
Windows 10 22H2
OpenApoc_settings.zip

@FilmBoy84 FilmBoy84 added Not Yet Implemented This fix or feature is not yet implemented or merged with trunk UnitAI / Behaviour Something relating to the behaviour of Units in the game Verified / Replicated This issue has been verified or replicated by a developer Pathfinding An issue relating to pathfinding of units Quality of Life (QoL) A feature or change that makes playing the game more streamlined Roadmap A an issue containing features that need to be completed for a "full" gaming experience. Graphical User Interface (UI/GUI) A ticket that relates to how the user interacts with the game through the UI Cityscape An issue relating to something in the City overview part of Apocalypse Alien Dimension An issue relating to something in the Alien Dimension overview part of Apocalypse Better Design Required The current implementation is not ideal. We'd be better off with a new design for a solution. labels May 7, 2024
@ayrtondenner
Copy link
Contributor

I tried to fix this issue but didn't have success on it, so I'm sharing my attempt to help anyone else that might try to work on it as well. I looked it up and debugged with two vehicles sending both to a building (one in the open and another inside a base). In both cases targetLocationsToDraw is empty, but here's the difference:

  • When already in the open, the vehicle has two missions: GotoLocation and GotoBuilding. GotoLocation mission will then add a Vec3 in targetLocationsToDraw.
  • When in a building, the vehicle also has two missions: TakeOff and GotoBuilding. The problem is that neither mission add an item in targetLocationsToDraw.

I ended up finding that at missions.start(), TakeOff mission is blocking the GotoLocation mission: because if takeOffCheck() returns True, then start() will quit. What I'm doing is that, instead of quitting, start() function will continue executing, where it will calculate shortest path pad, and add GotoLocation mission.

In short, I tried the following two changes:

1):

case MissionType::AttackBuilding:
{
if (!targetBuilding && !acquireTargetBuilding(state, v))
{
cancelled = true;
return;
}
if (takeOffCheck(state, v))
{
return;
}
if (this->currentPlannedPath.empty())
{
std::uniform_int_distribution<int> xPos(targetBuilding->bounds.p0.x - 5,
targetBuilding->bounds.p1.x + 5);
std::uniform_int_distribution<int> yPos(targetBuilding->bounds.p0.y - 5,
targetBuilding->bounds.p1.y + 5);
setPathTo(state, v, v.getPreferredPosition(xPos(state.rng), yPos(state.rng)),
getDefaultIterationCount(v));
}
return;
}

This was replaced with:

case MissionType::AttackBuilding:
{
	if (!targetBuilding && !acquireTargetBuilding(state, v))
	{
		cancelled = true;
		return;
	}


	takeOffCheck(state, v);


	if (this->currentPlannedPath.empty())
	{
		std::uniform_int_distribution<int> xPos(targetBuilding->bounds.p0.x - 5, targetBuilding->bounds.p1.x + 5);
		std::uniform_int_distribution<int> yPos(targetBuilding->bounds.p0.y - 5, targetBuilding->bounds.p1.y + 5);
		setPathTo(state, v, v.getPreferredPosition(xPos(state.rng), yPos(state.rng)), getDefaultIterationCount(v));
	}


	return;
}

2):

// Leave building
if (takeOffCheck(state, v))
{
return;
}
// Actually go there
auto vehicleTile = v.tileObject;
if (v.type->isGround())

Again removed return from takeOffCheck, and I also added a check to deal with occasions where vehicleTile is empty, which was something that didn't happen before since takeOffCheck return would stop code execution before hitting this line:

// Leave building
auto takeOffCheckResult = takeOffCheck(state, v);

// Actually go there
auto vehicleTile = v.tileObject;

if (takeOffCheckResult && !vehicleTile)
	return;

if (v.type->isGround())
{

As you can see, in both cases I removed the return when takeOffCheck was executed, so that way after adding TakeOff we are forcing that vehicle missions list would also have GotoLocation mission as well.

This worked... but then introduced another issue. For some reason, now vehicle->currentBuilding is being set as null. I understand that the TakeOff is doing that, but something that should be setting the currentBuilding back when investigating a building is not working anymore.

To be more specific, when you have a "Live Alien spotted" incident and you send a vehicle with agents to investigate the building where it happened, the following line will throw an error when the vehicles reach the building destination, since v.currentBuilding is null now for some reason:

if (finished && v.owner == state.getPlayer() && v.currentBuilding->detected)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Alien Dimension An issue relating to something in the Alien Dimension overview part of Apocalypse Better Design Required The current implementation is not ideal. We'd be better off with a new design for a solution. Cityscape An issue relating to something in the City overview part of Apocalypse Graphical User Interface (UI/GUI) A ticket that relates to how the user interacts with the game through the UI Not Yet Implemented This fix or feature is not yet implemented or merged with trunk Pathfinding An issue relating to pathfinding of units Quality of Life (QoL) A feature or change that makes playing the game more streamlined Roadmap A an issue containing features that need to be completed for a "full" gaming experience. UnitAI / Behaviour Something relating to the behaviour of Units in the game Verified / Replicated This issue has been verified or replicated by a developer
Projects
None yet
Development

No branches or pull requests

3 participants