Spawning ships & AI

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Spawning ships & AI

Post by m4r35n357 »

I'm trying to simulate some warring factions like this:

Code: Select all

    var factionA = system.addShipsToRoute("trader", this.$count, 0.05, "ws");
    var factionB = system.addShipsToRoute("pirate", this.$count, 0.10, "wp");
    var factionC = system.addShipsToRoute("hunter", this.$count, 0.05, "wp");
and then send them to the witchpoint to fight using an AI state which contains:

Code: Select all

ENTER = ( "setCourseToWitchpoint", "performFlyToRangeFromDestination" );
but only the ships spawned as "trader" actually move, the others get a "FRUSTRATED" AI message and just stay put. The thing is, I'm actually replacing the AI for all three (using switchAI) to the same thing, so there must be some residual effect of the original roles or something.

Does anyone know how/why this can happen?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Spawning ships & AI

Post by Commander McLane »

Generally some AI-logging is useful when testing AI things.

First question: do all concerned ships actually use your AI?

Second: have you any OXPs installed which could manipulate the ship's AIs? As the hunters seem to be affected, total_patrol.oxp would be a possible candidate. For pirates I don't know off the top of my head.

Third: where is the desired range set?
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

Commander McLane wrote:
Generally some AI-logging is useful when testing AI things.

First question: do all concerned ships actually use your AI?

Second: have you any OXPs installed which could manipulate the ship's AIs? As the hunters seem to be affected, total_patrol.oxp would be a possible candidate. For pirates I don't know off the top of my head.

Third: where is the desired range set?
1. Yes, I do use AI logging, but it is very verbose(especially for combat!) so I didn't post it here except to mention the "FRUSTRATED" message. I need to run it again I think (aaaargh!).

2. I don't use total patrol but I will have a look around . . but I use switchAI so I assumed that would give me a clean start. Was I mistaken?

3. I alternate between "setCourseToWitchpoint" and ", "setDestinationToWitchpoint, setDesiredRangeTo: 5000" - the latter was causing problems at one point, but I try both.
According to the docs, "setCourseToWitchpoint" sets the range to 10000.

I don't think there's an error in my stuff as such, because if I set them all to traders they fight nicely, but I am clearly missing out on how the initialization works in detail.

Thanks for replying. Ian.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

Commander McLane wrote:
Generally some AI-logging is useful when testing AI things.
Well, this is the simplest I can get it . . .

Code: Select all

12:23:01.780 [log.header]: Opening log for Oolite version 1.75.2 (x86-32 test release) under Linux at 2011-05-12 12:23:01 +0000.
2 processors detected.
Build options: spoken messages, mass/fuel pricing, JavaScript console support, OXP verifier, localization tools, debug GraphViz support, JavaScript profiling.

Note that the contents of the log file can be adjusted by editing logcontrol.plist.

12:23:02.028 [display.mode.list.native]: X11 native resolution detected: 1440 x 900
12:23:02.191 [joystick.init]: Number of joysticks detected: 1
12:23:03.767 [dataCache.rebuild.explicitFlush]: Cache explicitly flushed with shift key. Rebuilding from scratch.
12:23:03.776 [searchPaths.dumpAll]: Unrestricted mode - resource paths:
    ~/GNUstep/Applications/Oolite/oolite.app/Resources
    AddOns
    ~/.Oolite/AddOns
    AddOns/Basic-debug.oxp
    ~/.Oolite/AddOns/accessories.oxp
    ~/.Oolite/AddOns/BGS-A1.3.2.oxp
    ~/.Oolite/AddOns/Galactic_Navy 5.3.0.oxp
    ~/.Oolite/AddOns/hOopyCasino1.2.oxp
    ~/.Oolite/AddOns/buoyRepair1.02.8.oxp
    ~/.Oolite/AddOns/YOUR_AD_HERE.oxp
    ~/.Oolite/AddOns/Dictators v1.4.oxp
    ~/.Oolite/AddOns/Cabal_Common_Library1.2.oxp
    ~/.Oolite/AddOns/behemoth 2.6.oxp
    ~/.Oolite/AddOns/FTZ v0.15.oxp
    ~/.Oolite/AddOns/contractor v4.1.oxp
    ~/.Oolite/AddOns/Oo-Haul.oxp
    ~/.Oolite/AddOns/RandomHits1.4.10.oxp
    ~/.Oolite/AddOns/Pirate_coves 1.2.2.oxp
    ~/.Oolite/AddOns/Anarchies2.5.oxp
    ~/.Oolite/OXP-dev/Furball.oxp
    ~/.Oolite/AddOns/sunskimmers.oxp
    ~/.Oolite/AddOns/PAGroove_Stations_v1.2.2.oxp
    ~/.Oolite/AddOns/The_Feudal_States_v1.11.oxp
    ~/.Oolite/AddOns/BehemothSpacewar 1.2.3.oxp
    ~/.Oolite/AddOns/Thargorn_Threat 1.5.oxp
    ~/.Oolite/AddOns/MilHUD-v3.4.oxp
    ~/.Oolite/AddOns/Tori2.01.oxp
    ~/.Oolite/OXP-dev/Factions.oxp
    ~/.Oolite/AddOns/TG2forSmivs' Anarchy.oxp
    ~/.Oolite/AddOns/BigShips 1.02.oxp
    ~/.Oolite/AddOns/YOUR_AD_HERE_set_B.oxp
    ~/.Oolite/AddOns/Commies.oxp
    ~/.Oolite/AddOns/Transports 2.52.oxp
    ~/.Oolite/AddOns/YOUR_AD_HERE_set_E.oxp
    ~/.Oolite/AddOns/PlanetFall 1.41.oxp
    ~/.Oolite/AddOns/DeepSpacePirates 1.3.oxp
    ~/.Oolite/AddOns/Smivs'Shipset-SD.oxp
    ~/.Oolite/AddOns/adcks_bulk_haulers_v1.4.oxp
    ~/.Oolite/AddOns/thargoid_wars 4.5.1.oxp
