Correct the rulesets civ1 and civ2

Do you want to help out with Freeciv development? Then check out this forum.
nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Mon Nov 26, 2018 2:19 pm

In relation to 22d [elsewhere] The city wall defence bonus should be corrected as follows:

Code: Select all

[effect_city_walls]
type    = "Defend_Bonus"
value   = 200
reqs   =
    { "type", "name", "range", "present"
      "Building", "City Walls", "City", TRUE
      "UnitClass", "Land", "Local", TRUE
      "Building", "Great Wall", "Player", FALSE
      "UnitType", "Artillery", "Local", FALSE
    }

[effect_city_walls_1]
type    = "Defend_Bonus"
value   = 200
reqs   =
    { "type", "name", "range", "present"
      "Building", "City Walls", "City", TRUE
      "UnitClass", "Sea", "Local", TRUE
      "Building", "Great Wall", "Player", FALSE
    }


should be replaced by:

Code: Select all

[effect_city_walls]
type    = "Defend_Bonus"
value   = 200
reqs   =
    { "type", "name", "range", "present"
      "Building", "City Walls", "City", TRUE
      "Building", "Great Wall", "Player", FALSE
      "UnitType", "Artillery", "Local", FALSE
      "UnitType", "Bomber", "Local", FALSE
    }


A similarly for the great wall if left uncorrected:

Code: Select all

[effect_great_wall]
type    = "Defend_Bonus"
value   = 200
reqs   =
    { "type", "name", "range", "present"
      "Building", "Great Wall", "Player", TRUE
      "CityTile", "Center", "Local", TRUE
      "UnitType", "Artillery", "Local", FALSE
      "UnitType", "Bomber", "Local", FALSE

    }



The changes load but I have not tested the actual effects mostly because I have not yet been able to get far enough into (any) fc2.6 game.

The Effect "Unit_No_Lose_Pop" is not invoked for the GW so the supplied ruleset is inconsistent.


Concerning the GW - the fc2.5 ruleset has the (almost correct) comment:

; NOTE:
; In Civ1 enemies are forced to offer cease-fire or peace.

There appears to be no current facility to implement this but:
a) caz is obviously thinking about it; and
b) maybe something in LUA may help (any ideas?).

Perhaps something a little more relevant may be the effects "Have_Embassies" and/or "Gain_AI_Love"

nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Mon Dec 03, 2018 12:52 pm

Railroad auto on center. In Civ I you could not even use a settler to build a railroad on a city center tile but that was probably a mistake since you could build one first (and then found the city on it).

Delete the following line

Code: Select all

flags          = "AutoOnCityCenter"
in the rule "[extra_railroad]" (Civ1 terrain.ruleset).

The help text:

Code: Select all

"), _("\
City center tiles with roads are automatically upgraded to railroads\
 when you learn the Railroad technology.\
should be deleted at the same time.

Ignatus
Veteran
Posts: 133
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Correct the rulesets civ1 and civ2

Postby Ignatus » Mon Dec 03, 2018 8:48 pm

Oh, and AI could not use railroads as more than just roads (as well as GOTOed units). This is so sick that I doubt if it woth putting in. (But well, how long ago one have played Civ1 not just out of nostalgie?)

nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Mon Dec 10, 2018 12:53 pm

Ignatus wrote:Oh, and AI could not use railroads as more than just roads (as well as GOTOed units). This is so sick that I doubt if it woth putting in. (But well, how long ago one have played Civ1 not just out of nostalgie?)


It's not just about movement. Railroad in Civ I also affects ALL tile produce. Many features in the civ1 ruleset are about nostalgia. Change to unit names from Civ II back to Civ I for example. Zero effect on gameplay, but nice for the memories.

When it comes to being sick I think fc has 'some room for improvement'. I am currently playing some civ1 games with FoW off and reveal map on (to see what's going on). Easy to clean up entire game by t50 if you can get quick access (same continent or short trireme trip). Worst case is if you need Sail(=caravel) but even then you can reduce the last one or two to just a couple of cities. Stay in despotism. Miscalculation of corruption means the cities you capture produce no trade but you keep up tech by capturing their cities. For some reason they make no attempt to defend (until late in the game) so you can take out 1 or 2 AI's with just a single militia. This doesn't seem to be quite such a problem in other rulesets and I have not yet figured out the difference. But one thing is clear: Civ I was an austere game. You had to work hard to develop your cities. You had to work hard to research techs. Compare that to fc classic where your cities grow fast and the tech tree is over before your coffee is cool enough to drink. This is one reason why I bother. The more I play all the other variants that fc has to offer the more I suffer from nostalgia.

Then of course there is the elephant in the room: small pox. With each cavalry (=horsemen) unit you can take out three (or more!) cities in a row in just one turn. Never happened in Civ I. Cities were almost always nicely spaced. But it's a vexed question. What is optimal AI play? And should they use it, or should they be taught 'to be nice'?

nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Mon Dec 10, 2018 1:14 pm

Road always on city center.

Place (or replace) the following into script.lua in the civ1 ruleset:

Code: Select all

--  nef 2018/12/5

--  This lua script provides the feature in Civilization (Civ I) whereby
--  a city when razed pillages all improvements on the city center tile.
--  This defeats the exploit of getting a free bridge before knowing
--  the bridge building technology.

--  based on city ruins (anon.)
 
function city_destroyed_callback(city, loser, destroyer)
  city.tile:remove_extra("Railroad")
  city.tile:remove_extra("Road")
  city.tile:remove_extra("Irrigation")
  city.tile:remove_extra("Mine")
--  city.tile:create_extra("Ruins", NIL)
  -- continue processing
  return false
end

signal.connect("city_destroyed", "city_destroyed_callback")



I am certain about railroad/ road; confident about irrigation, guessing about mines. Easily defeated if not so. Can someone check to see what happens in Civ II - it may be the same, but in any case I would recommend this for ALL other fc supplied rulesets. At the end of the day many cities (such as London) were built on river CROSSINGS so ALL rulesets should have road ALWAYS on city center.

"if"'s are apparently not needed but if this is (or will not be) the case can someone please advise?

Note for many fc rulesets this part of the script should be 'replace'. An alternative would be to add another call back (with different function name) but it would be easier to just select what you want with comment/uncomment.

Reinstate ruins as you please, but only if the extra is defined in the ruleset.

nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Tue Dec 18, 2018 1:14 pm

Railroad on city center (reprise).

Removing the 'auto on' field does not prevent settlers from adding railroad after the city is founded (or before for that matter). As an alternative to prevent this, one could change the entire reqs vector for railroad in the section [extra_railroad] in terrain.ruleset to read as follows:

Code: Select all

reqs           =
    { "type", "name", "range", "present"
      "Tech", "Railroad", "Player", TRUE
      "Extra", "Road", "Local", TRUE
      "UnitFlag", "Settlers", "Local", TRUE
      "TerrainClass", "Land", "Local", TRUE
     "CityTile", "Center", "Local", FALSE
    }

Unfortunately, due to the marvels of ad hoc back magic hardcode this also removes any pre-existing railroad. So you can have it one way or the other but not exactly how Civ I did it.

This bear of little brain has not yet figured out a way around this (in fc2.6). Perhaps some ingenious use of "survives"? Or more black magic flags?

It may be that Sid M. was trying to prevent railroad from city centers, but that the preexisting case slipped through the cracks.

Ignatus
Veteran
Posts: 133
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Correct the rulesets civ1 and civ2

Postby Ignatus » Tue Dec 18, 2018 2:47 pm

As I understand, we should play here with the action enabler for "Road", not with extra reqs.

nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Mon Dec 31, 2018 6:21 pm

Ignatus wrote:As I understand, we should play here with the action enabler for "Road", not with extra reqs.
Not quite sure what you mean here. I presume something in fc3.0. I'm assuming fc2.6.x - i.e. simple ruleset fixes for fc2.6. More permanent long term changes are another matter. As for fc2.6 I tried thinking - it helped. Not quite ready to publish but the railroad problem is SOLVED. Details next week for a solution that emulates Civ I warts and all.

nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Mon Jan 14, 2019 2:25 pm

For those who want to have the rules for railroad on city center tiles as it is in Civ I.

Add the following two sections to terrain.ruleset

Code: Select all

[extra_no_rr]
name           = _("Roadonly")
category       = "Natural"
causes         = "Base"
graphic        = "None"
graphic_alt    = "-"
activity_gfx   = "None"
act_gfx_alt    = "-"
act_gfx_alt2   = "-"
rmact_gfx      = "None"
rmact_gfx_alt  = "-"
reqs           =
    { "type", "name", "range", "present"
      "Extra", "Railroad", "Local", FALSE
      "CityTile", "Center", "Local", TRUE
    }
; buildable      = FALSE ;  kills autooncitycenter
build_time_factor = 0  ;  nearly useless: AGH has no idea
                       ;  of what an empty list means
hidden_by = "Road"     ; disable this if you want to snoop
flags = "AutoOnCityCenter"  ;  works only if buildable = TRUE
helptext       = _("\
A city center tile can only have a railroad if it is \
already there before the city is built.\
")

[base_no_rr]
extra          = "Roadonly"
gui_type       = "Other"


Next ...

nef
Veteran
Posts: 130
Joined: Mon Jun 25, 2018 5:01 pm

Re: Correct the rulesets civ1 and civ2

Postby nef » Mon Jan 14, 2019 2:28 pm

Change the [extra_railroad] reqs vector to NOW read:

Code: Select all

reqs           =
    { "type",         "name",     "range", "present"
      "Tech",         "Railroad", "Player", TRUE
      "Extra",        "Road",     "Local",  TRUE
      "Extra",        "Roadonly", "Local",  FALSE
      "UnitFlag",     "Settlers", "Local",  TRUE
      "TerrainClass", "Land",     "Local",  TRUE
    }


Remove the "AutoOnCityCenter" flag (from this section) if you have not already done so. Also delete the help text paragraph:

Code: Select all

"), _("\
City center tiles with roads are automatically upgraded to railroads\
 when you learn the Railroad technology.\
Optionally replace it with :

Code: Select all

"), _("\
A railroad cannot be built on a city center tile, but may be there\
 if built first.\


A word of warning. I had to navigate around a bug so as/when it gets fixed some 'adjustments' may be in order. Being able to set "Buildable = FALSE" for the extra "Roadonly" would clean up crap from AGH and the Combat -> Build Base submenu.


If you simply MUST have nice clean menus, set "Buildable = FALSE" and add the following to script.lua:

Code: Select all


--   nef 2019/01/04
-- use this as an example for any other extras
-- that are nobbled by "Buildable = FALSE"
-- (until fixed)

function nonew_railroad(city)
    local   tile = city.tile   
    if not  tile:has_extra ("Railroad")
    then    tile:create_extra("Roadonly", NIL)
    end
    return false
end

signal.connect("city_built", "nonew_railroad")