Invisible AI ships using a custom ship style

Detailed explanation and debug.err included herein

https://forums.galciv2.com/?aid=144025
In the course of assisting me with this issue, Kryo has asked that I create a new thread in this forum. For reference, and should it be required, the thread in which that happened is in the external link I included when I created this thread. It is located at the very end of the thread and listed as "Link." Please refer to it if necessary.

I wanted to create a custom ship style and ships for a custom race that would guarantee that all ships created by AI controlling that race would adhere only to custom ships rather than default ships that would look "out of place" due to the nature of the race (in this case, The Borg from Star Trek.) I wanted to use all in-game graphics, and basic custom ships and ship templates to dictate what the general appearance of AI controlled and produced ships would be. With the greatly appreciated aid of Kyro, I managed to successfully create a custom ship style that was selectable in-game by the player (myself,) which incorporated custom ships and templates with unique prefixes. However, ships produced by the AI remained invisible under certain circumstances. Below are the exact steps I took, and the situations in which ships remained invisible. I wish to be as thorough as possible for the sake of clarity, so that anything I did that might be causing this issue inadvertently can be discerned by those with far more technical comprehension of the game's inner workings than I possess. I hope this is sufficiently clear. Thank-you for your time and attention!

1) I opened an existing Ship Style.xml file in GalCiv2\DarkAvatar\Data\English\ShipStyles, changed instances of the original style's name to "Borg Style," and changed the
11,443 views 17 replies
Reply #1 Top
While your debug doesn't show the same errors as others reporting invisible ships, this line could be related if you didn't notice any invisible ships until the end of the debug:

ASSERT ERROR in file .\Source\Starship.cpp at line 4476.

I'll see if I can get Cari over here to look at it.

