Condition matching comsats

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderators: Oberlus, Committer

Post Reply
Message
Author
Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Condition matching comsats

#1 Post by Ophiuchus »

For the targetting preference I'm looking for a good FOCS condition to (not) match comsats.
Any Ideas?
Last edited by Ophiuchus on Fri Aug 31, 2018 7:28 am, edited 1 time in total.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

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

Re: Condition matching comsats

#2 Post by Geoff the Medio »

Define "comsats"...

-Has design name "SD_BASE_DECOY"?
-Has hull "SH_COLONY_BASE" and no parts?
-Has any hull and no parts?
-Maybe needs to have an owner (not be monster / independent)?

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Condition matching comsats

#3 Post by Ophiuchus »

The idea is to make SH_COLONY_BASE mostly useless as cannon fodder.

Probably SH_COLONY_BASE and no parts would do. But dont know how to script that.

I dont think that owner matters.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

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

Re: Condition matching comsats

#4 Post by Geoff the Medio »

Ophiuchus wrote: Tue Aug 28, 2018 7:00 pmThe idea is to make SH_COLONY_BASE mostly useless as cannon fodder.
Just that specific hull, or are there other similar ones that could be used instead if it was an overly specific condition?
Probably SH_COLONY_BASE and no parts would do. But dont know how to script that.
Just checking the hull should be relatively simple... something like

Code: Select all

DesignHasHull name = "SH_COLONY_BASE"
Testing how many parts is a bit trickier. There are conditions for checking if a ship's design has a particular part by name or by class, but not for any part. You can get how many parts are in a ship design using something like (not tested)

Code: Select all

PartsInShipDesign design = LocalCandidate.DesignID
which you can also put into a comparison condition like

Code: Select all

(PartsInShipDesign design = LocalCandidate.DesignID < 1)
Multiple conditions can be combined with And [ ... ] or Or [ ... ] conditions.

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Condition matching comsats

#5 Post by Ophiuchus »

Geoff the Medio wrote: Wed Aug 29, 2018 9:30 am
Ophiuchus wrote: Tue Aug 28, 2018 7:00 pmThe idea is to make SH_COLONY_BASE mostly useless as cannon fodder.
Just that specific hull, or are there other similar ones that could be used instead if it was an overly specific condition?
Probably only that hull. The problem is that its so cheap to build that its offsets the balance against military ships. But we cant make it more expensive because of the roles it fullfills (mainly troop drops, also outpost/colony base). I am not aware of other hulls having this problem.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Re: Condition matching comsats

#6 Post by o01eg »

Ophiuchus wrote: Wed Aug 29, 2018 10:45 am
Geoff the Medio wrote: Wed Aug 29, 2018 9:30 am
Ophiuchus wrote: Tue Aug 28, 2018 7:00 pmThe idea is to make SH_COLONY_BASE mostly useless as cannon fodder.
Just that specific hull, or are there other similar ones that could be used instead if it was an overly specific condition?
Probably only that hull. The problem is that its so cheap to build that its offsets the balance against military ships. But we cant make it more expensive because of the roles it fullfills (mainly troop drops, also outpost/colony base). I am not aware of other hulls having this problem.
What about forbid to build hulls without parts and make a "communicator" part for Comsat?
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Condition matching comsats

#7 Post by Dilvish »

Ophiuchus wrote: Wed Aug 29, 2018 10:45 am Probably only that hull. The problem is that its so cheap to build that its offsets the balance against military ships. But we cant make it more expensive because of the roles it fullfills (mainly troop drops, also outpost/colony base). I am not aware of other hulls having this problem.
I am pretty sure we can make it more expensive still, my strong recollection was that the current cost of 3 was considered an intermediate point to try. The colony base hull could still work just fine for outpost bases and colony bases if it were a bit more expensive than now, and I'm not sure we necessarily need to preserve its use for troop drops, not if it's still causing a significant problem for combat ship balance.

I think we could probably increase its cost to 4 without needing to adjust the AI troop drop code, though I should probably look that over a bit more, and then we'd need to pay attention to how it actually worked out.

Keep in mind we also have the compressed energy hull with base cost 5, and small asteroid hull with base cost 6, so for whatever situation you have in mind when you say "I am not aware of other hulls having this problem," might simply shift over to those other hulls if not addressed in a way that includes them.

It sounds pretty clearly like you are thinking the cost increase to three has been insufficient, why don't you make a feedback thread on that issue and clarify just where you are seeing recurring problems.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

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

Re: Condition matching comsats

#8 Post by Morlic »

While it doesn't only affect decoy ships, a more robust approach could be to check if the ship is armed/has fighters... A fuel pod costs 1 PP and would circumvent the no-part approach.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Condition matching comsats

#9 Post by Ophiuchus »

Morlic wrote: Wed Aug 29, 2018 5:24 pm While it doesn't only affect decoy ships, a more robust approach could be to check if the ship is armed/has fighters... A fuel pod costs 1 PP and would circumvent the no-part approach.
Thanks, that reminded me looking at the actual costs

Code: Select all

grep -r 'buildcost.*' default/scripting/ship_* |     sed -e 's|[^/]*/||g' | awk '{printf "%-3s %-50s  %s %s %-4s %s %s %s \n", $4,$1,$2,$3,$4,$5,$6,$7}' | sort -n
Maybe the ShortRange weapons should prefer not to shoot at harmless ships, meaning those Ship without Bombard, ShortRange, FighterBay, or Troops parts (maybe also General parts, because e.g. the krill spawner).

Code: Select all

$ grep -ri "class =" default/scripting/ship_parts/ | awk '{print $4}' | sort | uniq 
Armour
Bombard
Colony
Detection
FighterBay
FighterHangar
Fuel
General
Industry
Research
Shield
ShortRange
Speed
Stealth
Trade
Troops
Last edited by Ophiuchus on Thu Aug 30, 2018 10:30 am, edited 1 time in total.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Condition matching comsats

#10 Post by Ophiuchus »

Dilvish wrote: Wed Aug 29, 2018 3:46 pmIt sounds pretty clearly like you are thinking the cost increase to three has been insufficient, why don't you make a feedback thread on that issue and clarify just where you are seeing recurring problems.
Not really. It's just a feeling left from the discussion and analysis before that. Didnt have time to thoroughly playtest, so I am not sure how much this still is a problem.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Condition matching comsats

#11 Post by Ophiuchus »

What objects are actually matched by the "Armed" condition?
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

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

Re: Condition matching comsats

#12 Post by Geoff the Medio »

Ophiuchus wrote: Fri Aug 31, 2018 7:29 amWhat objects are actually matched by the "Armed" condition?
Following the chain of code bits:
https://github.com/freeorion/freeorion/ ... .cpp#L1797
https://github.com/freeorion/freeorion/ ... p.cpp#L247
https://github.com/freeorion/freeorion/ ... ign.h#L530
https://github.com/freeorion/freeorion/ ... .cpp#L1309

It should match ships whose design has direct weapon parts or fighter bay or hangar parts.

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Condition matching comsats

#13 Post by Ophiuchus »

@geoffthemedio Thanks for the fast help!
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Post Reply