12:23:03.776 [rendering.opengl.version]: OpenGL renderer version: 1.4.0 ("1.4 Mesa 7.7.1"). Vendor: "Tungsten Graphics, Inc". Renderer: "Mesa DRI Intel(R) 945G GEM 20091221 2009Q4 x86/MMX/SSE2".
12:23:03.777 [rendering.opengl.extensions]: OpenGL extensions (104):
GL_EXT_abgr, GL_ARB_texture_env_crossbar, GL_EXT_texture, GL_ARB_shadow, GL_IBM_texture_mirrored_repeat, GL_EXT_texture_edge_clamp, GL_EXT_separate_specular_color, GL_EXT_blend_minmax, GL_EXT_texture_object, GL_ARB_texture_env_add, GL_INGR_blend_func_separate, GL_ARB_shading_language_120, GL_NV_texture_env_combine4, GL_EXT_texture_cube_map, GL_EXT_blend_logic_op, GL_ARB_draw_elements_base_vertex, GL_EXT_texture_env_dot3, GL_IBM_rasterpos_clip, GL_EXT_framebuffer_blit, GL_ARB_texture_env_dot3, GL_NV_light_max_exponent, GL_EXT_framebuffer_object, GL_EXT_blend_subtract, GL_EXT_copy_texture, GL_3DFX_texture_compression_FXT1, GL_MESA_window_pos, GL_ARB_multitexture, GL_EXT_stencil_wrap, GL_ARB_texture_border_clamp, GL_NV_vertex_program, GL_ARB_texture_env_combine, GL_SGIS_texture_edge_clamp, GL_EXT_packed_pixels, GL_EXT_texture_env_add, GL_SGIS_texture_lod, GL_ARB_depth_texture, GL_ARB_transpose_matrix, GL_NV_texgen_reflection, GL_NV_packed_depth_stencil, GL_EXT_stencil_two_side, GL_ARB_shading_language_100, GL_EXT_rescale_normal, GL_EXT_gpu_program_parameters, GL_ARB_map_buffer_range, GL_ARB_provoking_vertex, GL_ARB_pixel_buffer_object, GL_EXT_secondary_color, GL_SUN_multi_draw_arrays, GL_OES_read_format, GL_ARB_texture_mirrored_repeat, GL_ARB_copy_buffer, GL_EXT_polygon_offset, GL_EXT_draw_range_elements, GL_EXT_blend_equation_separate, GL_ARB_half_float_pixel, GL_EXT_texture_lod_bias, GL_EXT_texture_filter_anisotropic, GL_SGIS_texture_border_clamp, GL_SGIS_generate_mipmap, GL_NV_texture_rectangle, GL_ARB_texture_rectangle, GL_ARB_texture_non_power_of_two, GL_ARB_point_sprite, GL_EXT_packed_depth_stencil, GL_ARB_vertex_shader, GL_ARB_vertex_buffer_object, GL_ARB_sync, GL_ARB_shader_objects, GL_EXT_provoking_vertex, GL_IBM_multimode_draw_arrays, GL_MESA_ycbcr_texture, GL_ATI_separate_stencil, GL_EXT_texture_rectangle, GL_EXT_texture3D, GL_EXT_fog_coord, GL_EXT_subtexture, GL_ARB_window_pos, GL_EXT_point_parameters, GL_ARB_fragment_program, GL_EXT_texture_env_combine, GL_ARB_vertex_program, GL_EXT_bgra, GL_ARB_texture_cube_map, GL_ARB_point_parameters, GL_EXT_compiled_vertex_array, GL_EXT_vertex_array, GL_ARB_multisample, GL_APPLE_client_storage, GL_ARB_vertex_array_object, GL_ARB_draw_buffers, GL_EXT_multi_draw_arrays, GL_ARB_texture_compression, GL_APPLE_vertex_array_object, GL_EXT_cull_vertex, GL_ATI_texture_env_combine3, GL_APPLE_packed_pixels, GL_EXT_blend_func_separate, GL_MESA_pack_invert, GL_EXT_shadow_funcs, GL_ATI_blend_equation_separate, GL_EXT_blend_color, GL_NV_vertex_program1_1, GL_NV_blend_square, GL_EXT_pixel_buffer_object
12:23:03.800 [rendering.opengl.gpuSpecific]: Matched GPU configuration "Intel GMA 900/950 family".
12:23:03.800 [rendering.opengl.shader.support]: Shaders will not be used (OpenGL extension GL_ARB_fragment_shader is not available).
12:23:05.147 [shipData.load.begin]: Loading ship data.
12:23:13.781 [script.load.world.listAll]: Loaded 39 world scripts:
    Anarchies 2.5
    behemoth 2.6
    behemoth-spacewar 1.2.1
    BGS-M 1.3.2
    bigShips_populator 1.0.2
    buoyRepair 1.02.8
    Cabal_Common_Comms 1.2
    Cabal_Common_Functions 1.2
    Cabal_Common_Keyboard 1.2
    communist_population 2.11
    deep_space_pirates 1.3
    dictators.js 1.0
    Factions 1.0a1
    feudal-challenge.js 7.0
    feudal-mission.js 7.0
    feudal-planetfall.js 3.0
    feudal-promotion.js 4.0
    feudal-ranks.js 4.0
    feudal-tournament.js 8.0
    free-trade-zone
    Furball 1.0
    GalNavy 5.3.0
    genericHUDswitch.js 1.01, modified by Wyvern
    hofd 5.3.0
    hoopy_casino 1.2
    newskim
    OO-Haul Escort 1.60
    oolite-cloaking-device 1.75.2
    oolite-constrictor-hunt 1.75.2
    oolite-nova 1.75.2
    oolite-thargoid-plans 1.75.2
    oolite-trumbles 1.75.2
    Pi-Forty-Two Con stores 4.1.7
    Pirate_Coves 1.2.2
    PlanetFall 1.40
    Random_Hits 1.4.10
    thargoid_wars 4.5.1
    Thargorn_Witchspace_Battle 1.5
    transportSchedule 2.52