In the meanwhile, can you zip up all of your customized files (style, templates, new core shipcfgs, etc) and email them to me so I can try it myself and see if I encounter the same issue? My address is kryo **AT** stardock.com (be sure to spell it right: k r y o).
Reply #2 Top
I can't believe I thought your name was KYRO all this time LOL. I swear I'm going blind. OK, sure thing, and thanks again. If it will still let me, I'll change your name to Kryo in my above post lol.
Reply #3 Top
Ok, simple problem: you didn't configure the templates you made to be used by the AI in your custom style. I set some up and they show up fine, though you may want to use my mod, and use the 'caps' to control where the AI places components at. The ships look quite odd with massive colony modules poking out of the cubes
Reply #4 Top
Oh I'm glad it's something simple. Thank-you! So, how does one configure templates to be used by AI in a custom ship style? Do I just enter the template name (i.e. CubeDesign_t) in the appropriate field in the Borg Style.xml ? And what mod are you referring to? If there's a mod that can do that (limit where AI attached modules) it would certainly be a plus. Thanks again!
Reply #5 Top
When configuring an AI opponent, pick Borg Syle and click the Create Custom Style button. There you can assign templates to each AI ship role (I'm pretty sure I mentioned this in the other thread).

See my mod here.


Reply #6 Top
Oh, I just selected the Borg Collective that was available there, assuming it would have retained the Borg Style I chose for it when I played as them. I thought since it was saved, it would have saved those configuration settings as well. I take it AI and player controlled settings for those things are separate then? I'll make sure to remember that! Is there a way to prevent the game from making two Borg Collectives? It seems to create two; the one I made that I played as, and the new one I configure when I choose create opponent.

Thank-you. I'll try your mod as well. Thanks again for all your help. I don't know how I would have figured this out, otherwise. (If you can't tell, I'm not the brightest person on the planet lol.)
Reply #7 Top
Hey, I don't know if my advice will help, but I've been having some problem with invisible (actually, non-existant) ships when I load saved games. It seems to be due to the shipstyles of all the players changing when I load a saved game - this means any custom ships I've made before saving cannot be found in the new file and come up "blank" - that is, they work in the game but have no model and no hard points to add things too.
Through e-mail bug submission CodeCritter has advised me to re-install, which I will do. One similarity between Vamphaery's situation and mine is the following line(s) in the debug.err :
Debug Message: LoadHardpointsFromPrefsFile failed to load ship config file: ./Data/ShipCfg/\(null)_ColonyShip.shipcfg
...
Debug Message: LoadHardpointsFromPrefsFile failed to load ship config file: ./Data/ShipTemplates/\BORG_ColonyShip.shipcfg
...
Debug Message: LoadHardpointsFromPrefsFile failed to load ship config file: ./Data/ShipTemplates/\BORG_MissileBoat.shipcfg

It seems to me (I could be wrong) that the game makes "invisible" ships when it tries to load a shipcfg that does not exist for a given style. Maybe the AI is trying to use "standard" ship types (Like ColonyShip or MissleBoat) for which no ship has been defined in the "BORG" ship style.

Also - is it not possible to make a custom race use a specific shipstyle within the game itself? Why did Vamphaery have to edit the xml and rename files and all that?
Reply #8 Top
I take it AI and player controlled settings for those things are separate then?


Yes. The AI needs to be explicitly told which templates to use for which roles via the custom style screen as noted above. Human players can just use whatever they like.

Is there a way to prevent the game from making two Borg Collectives?


If you made two separate Borg races, both will be fair game for selection if you play against random opponents. If that's not what you're talking about, please be more specific.
Reply #9 Top
Also - is it not possible to make a custom race use a specific shipstyle within the game itself? Why did Vamphaery have to edit the xml and rename files and all that?


Because he wanted to create an entirely new one with its own set of templates and such not shared with any other style. This is only possible with some manual work, as you need to change the prefix in the style xml. The copying of templates to the game's core ships folder may not have been neccesary though had he assigned templates to the AI roles initially, though
Reply #10 Top
Well, I really hate to say this, but... the ships are still invisible lol. I started a new game, and selected only a single race as an opponent (The Borg Collective.) I clicked the "Edit" button, and made sure Borg Style was selected as the style, and saved the race. Once in the game, I (as the Terran Alliance) purchased a Scout M0-17 from the Borg Collective, and it was invisible. I purchased two more ships, and they too were invisible.   

Is there anything else I can try? Again, sorry this is taking so long!
Reply #11 Top
You have to choose Borg Style, then click Create Custom Ship Style, then select each role on the left and double click on a template on the right to assign them. When done right you should see all the icons of the designs on the left, rather than blank spots. Then and only then is it set up right, and it should work just fine with no missing ships.
Reply #12 Top
Wow. I feel really stupid now LOL. I cannot believe I didn’t see that the “create custom ship style” button wasn’t grayed out anymore. Seriously, this may be tmi, but for the last month or two, simple things like this boggle my mind as if I'm suddenly a five year old or something. I'm actually considering mentioning it to my doctor, as I seem to have increasing difficulty concentrating. Of course, that could simply be how addicting this game is lol.

Thank-you VERY much. All ships are now visible. I don't mind the functional modules sticking out of the ships. It's pretty humorous actually. I will experiment with your (apparently VERY useful, btw!) mod, though.

Once again, you have my thanks. I hope this thread helps other equally confused players - if there are any lol.
Reply #13 Top
I just wanted to add, for those who don't know and who may be looking at this thread and the one it links to for answers to the same questions I asked: Kryo's mod (to which he linked in an above post) provides ship components with no hard points that allow you to cover hard points on ships you've made, forcing the AI to only attach functional modules, weapons, engines, etc. to remaining hard points. Initially I thought it would be useful but not a prerequisite to my enjoyment of the ships I was making. Now, however, after using it for a few hours, I've found that it is truly indispensable. As a noob, I recommend it wholeheartedly lol. (For whatever that's worth!)
Reply #14 Top
Just be careful to not cover too many hard points, as doing so may result in crippling the AI (it won't have enough hardpoints to use up the hull's full capacity).
Reply #15 Top
Right; I'm making sure when I design them that I would be able to aply enough components to be godly with all the techs, and sufficiently strong at the start of the game, if need be, before saving them. These components really are helpful, though. So far the AI is puting up a good fight. It will take some tweaking of course, but it helps a great deal to shape the appearance and feel of the ships.
Reply #16 Top
Is there a way to prevent the game from making two Borg Collectives? It seems to create two; the one I made that I played as, and the new one I configure when I choose create opponent

If you made two separate Borg races, both will be fair game for selection if you play against random opponents. If that's not what you're talking about, please be more specific.

I think I know what he's talking about. You copy your designs to the game's ShipCfg dir to replace the standard core ships. You also create a custom ship style in the game from the designs in your template dir, this is for the AI to use. Now, if you start a game, the replaced standard core designs show up, but also their identical counterparts from the template dir. Doubling up all the designs.
Reply #17 Top
I'm one step further:

I think the game requires also shipcfg files in the game's core ShipTemplates dir. Without them, designs icons under the Templates/Core tab were invisible.

But again, we have the doubling up of templates if you use the style for yourself and the AI. The same ships are visible under the Templates/Core and the Templates/User tab.