ENDLESS™ Space 2 is turn-based 4X space-strategy that launches players into the space colonization age of different civilizations within the ENDLESS™ Universe. Your Vision. Their Future.
When you activate the modding tools you will have access to special development tools in the game but it will decrease the game performance.
Will --enablemoddingtools enable any additional features other than E.N.F.E.R (Such as the Shift+F1 Menu) ?
That menu in particular would be very useful to create particular circumstances to test how the AI reacts which are otherwise very hard to test.
While it is currently possible to enable the menu editing the program memory, I think that it should be enabled in the AI Modding dedicated game build if not already so that all AI Modders can use it.
Looking forward to when the build arrives, I will be looking at the skeleton mod project in the meantime.
Thanks for the answers. I will create new topics next time.
For the build issue, it was using vscode, the change to do was in .vscode/task.json so its vscode specific.
We will fix this for the next release !
For the heuristic view, I get the same things as you but I through that we would usually get more information that just a base value (a list of component which modify the base value to get the final motivation). I tried to view the deetails of many motivation, some with lots of decimal so clearly been a computed value and not base values and this only got this base value = 0.15602373 (or something like that). In fact in the stream this is clearly shown. I am missing something?
No it's seem there is a problem in the build i will investigate !
Thanks for the answers. I will create new topics next time.
For the build issue, it was using vscode, the change to do was in .vscode/task.json so its vscode specific.
For the heuristic view, I get the same things as you but I through that we would usually get more information that just a base value (a list of component which modify the base value to get the final motivation). I tried to view the deetails of many motivation, some with lots of decimal so clearly been a computed value and not base values and this only got this base value = 0.15602373 (or something like that). In fact in the stream this is clearly shown. I am missing something?
After playing a little with the modding version, I have a few questions (Not sure if posting everything here is the best way, should I create specific topics?):
Maybe a topic by question is more simple to close discution when finish, and help other to search if the same problem occur.
* I am not able to get the heuristic information on the decision. I started a new game and imediatly checked the enable heuristic checkbox and still nothing. even after several turns, on decision which appeared after I checked the box I don't have the details. the box state is saved since if I reopen the page, it stay checked. What I am missing?
i do a test with the current build and after i check the box, when i clicked it's work
* with the debug menu, is there a way to reveal the whole galaxy without giving this information to the currently active empire? I found the empire switch so its ok, but this could still be useful.
The reaveal galaxy is by empire, and give the the vision to one empire, you can have one empire assign just for the vision for test purpose
* Is it normal that the game/ai only use between 20 and 30% of my cpu (on a ryzen 1600x so 6cores/12threads)? the decision counter in enfer debug tool only goes up about one decision per second which seems slow...
For the moment there is one thread assigned for the AI, so the CPU seem normal, in order to increase this limit there some dev to do in our side to ensure that all the system is fully thread safe.
Maybe we rise the number of thread for the future if this was mandatory
* How often are decision generated/updated? it seems not very often, is there some kind of trigger? any way to control this?
We do 4 full decision by turn, and one more by gameplay event (click, fleet movement, battle, notification ....)
* Can we add/replace analysis? for example to tweak the Computestrategicstock & resourceneed one?
Yes , you can, if you open the EndlessWar example project, the ForceNemesis job override the ComputeBestEnemy job,
You just need wait the job you want enriched, and do what you want to the desired value !
* Note: I had this build error on both examples:
MSBUILD : error MSB1009: Project file does not exist.
I had to change the name of the project in the task.json to the correct one (like "Sources\\AIModEndlessWar.csproj") this should probably be fixed to help other to start :)
Are you in visual studio code, or visual studio ?
* I saw that we can create new fleet behavior with a nice looking decision tree. Nothing preventing us to use that right?
No you can, you have just to create a FleetMissionTask linked to the created FleetMission that handle your behavior tree !
there is no limitation !
* have you tried to compare AI before and after changes by having them battle? like half of the player using the original and the other half the modified one? Any recommended way to do that? for new generator, it easy enough to disable them conditionally in the getcontexts for example, but is there a way to conditional disable existing generator?
For the moment we dont have this kind of feature. we dont have different version of generator for the moment.
But we have some conditional generator by faction in order to specialize AI by faction or personality.
After playing a little with the modding version, I have a few questions (Not sure if posting everything here is the best way, should I create specific topics?):
* I am not able to get the heuristic information on the decision. I started a new game and imediatly checked the enable heuristic checkbox and still nothing. even after several turns, on decision which appeared after I checked the box I don't have the details. the box state is saved since if I reopen the page, it stay checked. What I am missing?
* with the debug menu, is there a way to reveal the whole galaxy without giving this information to the currently active empire? I found the empire switch so its ok, but this could still be useful.
* Is it normal that the game/ai only use between 20 and 30% of my cpu (on a ryzen 1600x so 6cores/12threads)? the decision counter in enfer debug tool only goes up about one decision per second which seems slow...
* How often are decision generated/updated? it seems not very often, is there some kind of trigger? any way to control this?
* Can we add/replace analysis? for example to tweak the Computestrategicstock & resourceneed one?
* Note: I had this build error on both examples:
MSBUILD : error MSB1009: Project file does not exist.
I had to change the name of the project in the task.json to the correct one (like "Sources\\AIModEndlessWar.csproj") this should probably be fixed to help other to start :)
* I saw that we can create new fleet behavior with a nice looking decision tree. Nothing preventing us to use that right?
* have you tried to compare AI before and after changes by having them battle? like half of the player using the original and the other half the modified one? Any recommended way to do that? for new generator, it easy enough to disable them conditionally in the getcontexts for example, but is there a way to conditional disable existing generator?
Really looking forward to reading more documentation. Looking over the example code provided, I'm not at all certain where the hooks are for communicating information outward to the player. Are there ways to trigger pop-up communication with arbitrary text (to, for example, add more faction-specific dialogue that can communicate AI state to the player in a diegetic fashion)? I would love to see a section of documentation dedicated to explaining the different tools available for this type of state communication.
Also, hello everyone!
When will provide a complete AI mod with the documentation in order to have some concrete example!
For do some new popup, there a mood message system (you must just create a MoodMessageTask), but you must mod the localization files too to have the text in all language.
So if I understand correctly, if we have several contexts or parents for a decision, we could call ContinueDecision several time in the same call of GetContexts/GetParents. GenerateDecision would them be called several time allowing to return either the same task/goal for all pairs of context, parent or to use different ones. I suppose that all the pair context, parent that return the same task will have their local contribution summed (otherwise how to you generate a task with several parent?)).
In addition ContinueDecision can probably be called several time in GenerateDecision to to general several tasks/goal for the same pairs of context, parent?
I don't really understand why ComputeLocalMotivation is not done directly in GenerateDecision with the local motivation passed to ContinueDecision so I must be missing something.
You understand right !
when you create a generator you choose the type of context a goal, and create taks or goal for each pair ! or multiple if you want do different tasks.
for the ComputeLocalMotivation we decide to separate the creation of the task to this motivation computation for reason of readability and to separate the task creation and the task motivation computation.
when the two are complicated, we mix two algorithms in one, with the separation, it is more simple to read, the motivation that you see in E.N.F.E.R is in ComputeLocalMotivation
We are working to produce a general documentation about the AI system today or tomorow.
This documention will explain all our main concepts, and we will be here to help when you have specifics questions.
Really looking forward to reading more documentation. Looking over the example code provided, I'm not at all certain where the hooks are for communicating information outward to the player. Are there ways to trigger pop-up communication with arbitrary text (to, for example, add more faction-specific dialogue that can communicate AI state to the player in a diegetic fashion)? I would love to see a section of documentation dedicated to explaining the different tools available for this type of state communication.
So if I understand correctly, if we have several contexts or parents for a decision, we could call ContinueDecision several time in the same call of GetContexts/GetParents. GenerateDecision would them be called several time allowing to return either the same task/goal for all pairs of context, parent or to use different ones. I suppose that all the pair context, parent that return the same task will have their local contribution summed (otherwise how to you generate a task with several parent?)).
In addition ContinueDecision can probably be called several time in GenerateDecision to to general several tasks/goal for the same pairs of context, parent?
I don't really understand why ComputeLocalMotivation is not done directly in GenerateDecision with the local motivation passed to ContinueDecision so I must be missing something.
We are working to produce a general documentation about the AI system today or tomorow.
This documention will explain all our main concepts, and we will be here to help when you have specifics questions.
About your questions:
1) Generators allow to create a decision (a task or a goal), for a a given context and a given parent
In each generator the ContinueDecision allow to pass in the next step of the generator,
in most cases the step are :
* 1st step : GetContexts -> ContinueDecision(AIPlayer, Context) (only in context based generator not in root generator)
* 2nd step : GetParents (call for each contexts) -> ContinueDecision(AIPlayer, Context, Parent)
* 3rd step : GenerateDecision (call for each pair context, parent) -> ContinueDecision(AIPlayer, this.GetGenerationData(Context, Parent, Task)
* 4th step : ComputeLocalMotivation (call for each tuple context, parent, task)
2) The generators are stateless (multithread purpose) , but you can store some informations in the task (or goal) created or you prepare the data before in the strategic data (in strategic jobs).
3) There are not computation quota, but for big computation, we can say that we want to compute data only in start of turn for exemple
in all our IntelligenceJob you can override this method :
If your writing about possible issues with build, you may want to mention that .Net Framework 3.5 should be installed/enabled (although the error messages would be quite clear)
In case people are wondering how to do this, For Win10:
1) Go to Control Panel Then Uninstall a Program
2) Then Select Turn Windows Features on and off (its on the left, See below)
3) Click the .Net Framework 3.5 check box so that it is not blank and press ok (as shown below)
4) If given the option to donwload the files pick it.
5) After a short period of time it should be done.
Stillgar by the sounds of it they will be releasing a Doc sometime soon.
We will make a special documentation about how to use this tool and improve the overall AI modding documentation as soon as we can.
Do you plan to release some API documentation? I started looking at your dll with ilspy and based on the existing AI code can probably work it out myself, but having access to your generated api doc would probably speed things up a lot (I suppose that you document your api right :) ?)
I already have two questions:
* what does this ContinueDecision do?
* should the generator be stateless or can we store some data in there or somewhere? at least cached data (which can be recreated on reload) if not persistent one? and what is the lifecycle of those classes?
* Is there some kind of computation quota, meaning that while ai turn should not be too long but if we have some free time, why not use it so we could adjust the amount of computation we do? Also spreading long term strategic compuation over several turns?
Maybe you could also write down (or do a stream video if faster for you) to present the main concepts (generator, strategy, goal, task, snapshot, generation data...), important classes and how the AI is executed?
I know that any doc or stuff take times and you are already doing a lot to support the mod community which I appreciate, but I am greedy :)? In the mean time, I will watch the enfer stream video again, read the ai debug guide and read the code in the AI dll.
Oh and I forgot to say: Good Work! It really seems like you gave us full control over the AI on top of a very flexible and composable system which is really nice!
What is the expected compatibility between AI Mods?
Now this is written assuming this modding system will work in a similar way to the current one of being able to make changes to existing "things" by overwriting them or add new ones, is this the case?
Is only one AI mod allowed to be enabled at a time? (Like Overhaul mods)
Or can only AI mods that modify different areas be allowed to be simultaneously enabled?
Or is there no hard restrictions on what can be enabled? (Only increased chances of errors & Issues)
The ENFER AI DEBUG TOOLS is partially correct ^^ (some changes have been made since). I will add a more advanced guide in this section of the forum and will improve it with you when problems will be encountered.
Yes! the Shift+F1 menu, the empire switch (hitting numbers on the keyboard) will be activated (alongside ENFER) with --enablemoddingtools so you can have the best environment possible to develop tools.
[This post is originally from the AI Modding closed beta. We have moved it here along with the questions and answers our testers had, just in case you'd like to give it a try too!]
In order to create an AI mod, you need to create an additional C# dll that will be loaded into the AI brain. Here is the information to help you do that.
We currently support two code editors but you can use any editor you want (you can see the build commands in the .vscode/tasks.json file).
Install the development environment
Using Visual Studio
Download and install Visual Studio Community [link].
Download and install Visual Studio Tools for Unity in order to compile your code with assembly settings compatible with Unity [link]
Download it and extract it in the Endless Space 2 community folder, My Documents/Endless Space 2/Community (create this folder if it does not exists).
Configure the mod meta information
All the information about your mod is stored in what we called a runtime module. This data are stored in an XML file in the root of your mod directory (in this example ExampleAI.xml).
You can configure the name, the description, etc ... of your mod.
Add the AI tag to help the player know what your mod modify (available tags are: AI, Art, Buildings, Gameplay, Improvements, MajorFactions, Maps, MinorFactions, Multiplayer, Other, Resources, Technologies, Units).
Then, in the Plugins part, you need to describe what the game needs to load in your mod.
Build the mod
For visual studio users
You can find the visual studio project that allows you to build the AIModSampleProject.dll in the folder Sources/AIModSampleProject.sln.
Open it and click on Build -> Build Solution. The code will be built and the resulting dll will be copied in the `AI` folder.
For visual studio code users
Open the mod root folder (the folder that contains the `.vscode` folder).
Open a c# file (*.cs) in the `Sources/Project` folder. VS Code will automatically found the solution (you can see `Running` and then the Solution name `AISampleModProject.sln` in the bottom right corner).
Then you need to verify that the build task is correctly configured. Open the file `.vscode/tasks.json` and verify the **"command"** property is correct (which should be if you have installed MSBuild in the default repository).
Then you can build the dll using the build task (CTRL + SHIFT + B by default). To run other tasks hit CTRL + SHIFT + P and enter "run task" you can then choose the task you want to run.
Issues you can encounter with build
You may have this error when you try to build the mod:
------ Build started: Project: AIModSampleProject, Configuration: Release Any CPU ------ C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Amplitude.AI.Common". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Amplitude.AI.Core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
This means the references to the AI dlls are not correct. By default it search Endless Space 2 in this folder: C:\Program Files (x86)\Steam\steamapps\common\.
If you have installed Endless Space 2 in another folder, you need to change the dll referencing.
Open AIModSampleProject.csproj with a text editor (it's an XML file).
Look for the dll references (line 35 and 38 for the sample mod).
Change the paths according to your steamApps folder.
Development tools
Now that your mod can be loaded in the game using the modding interface, you want to see if your code is correct.
We have developed a powerfull tool to develop the AI, to be able to access it, you need to launch Endless Space 2 in a special configuration.
To do so, add the --enablemoddingtools launch option in steam:
Right click on Endless Space 2 (in steam) and open the Properties panel.
Click on the Set Launch Options... button.
Enter the --enablemoddingtools option.
When you activate the modding tools you will have access to special development tools in the game but it will decrease the game performance.
Launch a game with your mod activated then open a web browser and enter the following address: http://localhost:4377.
You should see the following interface
Mod example
Here is a mod example where all AIs try to go to war against the first player, keep cold war or better between AIs and try to attack all fleets of the first player: EndlessWar.
You are now able to create an AI mod and access to the debugger to test it.
We will make a special documentation about how to use this tool and improve the overall AI modding documentation as soon as we can.
I've noticed turn times are always quick. Too quick to be sorting through many possible options it seems (ie. looking at future moves like chess AI). Is there a quick code edit I can do to increase the amount of looks the AI will do so it can make more competant decisions? I'm used to Civ and Warhammer games making me wait a full minute. So in large galaxy with max empires I have come to expect that kind of delay and will gladly eat that time to have better AI.
This is as while in Warhammer & Civ AIs take their turns sequentially in ES2 all AIs take their turns simultaneously with the playe r. They often don't take much time at the end of a turn as they already spent the rest of you turn acting.
Thank you Cyrob for answering. I would also like to add that AIs will block the passing of the turn until they have made enough "Decision pass", which if I recall correctly is 4 passes. So you should not be worried about the AIs not having enough time to play really :)
I know this forum seems almost dead at this point but i would like to create new AI for Endless Space 2 – current AI is too weak and passive (even on Endless difficulty it is pathetic). So far I've made some attempts but they all failed, therefore i ask for some quidance:
Question 1:
Is there a way to completly override all trees states(or at least dimplomatic tree - this one is crucial to fixing AI) and create new one from the scratch (remove all previous states in state graph, so we start with clean slate)?
Question 2:
Where we can find API documentation? (it would be nice to see all properties and events we can react to) Do you have any frontend list of methods we can use? Anything, so we dont walk in darkness?
Question3
If there is no way to create new state machine, or there are no way to find an API documentation for modders , then last question:
I would really like to create AI that is truly painfully hard, but it is possible to defeat - if not for this endless Space then prehaps for next Endless Legend/Space(3). Will this be possible or is modding removed from Humankind onward for all of your games(one of your colleagues written that so far there is no modding support prepared for Humankind- which is fine by me - i dont like 4X games that looks like next Sid Meyer's Civilization anyway :P )?
Updated 4 years ago.
Report comment
Why do you report TimeForOptimization?
Are you sure you want to block TimeForOptimization ?
BlockCancel
Are you sure you want to unblock TimeForOptimization ?
VIPCyRob
Sentient Precursor Database in Disguise
I know a little about modding...
VIPCyRob
Sentient Precursor Database in Disguise
92 800g2g ptsReport comment
Why do you report CyRob?
Are you sure you want to block CyRob ?
BlockCancelAre you sure you want to unblock CyRob ?
UnblockCancelDEVzBobiwan
Old Dev
Keep it simple
DEVzBobiwan
Old Dev
27 900g2g ptsReport comment
Why do you report zBobiwan?
Are you sure you want to block zBobiwan ?
BlockCancelAre you sure you want to unblock zBobiwan ?
UnblockCancelStilgar
Newcomer
Stilgar
Newcomer
21 400g2g ptsReport comment
Why do you report Stilgar?
Are you sure you want to block Stilgar ?
BlockCancelAre you sure you want to unblock Stilgar ?
UnblockCancelDEVzBobiwan
Old Dev
Keep it simple
DEVzBobiwan
Old Dev
27 900g2g ptsReport comment
Why do you report zBobiwan?
Are you sure you want to block zBobiwan ?
BlockCancelAre you sure you want to unblock zBobiwan ?
UnblockCancelStilgar
Newcomer
Stilgar
Newcomer
21 400g2g ptsReport comment
Why do you report Stilgar?
Are you sure you want to block Stilgar ?
BlockCancelAre you sure you want to unblock Stilgar ?
UnblockCancelDEVzBobiwan
Old Dev
Keep it simple
DEVzBobiwan
Old Dev
27 900g2g ptsReport comment
Why do you report zBobiwan?
Are you sure you want to block zBobiwan ?
BlockCancelAre you sure you want to unblock zBobiwan ?
UnblockCancelDEVzBobiwan
Old Dev
Keep it simple
DEVzBobiwan
Old Dev
27 900g2g ptsReport comment
Why do you report zBobiwan?
Are you sure you want to block zBobiwan ?
BlockCancelAre you sure you want to unblock zBobiwan ?
UnblockCancelbnspalding
Newcomer
bnspalding
Newcomer
9 900g2g ptsReport comment
Why do you report bnspalding?
Are you sure you want to block bnspalding ?
BlockCancelAre you sure you want to unblock bnspalding ?
UnblockCancelStilgar
Newcomer
Stilgar
Newcomer
21 400g2g ptsReport comment
Why do you report Stilgar?
Are you sure you want to block Stilgar ?
BlockCancelAre you sure you want to unblock Stilgar ?
UnblockCancelDEVzBobiwan
Old Dev
Keep it simple
DEVzBobiwan
Old Dev
27 900g2g ptsReport comment
Why do you report zBobiwan?
Are you sure you want to block zBobiwan ?
BlockCancelAre you sure you want to unblock zBobiwan ?
UnblockCancelVIPCyRob
Sentient Precursor Database in Disguise
I know a little about modding...
VIPCyRob
Sentient Precursor Database in Disguise
92 800g2g ptsReport comment
Why do you report CyRob?
Are you sure you want to block CyRob ?
BlockCancelAre you sure you want to unblock CyRob ?
UnblockCancelStilgar
Newcomer
Stilgar
Newcomer
21 400g2g ptsReport comment
Why do you report Stilgar?
Are you sure you want to block Stilgar ?
BlockCancelAre you sure you want to unblock Stilgar ?
UnblockCancelDEVTichau
Dev Team
Adrien Lead AI Developer
DEVTichau
Dev Team
37 000g2g ptsReport comment
Why do you report Tichau?
Are you sure you want to block Tichau ?
BlockCancelAre you sure you want to unblock Tichau ?
UnblockCancelVIPCyRob
Sentient Precursor Database in Disguise
I know a little about modding...
VIPCyRob
Sentient Precursor Database in Disguise
92 800g2g ptsReport comment
Why do you report CyRob?
Are you sure you want to block CyRob ?
BlockCancelAre you sure you want to unblock CyRob ?
UnblockCancelDEVTichau
Dev Team
Adrien Lead AI Developer
DEVTichau
Dev Team
37 000g2g ptsReport comment
Why do you report Tichau?
Are you sure you want to block Tichau ?
BlockCancelAre you sure you want to unblock Tichau ?
UnblockCancelDEVTichau
Dev Team
Adrien Lead AI Developer
DEVTichau
Dev Team
37 000g2g ptsReport comment
Why do you report Tichau?
Are you sure you want to block Tichau ?
BlockCancelAre you sure you want to unblock Tichau ?
UnblockCancelDEVTichau
Dev Team
Adrien Lead AI Developer
DEVTichau
Dev Team
37 000g2g ptsReport comment
Why do you report Tichau?
Are you sure you want to block Tichau ?
BlockCancelAre you sure you want to unblock Tichau ?
UnblockCancelVIPCyRob
Sentient Precursor Database in Disguise
I know a little about modding...
VIPCyRob
Sentient Precursor Database in Disguise
92 800g2g ptsReport comment
Why do you report CyRob?
Are you sure you want to block CyRob ?
BlockCancelAre you sure you want to unblock CyRob ?
UnblockCancelDEVTichau
Dev Team
Adrien Lead AI Developer
DEVTichau
Dev Team
37 000g2g ptsReport comment
Why do you report Tichau?
Are you sure you want to block Tichau ?
BlockCancelAre you sure you want to unblock Tichau ?
UnblockCancelDEVTichau
Dev Team
Adrien Lead AI Developer
DEVTichau
Dev Team
37 000g2g ptsReport comment
Why do you report Tichau?
Are you sure you want to block Tichau ?
BlockCancelAre you sure you want to unblock Tichau ?
UnblockCanceljpinard
Stellar
Enjoying this weird site.
jpinard
Stellar
21 200g2g ptsReport comment
Why do you report jpinard?
Are you sure you want to block jpinard ?
BlockCancelAre you sure you want to unblock jpinard ?
UnblockCancelVIPCyRob
Sentient Precursor Database in Disguise
I know a little about modding...
VIPCyRob
Sentient Precursor Database in Disguise
92 800g2g ptsReport comment
Why do you report CyRob?
Are you sure you want to block CyRob ?
BlockCancelAre you sure you want to unblock CyRob ?
UnblockCancelDEVChocossimo
Confirmed Dev
Praise the Omnissiah, bless the machine spirits!
DEVChocossimo
Confirmed Dev
38 200g2g ptsReport comment
Why do you report Chocossimo?
Are you sure you want to block Chocossimo ?
BlockCancelAre you sure you want to unblock Chocossimo ?
UnblockCancelTimeForOptimization
Newcomer
TimeForOptimization
Newcomer
1 600g2g ptsReport comment
Why do you report TimeForOptimization?
Are you sure you want to block TimeForOptimization ?
BlockCancelAre you sure you want to unblock TimeForOptimization ?
UnblockCancelMODCaptainCobbs
Solitary Immortal
I will not die, you can't make me
MODCaptainCobbs
Solitary Immortal
76 100g2g ptsReport comment
Why do you report CaptainCobbs?
Are you sure you want to block CaptainCobbs ?
BlockCancelAre you sure you want to unblock CaptainCobbs ?
UnblockCancel