Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Admiral MS on August 05, 2012, 07:13:51 am

Title: Patch submission: dynamic waypoints and waypoint removal
Post by: Admiral MS on August 05, 2012, 07:13:51 am
For my RTS Mod (see http://www.hard-light.net/forums/index.php?topic=81590.0) I need a way to issue movement orders to ships. I'm using waypoints but I'm limited to waypoint creation so with every movement order another set of waypoints is created. Eventually it hits the global object limit and can't go on.

I can only see two ways around it:

1. Dynamic waypoints: Fixing the problem that changing the position of a waypoint (which the game definitely does) isn't registered by the ai-code: http://scp.indiegames.us/mantis/view.php?id=2612
I think FREDers will profit as well if this is fixed cause they can reposition waypoints according to whatever happened in the mission (for example waypoints dependant on the players position).

2. Deleting waypoints: Adding a SEXP or scripting function to remove waypoints and waypoint-lists.

I hope one of these 2 variants is possible and there is a coder interested in doing it. I'm willing to help whereever I can (testing, ...)
Title: Re: Patch submission: dynamic waypoints and waypoint removal
Post by: Admiral MS on August 08, 2012, 06:14:57 am
As it seems that no one is interested in this I figured I should try it myself. I made a removeWaypoint scripting function and a small addition to the set-object-position sexp so waypoint position changes are registered by ai code. I tested both and found no problems.

Both patches (against build 9096) are attached.
Cause i'm not sure if I failed at some naming conventions or broke some rules (especially for the removeWaypoint function), I hope a coder can give me feedback and commit one or both patches if they are good.

[attachment removed and sold on the black market]
Title: Re: Patch submission: dynamic waypoints and waypoint removal
Post by: Echelon9 on August 08, 2012, 09:38:25 am
Thanks for contributing these draft patches.

I've updated the Mantis bug that relates to this issue here: http://scp.indiegames.us/mantis/view.php?id=2612 and set it to 'Code Review' so that comments can be sought from other SCP members.

If it gets the okay, or you can resolve any comments raised in feedback, we'll commit to SCP trunk.
Title: Re: Patch submission: dynamic waypoints and waypoint removal
Post by: Admiral MS on August 08, 2012, 09:53:10 am
Seems like I failed to describe what patch is actually doing what  :rolleyes:

Only the dyn_waypoints.patch is related to the mantis issue and should fix it.

remove_waypoints.patch is a completely new scripting function and has nothing to do with the mantis bug.
Title: Re: Patch submission: dynamic waypoints and waypoint removal
Post by: Echelon9 on August 08, 2012, 04:17:45 pm
Mantis updated.
Title: Re: Patch submission: dynamic waypoints and waypoint removal
Post by: m!m on August 09, 2012, 04:38:17 am
Small note about the scripting function: Could you move the removeWaypoint function into the waypoit handle itself so you can call waypoint:remove() instead of mn.removeWaypoint(waypoint)?
I think that's how most of the other scripting functions are implemented and it would help keeping the API consistent.
Title: Re: Patch submission: dynamic waypoints and waypoint removal
Post by: Swifty on August 17, 2012, 01:04:01 am
This seems to cause a crash when changing the position of a ship.

http://scp.indiegames.us/mantis/view.php?id=2612

EDIT: Crash has been fixed.