Autodesign and AI Ship Variety

A place for discussion of making game modifications.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Autodesign and AI Ship Variety

Postby harpy eagle » Mon Apr 30, 2018 8:31 pm

sven wrote:I think these mods/patches should be pretty naturally complementary. If we wanted to get really fancy with it, I'd guess the the warship_classification() code could probably be extended to read a design hint out of ship.source_design, creating a hook that would allow fleet templates to reward using multiple different designs based on the same hull; but that's probably overkill. I might just start by adjusting the chosen PartOrdering function based on the hull type and ai_state.strategy_cards.... A very short simple diff could get a lot of mileage here, I think. (And you don't necessarily need a PD, long range, and bombard version of a heavy cruiser, if your navy already has a mix of missile cruisers, heavy cruisers, and escort cruisers.)

I'm actually a little curious as to how some of the mechanisms in fleet_template.lua work.

So there's a ships table that keeps track of how many ships of each class have been built, but it gets indexed using a table created inside warship_classification(), which is called for each new ship. I thought when you use tables as keys it indexes them by their instance though?

zolobolo
Posts: 958
Joined: Fri Nov 25, 2016 3:49 pm

Re: Autodesign and AI Ship Variety

Postby zolobolo » Mon Apr 30, 2018 8:37 pm

harpy eagle wrote:Youch, that would be a bug.

This I think has been like this in vanilla - still worth fixing if you can :)

User avatar
sven
Site Admin
Posts: 1392
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Autodesign and AI Ship Variety

Postby sven » Mon Apr 30, 2018 9:05 pm

harpy eagle wrote:I'm actually a little curious as to how some of the mechanisms in fleet_template.lua work.

So there's a ships table that keeps track of how many ships of each class have been built, but it gets indexed using a table created inside warship_classification(), which is called for each new ship. I thought when you use tables as keys it indexes them by their instance though?


Um, you're right to be curious, because there's a bug here. I probably should be calculating the number of ships in a given 'slot' using the following:

Code: Select all

      local targetv
      local c
      for slot,v ; normalized
        if slot[ship_class]
          c=0
          targetv=v
          for ship_class ; slot
            c+=ships[ship_class]
          end
          break
        end
      end

User avatar
sven
Site Admin
Posts: 1392
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Autodesign and AI Ship Variety

Postby sven » Mon Apr 30, 2018 9:09 pm

sven wrote:
harpy eagle wrote:I'm actually a little curious as to how some of the mechanisms in fleet_template.lua work.

Um, you're right to be curious, because there's a bug here. I probably should be calculating the set of current ships in a given 'slot' using the following:


More generally though, the core idea is that you're just looking to fill up different slots in your navy, and a single ship can potentially fit in multiple different slots. Thus, most navy specs include some very general wildcard slots, like 'Big' and 'Small', while potentially reserving other slots for things that navy spec is particularly concerned with, like "Assault Cruisers".

Each 'slot' is defined by a set of string keys, and we assume that any key will be included in at most one slot. Um, without that 'at most one' assumption, the code is nonsense; so I should probably add a sanity check for it as well, while I'm fixing stuff.

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Autodesign and AI Ship Variety

Postby harpy eagle » Mon Apr 30, 2018 9:35 pm

sven wrote:More generally though, the core idea is that you're just looking to fill up different slots in your navy, and a single ship can potentially fit in multiple different slots. Thus, most navy specs include some very general wildcard slots, like 'Big' and 'Small', while potentially reserving other slots for things that navy spec is particularly concerned with, like "Assault Cruisers".

Each 'slot' is defined by a set of string keys, and we assume that any key will be included in at most one slot. Um, without that 'at most one' assumption, the code is nonsense; so I should probably add a sanity check for it as well, while I'm fixing stuff.

Thanks, that helped, and I figured out what I was missing.

zolobolo wrote:If possible please swap the extra reactor of the Yoral Frigate to something else like reinforced bulkhead or shield

Same for Gremak Exploration Cruiser - that one has two scanners

Strange, I can't reproduce this.

This is what I have:
Image
Image

Note that the Yoral don't actually start with the tech needed for bulkheads, so this is after I forced them to research it. Instead the AI fills the slots with warp lane amps. Still a bad default choice (additional maneuvering jets makes more sense I think), but I don't see the bug happening as shown in your screenshot.

zolobolo
Posts: 958
Joined: Fri Nov 25, 2016 3:49 pm

Re: Autodesign and AI Ship Variety

Postby zolobolo » Wed May 02, 2018 1:10 pm

harpy eagle wrote:This is what I have:

