Author Topic: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes  (Read 11476 times)

0 Members and 1 Guest are viewing this topic.

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [Updated July 4, 2010] (AI changes) Autopilot and Waypoint Fixes
That sounds like a silly restriction on FREDers.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Iss Mneur

  • Moderator
  • 210
  • TODO:
Re: [Updated July 4, 2010] (AI changes) Autopilot and Waypoint Fixes
That sounds like a silly restriction on FREDers.
What does?  The locking the weapons?
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [Updated July 4, 2010] (AI changes) Autopilot and Waypoint Fixes
No the enemy ships in range thing.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Iss Mneur

  • Moderator
  • 210
  • TODO:
Re: [Updated July 4, 2010] (AI changes) Autopilot and Waypoint Fixes
I suppose.  Though remember that this code was written specifically for WCSaga, so it follows the Wing Commander rules. 

But honestly, I don't know if anyone would want to allow the player to autopilot while the their are enemies near, because (to be clear) the autopilot is not a intrasystem jump like FreeSpace uses whereas under autopilot the ships envolved are physically "flying" the route (in fact, even though the cinematic autopilot code slews the ships around the world it still checks the "flight path" for the rules so that you don't autopilot past some enemies).

That being said, removing that test with a tbl setting would be easy enough if someone actually wants this type of feature.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: [Updated July 4, 2010] (AI changes) Autopilot and Waypoint Fixes
A "$No autopilot if enemy within distance: NUMBER" setting would be good (defaulting to 5000).
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Iss Mneur

  • Moderator
  • 210
  • TODO:
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Okay, new build (hopefully the last before it gets put into trunk), is available in the first post.

Adds: $Interrupt autopilot if enemy within distance:, $Interrupt autopilot if asteroid within distance:, and $Lock Weapons During Autopilot:.
Cleans up some more duplicated code.  Removed some useless code.
Clarified some warnings that may be emitted by the new code.  Also clarified some comments in the code.

Delaying pushing the patch to chief1983 until July 13th.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Woolie Wool

  • 211
  • Fire main batteries
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Does that mean I can have a cinematic autopilot and have enemies jump in midway between the two nav points (or simply have them sitting there, waiting for someone to stumble across them) and the cinematic autopilot will drop out as the player is waylaid by the enemies?
16:46   Quanto   ****, a mosquito somehow managed to bite the side of my palm
16:46   Quanto   it itches like hell
16:46   Woolie   !8ball does Quanto have malaria
16:46   BotenAnna   Woolie: The outlook is good.
16:47   Quanto   D:

"did they use anesthetic when they removed your sense of humor or did you have to weep and struggle like a tiny baby"
--General Battuta

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Interrupt may be misleading, I think the original intent was to prevent it being initialized in the first place.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Iss Mneur

  • Moderator
  • 210
  • TODO:
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Interrupt may be misleading, I think the original intent was to prevent it being initialized in the first place.

No, interrupt is exactly what it will do.

Does that mean I can have a cinematic autopilot and have enemies jump in midway between the two nav points (or simply have them sitting there, waiting for someone to stumble across them) and the cinematic autopilot will drop out as the player is waylaid by the enemies?

No. Yes.

The enemies (or asteroids for that matter) have to be within the Interrupt distance of the flight path when the autopilot is calculating the route.  So  the enemies cannot warp in after the autopilot has engaged, but if they are just sitting there within Interrupt distance of the flight path (same goes for the asteroids) then the autopilot will drop the group out the Interrupt distance from the object causing the interrupt.

I have not changed this behaviour, just exposed the distance value to the MODer.  This also applies to both the cinematic autopilot and the time compression autopilot.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Talon 1024

  • 29
  • How do you turn this on?
    • Mods, Games, and Stuff
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
I'm sorry I was so late on this, but if a ship is given the ai-waypoints goal, it only follows the waypoint path once, instead of patrolling the path like it should.
To understand religion, you need to understand morality first. | WCSaga website | WCSaga Forum | 158th website | 158th forum | Project Leader: WC: Hostile Frontier | WCHF Thread at CIC | Wing Blender | Twist of Fate | Multipart turrets on angled surfaces, tutorial included. | My Google Drive stuff | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32)

FS2 Mods I'm waiting on: Inferno 10th Anniversary
Current Project: Contestant Android app, Learn4Life iOS app, Blender Commander (importer).
The FreeSpace Font Foundry is back in action!

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Can't you reset the goal upon completion?
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Iss Mneur

  • Moderator
  • 210
  • TODO:
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
I'm sorry I was so late on this, but if a ship is given the ai-waypoints goal, it only follows the waypoint path once, instead of patrolling the path like it should.

Please try: http://www.box.net/shared/j235mil0mf
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Talon 1024

  • 29
  • How do you turn this on?
    • Mods, Games, and Stuff
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Hmmm...  Using this build, the ai-waypoints AI goal does not work properly if it is in the wing/ship's initial orders, but it does work properly if that AI goal is assigned via a SEXP.

EDIT: Edited for clarity
« Last Edit: July 28, 2010, 09:45:45 pm by Talon 1024 »
To understand religion, you need to understand morality first. | WCSaga website | WCSaga Forum | 158th website | 158th forum | Project Leader: WC: Hostile Frontier | WCHF Thread at CIC | Wing Blender | Twist of Fate | Multipart turrets on angled surfaces, tutorial included. | My Google Drive stuff | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32)

FS2 Mods I'm waiting on: Inferno 10th Anniversary
Current Project: Contestant Android app, Learn4Life iOS app, Blender Commander (importer).
The FreeSpace Font Foundry is back in action!

 

Offline Iss Mneur

  • Moderator
  • 210
  • TODO:
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Okay, I have looked at the code that assigns the initial orders, and it seems that initial orders are sexps  and as such implemented by the sexp system which means it follows pretty much exactly the same code path as when the goal is assigned by the events sexps.  Also, the only part of the ai code that I have changed for this patch interacts at the mode level of the AI (ie the part that actually makes a goal happen).

Thus, Talon 1024, can you please provide a basic mission that exhibits ai-waypoints not working as initial orders and a mission that exhibits ai-waypoints working as a sexp.

Also, does this issue only appear in builds after my autopilot fixes where added, or before?
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Easy build to test that last bit would be RC3, as it had no autopilot fixes but is otherwise very close to RC4 which does have them all save for this last tweak.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Please try this build:
http://blueplanet.fsmods.net/E/fs2_open_3_6_13d_INF_SSE2.7z

It seems that the waypoint goal was cleared, regardless of whether or not the AI was ordered to fly them once or repeatedly.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Iss Mneur

  • Moderator
  • 210
  • TODO:
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Please try this build:
http://blueplanet.fsmods.net/E/fs2_open_3_6_13d_INF_SSE2.7z

It seems that the waypoint goal was cleared, regardless of whether or not the AI was ordered to fly them once or repeatedly.

Did my build provided in my post further up not fix ai-waypoints for you?

The issue now it seems is that ai-waypoints does not repeat when used as an initial order for a wing or ship, but works find when used as an order later.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Hey, I did not test this (due to a lack of a test case), I am just trying to fix the issue.

Here's the code patch:
Code: [Select]
Index: aicode.cpp
===================================================================
--- aicode.cpp (revision 6332)
+++ aicode.cpp (working copy)
@@ -4453,18 +4453,18 @@
  aip->wp_index = 0; // go back to the start.
  } else {
  aip->wp_index = (wpl->count - 1); // stay on the last waypoint
+ // Log a message that the wing or ship reached his waypoint and
+ // remove the goal from the AI goals of the ship pr wing, respectively.
+ // Wether or not we should treat this as a ship or a wing is determined by
+ // ai_fly_to_target_position when it marks the AI directive as complete
+ if ( treat_as_ship ) {
+ ai_mission_goal_complete( aip ); // this call should reset the AI mode
+ mission_log_add_entry( LOG_WAYPOINTS_DONE, Ships[Pl_objp->instance].ship_name, wpl->name, -1 );
+ } else {
+ ai_mission_wing_goal_complete( Ships[Pl_objp->instance].wingnum, &(aip->goals[aip->active_goal]) );
+ mission_log_add_entry( LOG_WAYPOINTS_DONE, Wings[Ships[Pl_objp->instance].wingnum].name, wpl->name, -1 );
+ }
  }
- // Log a message that the wing or ship reached his waypoint and
- // remove the goal from the AI goals of the ship pr wing, respectively.
- // Wether or not we should treat this as a ship or a wing is determined by
- // ai_fly_to_target_position when it marks the AI directive as complete
- if ( treat_as_ship ) {
- ai_mission_goal_complete( aip ); // this call should reset the AI mode
- mission_log_add_entry( LOG_WAYPOINTS_DONE, Ships[Pl_objp->instance].ship_name, wpl->name, -1 );
- } else {
- ai_mission_wing_goal_complete( Ships[Pl_objp->instance].wingnum, &(aip->goals[aip->active_goal]) );
- mission_log_add_entry( LOG_WAYPOINTS_DONE, Wings[Ships[Pl_objp->instance].wingnum].name, wpl->name, -1 );
- }
  }
  }
 }

The problem, as I understood it by reading the code, was that the ai-waypoints goal was cleared once the ship reached the last waypoint, regardless of whether or not it was supposed to repeat the waypoint path. I think this should fix it, but as noone was around on IRC to talk to regarding the AI, I kinda had to take a guess.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Talon 1024

  • 29
  • How do you turn this on?
    • Mods, Games, and Stuff
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
Hmmm...  Using this build, the ai-waypoints AI goal does not work properly if it is in the wing/ship's initial orders...
Oh shoot.  I'm sorry. :(

This was actually a stupid oversight on my part.  I had two wings, one of them was given the ai-waypoints goal (Bravo), and one was given the ai-waypoints-once goal (Charlie).  I had an event that fired once Charlie wing finished it's waypoints, and Charlie wing coincidentially finished their waypoints at the same time that Bravo wing had nearly finished theirs, and that event cleared Bravo's orders and assigned Charlie the orders to patrol another waypoint path.  Bravo's AI goals being cleared had lead me to believe that this SEXP was not working properly if it was being called from initial orders, but that was not the case.
« Last Edit: July 29, 2010, 04:36:28 pm by Talon 1024 »
To understand religion, you need to understand morality first. | WCSaga website | WCSaga Forum | 158th website | 158th forum | Project Leader: WC: Hostile Frontier | WCHF Thread at CIC | Wing Blender | Twist of Fate | Multipart turrets on angled surfaces, tutorial included. | My Google Drive stuff | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32)

FS2 Mods I'm waiting on: Inferno 10th Anniversary
Current Project: Contestant Android app, Learn4Life iOS app, Blender Commander (importer).
The FreeSpace Font Foundry is back in action!

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Minecraft
    • Steam
    • Twitter
    • ModDB Feature
Re: [Updated July 11, 2010] (AI changes) Autopilot and Waypoint Fixes
So, to clarify, the build Iss Mneur linked on 07-28-2010 does work? Or that a build earlier than that worked?
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys