FANDOM


Forums: Index > Development > Some tiny issues

Hello,
I recently downloaded Freeciv 2.5.5 and 2.5.6 source and read partially, I feel small "perhaps...", so I posted here. Sorry for my bad English.

No.1 to 12 issue uses Freeciv 2.5.6 gtk2.

No. 1:
Terrain bonus of last one digit is round downed. (e.g. 25% -> 20%)

According to common\combat.c get_defense_power:

if (uclass_has_flag(unit_class(punit), UCF_TERRAIN_DEFENSE)) {
db = 10 + tile_terrain(ptile)->defense_bonus / 10;
power = (power * db) / 10;
}

since all variables is int, so terrain bonus of last one digit is round down, so ignored. (e.g. civ2civ3 forest 25% terrain bonus is actually 20%)

I tried Freeciv 2.5.6 gtk+2 with -d 3 option and see internal combat attack/defense strength when combat occur, and round downed. (civ2civ3 green phalanx internal defense strength in forest is 24, not 25)

Following functions have defense bonus / 10 relations:
server\advisors\advgoto.c adv_danger_at
server\advisors\advgoto.c chance_killed_at
common\combat.c get_defense_power
common\combat.c get_virtual_defense_power
ai\default\aisettler.c defense_bonus
ai\default\aiunit.c dai_consider_tile_dangerous
(ai\default\aiparatrooper.c find_best_tile_to_paradrop_to) <- it is AI value weighting for paradropping to target tile, so there is no relation

-> GNA#25432 (fixed in S2_6+), HRM#682494 (doc rounding; fixed in S2_5)

No. 2:
When you lose Future Tech (such as tech upkeep) and tech cost style is 0, next technology cost stay remain.

e.g. in civ2civ3, Future Tech 2 requires 5340 bulbs and if you lose Future Tech 1, you even need 5340 bulbs to regain Future Tech 1. (not 5280 bulbs)
(server\techtools.c update_bulbs)

it seems if someone lose Future Tech, research->techs_researched is not decrement so this is happen.

-> GNA#25433 (not marked fixed before Gna closed)

(Jul 25, 2017 added)
It seems No. 2 does not happen in Freeciv 2.6.0 beta0 c3114c64a6.

No. 3:
When techlevel is greater than number of all technology, Future Tech cost is increased, but you don't get any Future tech. (human player only)

e.g. in civ2civ3, techlevel 87 (ruleset modified to ignore first philosophy discover bonus) and Future Tech 1 requires 5280 bulbs, but techlevel 100, you need 6060 bulbs to discover Future Tech 1.
(maybe server\techtools.c found_new_tech)

AI can to get initial Future Tech. I confused why they can and human player can't.

-> GNA#25434 (not marked fixed before Gna closed)

(Jul 25, 2017 added)
It seems No. 3 does not happen in Freeciv 2.6.0 beta0 c3114c64a6.

No. 4:
When evaluate tech upkeep, Future Tech cost is heavier than its research cost.

(common\tech.c player_tech_upkeep)

current: (base_tech_cost) * (f * (2 * t + f + 1) + 2 * t) / 2
I think: (base_tech_cost) * (f * (2 * t - f - 1)) / 2
f is number of discovered Future Tech, t is number of discovered tech (include "None" and Future Tech).
Also, total_research_factor is
current: EFT_TECH_COST_FACTOR + (2.5 for novice AI, 1 for other)
I think: EFT_TECH_COST_FACTOR * (2.5 for novice AI, 1 for other) and later tech_upkeep /= members is not needed.

memo:
Future Tech cost is number of discovered tech * (base_tech_cost) * EFT_TECH_COST_FACTOR
e.g. in civ2civ3, Future Tech 1 costs 20 * 88(87 techs + "None") * 3(effects.ruleset Tech_Cost_Factor) = 5280 bulbs needed.
Future Tech 2 costs 20 * 89(87 techs + "None" + 1 future tech) * 3(effects.ruleset Tech_Cost_Factor) = 5340 bulbs needed.