Strange - have seen this several times and is the default design I get when starting with Yoral... cant you see it there?
Otherwise the last Save I have sent to you "Orthin Third" contains such a game where Yoral AI is utilizing them

harpy eagle wrote:Note that the Yoral don't actually start with the tech needed for bulkheads, so this is after I forced them to research it. Instead the AI fills the slots with warp lane amps. Still a bad default choice (additional maneuvering jets makes more sense I think), but I don't see the bug happening as shown in your screenshot.

Have to check this myself, sounds strange for Yoral

In case of Gremak Scout Cruiser, your image shows the issue: two deep space scanners when their effect does not stack - I always replace the second one with weapons

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Autodesign and AI Ship Variety

Postby harpy eagle » Wed May 02, 2018 3:14 pm

zolobolo wrote:In case of Gremak Scout Cruiser, your image shows the issue: two deep space scanners when their effect does not stack - I always replace the second one with weapons

It's actually hardcoded that way in the hull config so I thought it was intentional. I can change it of course.

Edit: Update (31e779f):
The AI Gremak now designs their scout cruisers like so:

Image

Also: If the auto-designer has nothing else to fill a system slot with, it will add only 1 warp lane amplifier. After that it will add maneuvering jets.

zolobolo
Posts: 958
Joined: Fri Nov 25, 2016 3:49 pm

Re: Autodesign and AI Ship Variety

Postby zolobolo » Fri May 25, 2018 12:42 pm

There are several version of ships occuring with no visible difference
Especially for Humans: thre are three starting Destroyer, Light Cruiser and Heavy Cruiser designs - all the same.

The Humans aslo have access to the Heavy Cruiser templates due to heavy hulls tech already being researched wjen the mod is activated

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Autodesign and AI Ship Variety

Postby harpy eagle » Fri May 25, 2018 1:17 pm

zolobolo wrote:There are several version of ships occuring with no visible difference
Especially for Humans: thre are three starting Destroyer, Light Cruiser and Heavy Cruiser designs - all the same.

Yeah, doing it that way made implementation a bit simpler and I figured it was harmless, since the player never sees them anyways.

As the AI gains technology and access to different modules the autodesigner should take the different starting designs down different paths.

The main issue with this mod right now is that ever since AI strategy cards were introduced, the AI does not have any logic to control which of the three it builds - it only builds the one with the best combat power to build time ratio. Which is not bad, but I would have liked to enforce some variety.

zolobolo
Posts: 958
Joined: Fri Nov 25, 2016 3:49 pm

Re: Autodesign and AI Ship Variety

Postby zolobolo » Fri May 25, 2018 4:05 pm

Ah so the implementation of the strategy cards has laready begun?
Guess it really doesn't make sense to mod these thigns untill the fucntion is fully implemented then

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Autodesign and AI Ship Variety

Postby harpy eagle » Mon Nov 05, 2018 3:21 am

Yeah, part of the reason I put this down for a while. I think there were some general improvements also so it may be worth dusting off though. I can't remember exactly but I think it had to do with the AI never fitting ships with heavy weapons. I also remember overhauling how the autodesigner picked weapon mods.

zolobolo
Posts: 958
Joined: Fri Nov 25, 2016 3:49 pm

Re: Autodesign and AI Ship Variety

Postby zolobolo » Wed Nov 07, 2018 8:56 pm

Yes that is still a thing in case of refit: it does not make use of heavy weapons

Generic AI ship designs do seem to use it though

Chasm
Posts: 562
Joined: Sat Feb 06, 2016 9:14 pm

Re: Autodesign and AI Ship Variety

Postby Chasm » Wed Nov 07, 2018 11:38 pm

The reason the computer design does not use heavy weapons is because of the low damage output from them compared to the standard version. About the only one it will use is hellbore.

User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Autodesign and AI Ship Variety

Postby harpy eagle » Sat Nov 10, 2018 10:07 pm

Yeah, the way I fixed the AI use of heavy weapons in this mod was by creating a new metric for the AI to use when evaluating heavy weapons, that scored them based on both their range and damage. The vanilla AI always goes for weapons that maximize damage per shot.

zolobolo
Posts: 958
Joined: Fri Nov 25, 2016 3:49 pm

Re: Autodesign and AI Ship Variety

Postby zolobolo » Sun Nov 11, 2018 11:10 am

Say Harpy Eagle: hasn't this mod also been integrated into the main DEV branch at one point?

I thin kyou have also already adressed the obvius design flaws of some starting layouts liek th Yoral frigate douple reactor or the double sensor found on many scout ships - but since I have been seeing these for a long time now again I goess it might just have been me not redeploying this mod...


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron