Creating a technology the AI definitely can't access

Distant Worlds is a vast, pausable real-time, 4X space strategy game which models a "living galaxy" with incredible options for replayability and customizability. Experience the full depth and detail of large turn-based strategy games, but with the simplicity and ease of real-time, and on the scale of a massively-multiplayer online game. Now greatly enhanced with the new Universe release, which includes all four previous releases as well as the new Universe expansion!

Moderators: Icemania, elliotg

Post Reply
NewToModdingThis
Posts: 3
Joined: Sun Oct 01, 2023 8:24 pm

Creating a technology the AI definitely can't access

Post by NewToModdingThis »

Hello, simply put my goal is to make a technology that the AI cannot access, unlock, research, etc but the player can.

I have a couple ideas on how I might accomplish this, but I'm not sure how I could easily test that these would work, and I can't find answers to some of the specific questions I have in the documentation or online. I've not made any mods for this game before, so I am hoping someone can save me some time by confirming which methods would work, or if it's impossible.

Basically, I want this tech to just give the player a really, really big maximum ship size. At least so far that is the only thing I want it to do. I know there's a possibility of it being stolen in an espionage event. I'm not certain how to have 100% confidence that won't happen, but that can be addressed later.

Method One: I figure I could create an unplayable race, make the technology a racial tech of that race, and then add the tech with the editor. However, the spawning mechanisms of unplayable races is unclear to me. I don't want to get bitten down the track because marking a race as unplayable still means they can spawn as independents, or that there's some event that has a chance of spawning them. I don't know how to be certain it won't happen without waiting many years in-game and periodically checking everyone's demographics to see if they spawned somewhere.

I figure the easiest way to build this mod would be to copy an existing race, change the name and IDs, and then just mark them as unplayable / non-spawning / whatever else to prevent them from ever actually appearing.


Method Two: But if unplayble races can't be completely prevented from spawning, I could do something with an event that unlocks the tech? In a prewarp start, the FTL techs are unlocked by exploring ruins. From the modding guide it seems like there isn't a specific "tech = locked" clause, and that this locked tech has a specific "Primitive Hyperdrive Tech" special function code.

By making a tech, giving it that same code to make it 'locked' until discovered, building an event that unlocks it, spawning that event onto something in the home system and removing it after, that would bypass the race thing. But it's unclear if this would result in it working that way, or if it would result in having a 50/50 chance of FTL tech or this ship size tech whenever you scan the vanilla ruins. This one would be a bit easier to test, but from the face of it feels like it'd be more complicated to write than the other method.


Combined? I could do both versions, make one tech with each AI-keep-away method and make one of them a parent of the other one. But I don't know if that means it's more secure or less secure. Ultimately there seems to be a lot of tight restrictions and hardcoded things that aren't 100% documented so I don't know what I don't know.


Edit: I'm trying the racial tech method first. I've copied the Ackdarian race, named it "AbsentRace". "Expanding", "Can Be Pirate", "Can Be Normal Empire", and "Playable" are all set to No now. I'm hoping that'll be thorough enough to stop them from existing through any means. Really hoping there isn't some kind of event or wonder or something that creates a population of a random species somewhere but I feel like that's unlikely.

Seems I have to tie the tech to a component in order to make it a racial thing? As in, racial techs seem to be tied to 'Special component'. They already had one with the id of 42 in there, so, deleted that to be safe. Replacing it with a dummy component that will hopefully get classified as 'obsolete' quickly and disappear.


Edit 2: I know directly editing the vanilla files instead of making a mod is usually frowned upon, but this theme thing is confusing the hell out of me. That and I might want to try out the Ancient Era at some point and it seems I can only do one. Making a near-invisible dummy race has proven a lot more difficult than I expected, and progress is still slow. So if there's anyone here who could save me a day or two trying to get this all working neatly, I would deeply appreciate it. In the meantime, the work continues.


Edit 3: It's implemented, and now I suppose I just wait to see if it crops up anywhere else. I ended up bypassing the theme system by altering the files directly, tacking on my research project, component, and racial stuff on the ends of the vanilla files and all. I made backups, of both the vanilla files and of my modified files in the event Steam reverts them.

Additionally, while it is not documented in the Modding Guide, I used a program called the Distant Worlds Mod Editor by Sabranan to help me translate some of the numbers more quickly. In its research page, it has options that extend beyond those documented in the guide, and the 'Special Function Code' number in my research project is 5, which the editor labels "Starts Locked". I'm hoping that and the racial exclusivity will be sufficient barriers preventing the AI from acquiring this technology. I'll also need lots of counter-espionage, I think.
Post Reply

Return to “Distant Worlds 1 Series”