Need some guidance with a personal mod

Problems and solutions for installing or running FreeOrion, including discussion of bugs if needed before posting a bug report on GitHub. For problems building from source, post in Compile.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
Kassiopeija
Dyson Forest
Posts: 212
Joined: Wed Jul 16, 2014 6:14 pm
Location: Black Forest

Need some guidance with a personal mod

#1 Post by Kassiopeija »

If this is the wrong forum section please move.

Good morning :)

Inspired by a change Dilvish proposed in the other thread I went back to the file and made some other changes, and also discovered other files that seemed to be quite easy to understand what the data is for, and was kinda easy to nerf or boost specific stuff, esp. to make the game more harder for me on my preferred setup.

Then I went on and even created additional techs (see screenie) which, after some trial-and-error and infile searches was also doable, at least there's no more ingame error shown)
however, the AI would need to use this tech as well, I've already located the folder, but I'm not sure if I just go ahead with another experimental phase - it might break other stuff or might not work for the AI and go unnoticed for the player... the AI files also look alot more complicated than the other files... and I'm not a programer at all (all I can do is BASIC)

So I ask directly, is there a safe straightforward way to do this? Which files would have to be modified for this tech, which I obviously consider as a late game tech, that the AI should consider if he is -more or less- in a defensive position, like, loosing planets, not having the best ships, you know... (or, probably the same routines like Defense Network 3 just a handfull of turns later...)
Attachments
Image1.jpg
Image1.jpg (208.37 KiB) Viewed 1968 times

Morlic
AI Contributor
Posts: 296
Joined: Tue Feb 17, 2015 11:54 am

Re: Need some guidance with a personal mod

#2 Post by Morlic »

Usually when "breaking" the AI you would either get error messages in chat and/or no greeting message from the AI players at the start of the game.
You can also check the AI logs for some error messages.

Currently the way the AI researches techs is mostly by following some predefined orders with the option to prioritize certain techs under certain conditions.

The easiest way to change the tech route of the AI is to modify the file (default/)AI/TechsListsAI.py:
You will find several "tech groups" which indicate the research order. You can simply add your tech at an appropriate position. Note that there are alternative routes (e.g. 2a, 2b) for certain stages so you may want to add them to all of these alternative research paths.

If you want to make the research of the tech more situational based, check the file (default/)AI/ResearchAI.py - you will find several example code to "accelerate" certain techs (just search for that keyword in the file). You can try to add similar code for your techs within the generate_research_orders() function.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Kassiopeija
Dyson Forest
Posts: 212
Joined: Wed Jul 16, 2014 6:14 pm
Location: Black Forest

Re: Need some guidance with a personal mod

#3 Post by Kassiopeija »

Great! I'll check this out right immediately!

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Need some guidance with a personal mod

#4 Post by MatGB »

Kassiopeija wrote:discovered other files that seemed to be quite easy to understand what the data is for, and was kinda easy to nerf or boost specific stuff, ... I'm not a programer at all (all I can do is BASIC)
Welcome to my world ;-)

We'll be having you adding stuff to the main game in weeks (seriously, if you want to do simple stuff for trunk, that'd be cool).
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Kassiopeija
Dyson Forest
Posts: 212
Joined: Wed Jul 16, 2014 6:14 pm
Location: Black Forest

Re: Need some guidance with a personal mod

#5 Post by Kassiopeija »

TechsListsAI.py is easy to understand, although I can only guess on what the different routines for selecting different branches are (like, Asteroids present, or no enemy contact etc). But ResearchAI.py is beyond me, there's just too many variables/parameters in there, it is out of question I can touch anything in there.

Adding a tech to an existing pool will do for now, however, I need to understand it in the first place why specific things are the way they are otherwise I can still screw up stuff.

For example, by looking at the tech order (feels like cheating for a gamer....) it became apparent that the AI are coded to use Organic/Robotic/Asteroid initially then some Organic midgame and it seems Solar in the end. That's why I'm blowing them currently easily out of the water with the Gravitating hulls. So my inital thoughts would be to make him have these as well, but that could actually backfire, if the AI is building the Geo-Integration Facility just everywhere like Orbital Drydocks it'll stun his game because that's a 750 prod each.
So the question is, would it be possible to make him build the GIF only once, at his best planet (good pilots, somewhere safe)? Because if that's not the case, using those techs as a player feels more like a cheat or I-win-button (and should then be heavily nerfed or penalized in some way)

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Need some guidance with a personal mod

#6 Post by MatGB »

The AI hasn't, yet, been setup to use the gravity line, bear in mind that until relatively recently they were ludicrously overcosted hulls (the gravitator's base cost is now 60, it was 200) and no one used them, for quite a long time you either used organics, energy or asteroids. Or you died to an AI that did.

The AI does use asteroids, including heavy asteroids, and uses them well. Support for them using Solar hulls properly was only added in this last week, when they've time the AI team are expanding the range of hulls available, and using what you enjoy most is perfectly fine, you're giving useful feedback on it.

But you could give yourself a challenge and use a hull line you consider underpowered, I like winning with organics, there's more of a challenge to it at the moment.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

AndrewW
Juggernaut
Posts: 791
Joined: Mon Feb 04, 2013 10:15 pm

Re: Need some guidance with a personal mod