-> GNA#25435 (not marked fixed before Gna closed)

No. 5:
When you discover Future tech, odd number of future tech add 2 number of techs and score 4 points, even number add 3 number of techs and score 6 points.

(server\score.c calc_civ_score)

-> GNA#25436 (not marked fixed before Gna closed)

No. 6:
When game was finished, population in score tab is 1000 * population level...number of citizens.

(server\report.c get_real_pop)
In game, population is sum of triangle number of each city's population level and attach "0" for (pop_report_zeroes) times.
(common\game.c civ_population)
I googled and this is wrote in following URL:
http://freeciv-dev.freeciv.narkive.com/HBDX61O9/pr-8908-endgame-numbers

I think * 1000 multiplication in score tab is not needed.

-> GNA#25437 (not marked fixed before Gna closed)

No. 7 (Dec 10, 2016 added):
When diplomat/spy try to bribe enemy units, and enemy unit has some damage, bribe cost is halved regardless amount of damage.

(common\unit.c unit_bribe_cost)

-> GNA#25438 (not marked fixed before Gna closed), then HRM#763896 (fixed in S2_6+)

No. 8 (Dec 23, 2016 added):
When spy try to steal tech or sabotage city improvements and target is specified,
both source comments says "Twice as difficult if target is specified",
but steal tech requires check at diplchance twice(with first time stealing at target city), sabotage city improvement requires check at diplchance / 2 once after infiltrate check.
(server\diplomats.c diplomat_get_tech diplomat_sabotage)
Sabotage city improvement's "/ 2" modifier is made since revision 9000. (Issued as http://bugs.freeciv.org/Ticket/Display.html?id=11058 but now inaccessible.)
it is ok?

-> GNA#25439 (not marked fixed before Gna closed)

No. 9 (Dec 23, 2016 added):
I edited experimentally civ2civ3 ruleset to move_fragments = 60, igter_cost = 20, road movement cost is 20, railroad movement cost is 10 and all unit class's min_speed = 0, and seen 12 AI players + 0 human player game.
And sometimes freeciv-server.exe is downed.
I tried -d 3 option and was not logged fatal or error log (unless "Did not find a cm solution in 25000 iterations" likes).
If all unit class's min_speed is 1 or above, this is not happened.

(Jan 3, 2017 added)
I removed -1 movement in mountains effect, and this problem seems not happened.
Maybe division by zero problems?
(ai\default\aiunit.c look_for_charge, server\unittools.c transform_unit and both uses unit_move_rate with division)

No. 10 (Jan 5, 2017 added):
Off-by-one things.
I viewed 2.5.6 source and found it maybe fc_rand and operator related boundary value tiny issues.

I think following operator in if statements is not ">" but ">=":
server\barbarian.c
dai_manage_unit
if (unit_can_be_retired(punit) && fc_rand(100) > 90) {

It is 2.5.6, but recently I found 2.6 source and seems this is moved to server\srv_main.c and fixed by GNA#22776.

try_summon_barbarians
if ((int)fc_rand(UPRISE_CIV_MORE) >
(int)city_list_size(victim->cities) -
UPRISE_CIV_SIZE/(game.server.barbarianrate-1)
|| fc_rand(100) > get_player_bonus(victim, EFT_CIVIL_WAR_CHANCE)) {

server\generator\mapgen.c
add_resources
if (is_resource_close (ptile) || fc_rand (1000) > prob) {

fair_map_make_resources
|| fc_rand (1000) > map.server.riches) {

The two above -> HRM#763879 (fixed in S2_5+)

fill_island
if (fc_rand(total_weight) > ptersel->weight) {

and make_relief, make_polar, make_polar_land, place_terrain contains fc_rand(10) > xxx things,
but I am not confident this is boundary value things.

I think following operator in if statements is not "<=" but "<":
server\cityturn.c
check_pollution
if (pcity->pollution != 0 && fc_rand(100) <= pcity->pollution) {

-> HRM#763881

server\srv_main.c
update_environmental_upset
if (fc_rand((map_num_tiles() + 19) / 20) <= *accum) {

-> HRM#763882 (fixed in S2_5+)


No. 11 (Feb 21, 2017 added):

When to create history report, LARGEST Civilizations report is never created.
(server\report.c make_history_report)
it seems mod operation uses HISTORIAN_LAST( = HISTORIAN_LARGEST) so this is happen.

-> HRM#763883 (fixed in S2_5+)


No. 12 (Feb 21, 2017 added):

When to create HAPPIEST Civilizations report, angry citizens is not take into account.
(server\report.c historian_generic)

-> HRM#763884


No. 13 (Feb 28, 2017 added):
In Freeciv 2.6.0 beta r34796, when player gets unique=false achievement first, bonus culture added twice.
e.g. in civ2civ3, if you are first player to found foreign continent, you get 200 culture. (instead of 100)
Sorry if this is not a bug. (it seems fastest achievement bonus!)

(common\achievements.c achievement_plr)

-> HRM#763885

No. 14 (Jul 25, 2017 added):
In Freeciv 2.5.7 and 2.6.0 beta0 c3114c64a6 (both uses GTK+2 client),
When you lost Future Tech due to tech upkeep, you get tech cost of researching Future Tech * techlossrestore % bulbs.
e.g. if you researching Future Tech 2, and lost Future Tech 1,
you get Future Tech 2 cost * techlossrestore % bulbs.
(server\techtools.c update_bulbs)

-> HRM#763888

No. 15 (Jul 27, 2017 added):
In Freeciv 2.6.0 beta0 c3114c64a6, if you entered hut with NoCities flag terrain (e.g. civ2civ3's Mountains), and hut bonus is city or settler, you gain 25 gold instead of Settlers even if ruleset defines CitiesStartUnit role unit.
(data\default\default.lua _deflua_hut_get_city)
I think this code:
local settlers = find.role_unit_type('Cities', owner)
should be:
local settlers = find.role_unit_type('CitiesStartUnit', owner)
No. 15 affects only Freeciv 2.6 or after version.

-> HRM#763890 (resolved with a different solution in S2_6+)


No. 16 (Sep 15, 2017 added):
In Freeciv 2.6.0 beta0 29c84a15cb gtk2, unit goto indicates one less turn to move target tile (and also unit info in info panel).
e.g. if Workers will move 3 grassland continuously with Goto, Freeciv 2.5.9 indicates "Turns to target: 3", but Freeciv 2.6.0 indicates "Turns to target: 2".

-> HRM#763893



No. 17 (Apr 9, 2018 added):
In Freeciv 2.6.0 beta2, if ruleset defines more than 128 units, and any unit try to upgrade to 129th or after defined units, these unit can not upgrade ("Obsolete by: None" displayed in help).

No. 18 (Apr 9, 2018 added):
In Freeciv 2.6.0 beta2, if ruleset defines more than 128 units, and any unit try to convert to 129th or after defined units, these unit can not convert (also convert information not displayed in help).
(I think SINT8 type "obsoleted_by" and "converted_to" variables from common/networking/packets.def is probably related.)

No. 17 and 18 -> HRM#763894 (fixed in S2_5+)


Sorry for tiny things, but I wanted to tell.

Best regards,


These should be reported as separate ticket to http://gna.org/bugs/?func=additem&group=freeciv --Cazfi (talk) 21:52, January 7, 2017 (UTC)
----------------
(Jan 11, 2017 added)
Thanks, I tried to post to Gna before post here, and "You are not logged in" message appeared (oh I lost text once here, I only imagined Attach File action needs login), so I searched where can post with no registration and posted here.
I've now created tickets for first 8 of these. --Cazfi (talk) 20:53, January 12, 2017 (UTC)
----------------
(Jan 17, 2017) Thank you for creating tickets!
Community content is available under CC-BY-SA unless otherwise noted.