Author Topic: Tech Demo: Scripted missiles with collision avoidance  (Read 271 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 210
Tech Demo: Scripted missiles with collision avoidance
I wanted to do something like this for a long time. The basic idea of this demo script is to make missiles avoid obstacles when approaching a targeted subsystem by using the model paths specified in the model file.

I created a small test mod which implements this feature for the retail Harpoon missile: http://www.mediafire.com/file/df4c4n6464rsa1v/pathScript.zip
These builds are required for using the script: http://swc.fs2downloads.com/builds/test/scriptingModelPaths/

All you need to do is target a subsytem and fire a Harpoon missile (I have included a very simple test mission in the mod above). The missile will fly towards the closest unobstructed path point and then follow the path specified in the model path. I increased the range and turn rate of the Harpoon significantly in this mod since the missile needs to make some pretty sharp turns in order to hit the target.

Let me know what you think!
« Last Edit: June 22, 2018, 01:42:55 pm by m!m »

 

Offline Spoon

  • 212
  • ♪ ♬ ヾ(´︶`♡)ノ ♬ 淫画
Re: Tech Demo: Scripted missiles with collision avoidance
Well the test mission was nowhere to be found.
When I tried this in a retail mission, tried to target the iceni with a harpoon and got
Code: [Select]
Error: Caught std::exception in main(): 'vector<T> too long'!
File: freespace.cpp
Line: 7982

ntdll.dll! NtWaitForSingleObject + 10 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 156 bytes
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
ntdll.dll! RtlRestoreContext + 739 bytes
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
kernel32.dll! BaseThreadInitThunk + 13 bytes
ntdll.dll! RtlUserThreadStart + 29 bytes

Caught a STD  :(
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 210
Re: Tech Demo: Scripted missiles with collision avoidance
I forgot to move the test mission to the mod folder. I updated the mod link in the first post.

I suspect that the error you encountered is caused by a subsystem not having an assigned path. It should be easy to fix if I can reproduce it.

 

Offline Spoon

  • 212
  • ♪ ♬ ヾ(´︶`♡)ノ ♬ 淫画
Re: Tech Demo: Scripted missiles with collision avoidance
Hah, that's really neat. And should make antisubsystem missile weapons seriously more useful.
I could see some potential usefulness being able to send weapons down paths like this for other senarios too.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline m!m

  • 210
Re: Tech Demo: Scripted missiles with collision avoidance
The basic feature of handling the homing positions of a missile from a script can be adapted freely (see weapon.OverrideHoming for more information).

What mission were you using when you encountered the uncaught exception? I would like to fix that bug before I submit the new code for review.

 

Offline Spoon

  • 212
  • ♪ ♬ ヾ(´︶`♡)ノ ♬ 淫画
Re: Tech Demo: Scripted missiles with collision avoidance
sm3-03 return to babel
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

  

Offline m!m

  • 210
Re: Tech Demo: Scripted missiles with collision avoidance
Thanks, I think I found the issue. I have uploaded the new code but it will take some time until the test builds are compiled.