12:23:22.952 [debugTCP.disconnect]: No connection to debug console: "Connection to debug console failed: '' (outStream status: 7, inStream status: 7)."
12:23:22.953 [debugTCP.disconnect]: No connection to debug console: "Connection to debug console failed: 'unknown error.' (outStream status: 0, inStream status: 0)."
12:23:22.954 [debugTCP.connect.failed]: Failed to connect to debug console at address 127.0.0.1:8563.
12:23:23.147 [loading.complete]: ========== Loading complete. ==========
12:23:34.727 [script.load.world.listAll]: Loaded 39 world scripts:
    Anarchies 2.5
    behemoth 2.6
    behemoth-spacewar 1.2.1
    BGS-M 1.3.2
    bigShips_populator 1.0.2
    buoyRepair 1.02.8
    Cabal_Common_Comms 1.2
    Cabal_Common_Functions 1.2
    Cabal_Common_Keyboard 1.2
    communist_population 2.11
    deep_space_pirates 1.3
    dictators.js 1.0
    Factions 1.0a1
    feudal-challenge.js 7.0
    feudal-mission.js 7.0
    feudal-planetfall.js 3.0
    feudal-promotion.js 4.0
    feudal-ranks.js 4.0
    feudal-tournament.js 8.0
    free-trade-zone
    Furball 1.0
    GalNavy 5.3.0
    genericHUDswitch.js 1.01, modified by Wyvern
    hofd 5.3.0
    hoopy_casino 1.2
    newskim
    OO-Haul Escort 1.60
    oolite-cloaking-device 1.75.2
    oolite-constrictor-hunt 1.75.2
    oolite-nova 1.75.2
    oolite-thargoid-plans 1.75.2
    oolite-trumbles 1.75.2
    Pi-Forty-Two Con stores 4.1.7
    Pirate_Coves 1.2.2
    PlanetFall 1.40
    Random_Hits 1.4.10
    thargoid_wars 4.5.1
    Thargorn_Witchspace_Battle 1.5
    transportSchedule 2.52
12:23:48.591 [bigShips_populator]: 1 big trader(s) added to the Ermati system.
12:23:52.921 [station.launchShip.failed]: Cancelled launch for a Rogue Frigate with role defense_ship, as it is too large for the docking port of the Rock Hermit.
12:24:21.929 [Factions]: 1-ship battle at Edla
12:24:21.970 [Factions]: Faction A [0] Cobra Mark III
12:24:21.972 [Factions]: Faction B [0] Cobra Mk III
12:24:21.973 [Factions]: Faction C [0] Asp Mk II
12:24:21.978 [bigShips_populator]: 0 big trader(s) added to the Edla system.
12:24:22.152 [ai.message.receive]: AI factionAI.plist for Cobra Mark III 358 in state 'RETURN_TO_BATTLE' receives message 'COURSE_OK'. Context: handling deferred message, stack depth: 0
12:24:24.863 [Random_Hits]: Revenge striketime:QUITE_SOON Revenge jumps: 2
12:24:37.426 [ai.message.receive]: AI factionAI.plist for Cobra Mk III 359 in state 'RETURN_TO_BATTLE' receives message 'FRUSTRATED'. Context: BEHAVIOUR_FLY_TO_DESTINATION, stack depth: 0
12:24:37.469 [ai.message.receive]: AI factionAI.plist for Cobra Mk III 359 in state 'RETURN_TO_BATTLE' receives message 'FRUSTRATED'. Context: BEHAVIOUR_FLY_TO_DESTINATION, stack depth: 0
12:24:37.505 [ai.message.receive]: AI factionAI.plist for Cobra Mk III 359 in state 'RETURN_TO_BATTLE' receives message 'FRUSTRATED'. Context: BEHAVIOUR_FLY_TO_DESTINATION, stack depth: 0
12:24:37.541 [ai.message.receive]: AI factionAI.plist for Cobra Mk III 359 in state 'RETURN_TO_BATTLE' receives message 'FRUSTRATED'. Context: BEHAVIOUR_FLY_TO_DESTINATION, stack depth: 0
One Cobra sets off to the witch point, the other just hangs in space. Faction A is spawned as trader, B as pirate, and C as hunter.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

This is strictly a WIP, but in anticipation of questions about the code, here it is:

http://www.mediafire.com/download.php?f9ttsytswzl7tgc

I have kept the AI (and everything else TBH) as simple as I can at this stage. I usually test with 8 fighters per faction, it is currently set to 1 for the AI debug.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Spawning ships & AI

Post by Commander McLane »