#7 Post by AndrewW »

MatGB wrote:But you could give yourself a challenge and use a hull line you consider underpowered, I like winning with organics, there's more of a challenge to it at the moment.
I've had a couple of recent games where I just used the organic line. Awhile back I've had games where I've used nothing but the basic organic hull and won...

Morlic
AI Contributor
Posts: 296
Joined: Tue Feb 17, 2015 11:54 am

Re: Need some guidance with a personal mod

#8 Post by Morlic »

Kassiopeija wrote:TechsListsAI.py is easy to understand, although I can only guess on what the different routines for selecting different branches are (like, Asteroids present, or no enemy contact etc). But ResearchAI.py is beyond me, there's just too many variables/parameters in there, it is out of question I can touch anything in there.

Adding a tech to an existing pool will do for now, however, I need to understand it in the first place why specific things are the way they are otherwise I can still screw up stuff.

For example, by looking at the tech order (feels like cheating for a gamer....) it became apparent that the AI are coded to use Organic/Robotic/Asteroid initially then some Organic midgame and it seems Solar in the end. That's why I'm blowing them currently easily out of the water with the Gravitating hulls. So my inital thoughts would be to make him have these as well, but that could actually backfire, if the AI is building the Geo-Integration Facility just everywhere like Orbital Drydocks it'll stun his game because that's a 750 prod each.
So the question is, would it be possible to make him build the GIF only once, at his best planet (good pilots, somewhere safe)? Because if that's not the case, using those techs as a player feels more like a cheat or I-win-button (and should then be heavily nerfed or penalized in some way)
Unfortunately, you are more or less right. When requiring specific buildings, the AI is usually not set up for it correctly yet and that is the reason the techs are not on the research path. In this case, I think the AI does not build the GIF at all.
So it is indeed a little bit more complex than changing tech lines if buildings are involved. For completeness' sake, the relevant part of the code is in ProductionAI.py in the generateProductionOrders() function. Chances are though that you will not find it easier to understand than ResearchAI.

While this will obviously will not be too balanced, you may want to remove the building prerequisite for the hulls (or change to a building the AI already uses) and then add the relevant techs to the tech list. The AI then should have no problems using these hulls as well.

Anyway, ship designs and hulls in particular is a topic we work quite a bit on recently and already made much progress. Expect upcoming support for the gravitational line as well.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Kassiopeija
Dyson Forest
Posts: 212
Joined: Wed Jul 16, 2014 6:14 pm
Location: Black Forest

Re: Need some guidance with a personal mod

#9 Post by Kassiopeija »

Morlic wrote: Unfortunately, you are more or less right. When requiring specific buildings, the AI is usually not set up for it correctly yet and that is the reason the techs are not on the research path. In this case, I think the AI does not build the GIF at all.
So it is indeed a little bit more complex than changing tech lines if buildings are involved. For completeness' sake, the relevant part of the code is in ProductionAI.py in the generateProductionOrders() function. Chances are though that you will not find it easier to understand than ResearchAI.

While this will obviously will not be too balanced, you may want to remove the building prerequisite for the hulls (or change to a building the AI already uses) and then add the relevant techs to the tech list. The AI then should have no problems using these hulls as well.
Before reading this post I had the following idea with the GIF:
I'm gonna tie this building to Planetoids and/or small worlds exclusively (just like Asteroid Processors are bound) - the realism argument for this would be that it would be far easier to construct + launch a ship with such a huge mass when the construction site itself exert only little gravity itself.
From a balancing point of view, such a limitation will prevent the AI from spaming the GIF on all planets. In fact, this might be a good idea for other shipyards as well. Perhaps I'm able to copy the code for the Asteroid Ref Processor in ProductionAI.py and tie it to the GIF with names and referrers changed.
Might still require to decrease the cost of the GIF, too, and perhaps instead increase the base cost of the Self-Gravitating hull instead (as this will not penalize the AI any more than the player).

Before going to bed (yes, I sleep daytimes :) ) I took a short look on the mid-tier Energy hulls, and it seems both of them are also inferior to the Self-Gravitating hull and also more difficult to reach (albeit not by much). Although it depends on the level of structure mods researched.
When sawing that the Fractal Energy hull cannot have a shield equipped I wondered if that could possibly be even be an advantage: Because in many games from midgame on there are alot of cosmic whirlwinds preventing shields to function. Now a player can - more or less - navigate around this, but is this the case with the AI as well?
Is the AI coded to simulate on the outcome of a battle beforeahead and perhaps look for alternate places where his ships can retain their shields (or acquire more strength - perhaps from friendly planetary defenses). Because, if not, then the Fractal hull will be a very good solution to this and going for a good structure mod becomes mandatory (I think the techroute is already set up for this)
Morlic wrote: Anyway, ship designs and hulls in particular is a topic we work quite a bit on recently and already made much progress. Expect upcoming support for the gravitational line as well.
That's great, can't wait to have 0.45. Any place where the upcoming changes are listed?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Need some guidance with a personal mod

#10 Post by Geoff the Medio »

Kassiopeija wrote:Any place where the upcoming changes are listed?
In the Github commit logs, though it's probably not in a format you'll find useful...

https://github.com/freeorion/freeorion/commits/master

Post Reply