m4r35n357 wrote:
1. Yes, I do use AI logging, but it is very verbose(especially for combat!) so I didn't post it here except to mention the "FRUSTRATED" message. I need to run it again I think (aaaargh!).
If the AI logging shows that your ships do use the desired AI, it's fine.
m4r35n357 wrote:
2. I don't use total patrol but I will have a look around . . but I use switchAI so I assumed that would give me a clean start. Was I mistaken?
That depends on where you use a switchAI, and how early it is performed. If used in the post-GLOBAL state of the normal AI, it will be performed later than if used in the shipSpawned-event handler in a script. Other scripts could at the same time also try to switch AIs, therefore yours could be overridden.

It's really difficult to make even educated guesses without knowing enough facts. Can you post your AI (or PM it to me) and the AI-switching script, if any?

EDIT: Okay, the log is at least a little helpful. Your Cobra receives a COURSE_OK message, but doesn't react upon it. Only then it gets more and more frustrated, which usually happens if an NPC can't fly to its destination. In the AI-code you posted earlier there was no setting of speed or speedFactor. Where do you set it? The appropriate place would be in the COURSE_OK message, but that seems not to exist. Thus your ship gets a speed 0, which frustrates it.

That's my best guess right now. I can diagnose better if I know the AI.

EDIT 2: And now you've posted a link. Will download it. :)
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

Commander McLane wrote:
m4r35n357 wrote:
1. Yes, I do use AI logging, but it is very verbose(especially for combat!) so I didn't post it here except to mention the "FRUSTRATED" message. I need to run it again I think (aaaargh!).
If the AI logging shows that your ships do use the desired AI, it's fine.
m4r35n357 wrote:
2. I don't use total patrol but I will have a look around . . but I use switchAI so I assumed that would give me a clean start. Was I mistaken?
That depends on where you use a switchAI, and how early it is performed. If used in the post-GLOBAL state of the normal AI, it will be performed later than if used in the shipSpawned-event handler in a script. Other scripts could at the same time also try to switch AIs, therefore yours could be overridden.

It's really difficult to make even educated guesses without knowing enough facts. Can you post your AI (or PM it to me) and the AI-switching script, if any?

EDIT: Okay, the log is at least a little helpful. Your Cobra receives a COURSE_OK message, but doesn't react upon it. Only then it gets more and more frustrated, which usually happens if an NPC can't fly to its destination. In the AI-code you posted earlier there was no setting of speed or speedFactor. Where do you set it? The appropriate place would be in the COURSE_OK message, but that seems not to exist. Thus your ship gets a speed 0, which frustrates it.

That's my best guess right now. I can diagnose better if I know the AI.

EDIT 2: And now you've posted a link. Will download it. :)
hehe, actually there are two cobras, the first is the trader, the second is the pirate. I took the speed setting out because I thought it would default to 1 - I shall put it back! Doesn't seem to bother the trader though, so perhaps some other AI has cut in as you said, I'll look at the callback approach. Thanks for the help.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Spawning ships & AI

Post by Commander McLane »

It depends on when the AI switch happened, which I can't say for sure. The trader got spawned with route1traderAI, which sets a speed very early. The respective AIs for pirates and police don't do that.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

Commander McLane wrote:
It depends on when the AI switch happened, which I can't say for sure. The trader got spawned with route1traderAI, which sets a speed very early. The respective AIs for pirates and police don't do that.
Putting the speed back worked; they are now fighting like champs, thanks! Now I just need to work out how to borrow ships from other OXPs, is there a standard approach to doing this?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Spawning ships & AI

Post by Commander McLane »

And of course for your final OXP you shouldn't use generic roles for spawning your ships. Better give those ships you want to use a set of custom roles. Especially spawning ships with role 'police' can have unwanted side effects. But also with 'trader' and 'pirate' you can get OXP-clashes, because other OXPs will tend to assume that ships with primary role 'police', 'trader' or 'pirate' are exactly what they appear to be.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

Commander McLane wrote:
And of course for your final OXP you shouldn't use generic roles for spawning your ships. Better give those ships you want to use a set of custom roles. Especially spawning ships with role 'police' can have unwanted side effects. But also with 'trader' and 'pirate' you can get OXP-clashes, because other OXPs will tend to assume that ships with primary role 'police', 'trader' or 'pirate' are exactly what they appear to be.
That is exactly what I want to do next, but I'm guessing ATM how to achieve this, can I just spawn them with role names defined in other OXPs, or do I need to set the roles later? This is actually my big question that I couldn't ask until solving the first bit . . .
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Spawning ships & AI

Post by Commander McLane »

m4r35n357 wrote:
Now I just need to work out how to borrow ships from other OXPs, is there a standard approach to doing this?
First of all, consult the licenses of the OXPs you want to borrow from. If they permit it, you're free to go. Still it's considered common courtesy to drop the OXP authors a note that you intend to use their work.

Technically, you have two choices:

(a) copy everything wholesale and paste it into your OXP: shipdata, models, textures, shaders. Rename everything in order to avoid clashes. Then re-write the shipdata according to your needs: give the ship its AI, role(s) and script right from the start. This way you make your OXP independent of other OXPs.

(b) leave everything where it is, and just create a shipdata by using like_ship and only those keys which need to be changed: AI, role(s) and script (and whatever you want to change as well). This way your OXP gets leaner, but it becomes dependent of the original ship OXP. It only works if the other OXP is installed as well.

Which choice you make is your personal preference. Both have advantages and disadvantages. If you become independent, you don't force the player to install something else alongside. On the other hand the copied ships become final. If their creator makes a new version, your OXP will still use the old version. If you decide for a dependency, it's the other way round. The ships will always be identical to the latest installed version of their original OXP. But your player has to find and install it first.
m4r35n357 wrote:
can I just spawn them with role names defined in other OXPs, or do I need to set the roles later?
That would be a bad idea. You need to give them role names specific to your OXP in your edited shipdata.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

Commander McLane wrote:
m4r35n357 wrote:
Now I just need to work out how to borrow ships from other OXPs, is there a standard approach to doing this?
First of all, consult the licenses of the OXPs you want to borrow from. If they permit it, you're free to go. Still it's considered common courtesy to drop the OXP authors a note that you intend to use their work.

Technically, you have two choices:

(a) copy everything wholesale and paste it into your OXP: shipdata, models, textures, shaders. Rename everything in order to avoid clashes. Then re-write the shipdata according to your needs: give the ship its AI, role(s) and script right from the start. This way you make your OXP independent of other OXPs.

(b) leave everything where it is, and just create a shipdata by using like_ship and only those keys which need to be changed: AI, role(s) and script (and whatever you want to change as well). This way your OXP gets leaner, but it becomes dependent of the original ship OXP. It only works if the other OXP is installed as well.

Which choice you make is your personal preference. Both have advantages and disadvantages. If you become independent, you don't force the player to install something else alongside. On the other hand the copied ships become final. If their creator makes a new version, your OXP will still use the old version. If you decide for a dependency, it's the other way round. The ships will always be identical to the latest installed version of their original OXP. But your player has to find and install it first.
m4r35n357 wrote:
can I just spawn them with role names defined in other OXPs, or do I need to set the roles later?
That would be a bad idea. You need to give them role names specific to your OXP in your edited shipdata.
Noted, this was the "easy" option if it was going to work. So option (b) is the one for me, licenses permitting, but I don't need to rush into it, I can explore the mechanics of the fighting a bit first. Thanks again.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

Commander McLane wrote:
(b) leave everything where it is, and just create a shipdata by using like_ship and only those keys which need to be changed: AI, role(s) and script (and whatever you want to change as well). This way your OXP gets leaner, but it becomes dependent of the original ship OXP. It only works if the other OXP is installed as well.
This works very nicely, except for one OXP which has conditions in the ship plist entries. Is there a recommended way of nulling these out, or do I have to manually add my own more lenient conditions?
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Spawning ships & AI

Post by m4r35n357 »

m4r35n357 wrote:
Commander McLane wrote:
(b) leave everything where it is, and just create a shipdata by using like_ship and only those keys which need to be changed: AI, role(s) and script (and whatever you want to change as well). This way your OXP gets leaner, but it becomes dependent of the original ship OXP. It only works if the other OXP is installed as well.
This works very nicely, except for one OXP which has conditions in the ship plist entries. Is there a recommended way of nulling these out, or do I have to manually add my own more lenient conditions?
OK I did this in the plist, seems to work:
"conditions" = ();

Please correct me if I'm wrong, otherwise I'm set now, thanks!
Post Reply