Postęp game

Various topics about the game, the website, or anything else Freeciv related that doesn't fit elsewhere.
Lachu
Elite
Posts: 301
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Postby Lachu » Sat Apr 21, 2018 7:44 pm

I've ended effects iterators feature today. I will make source code and flatpak packages tomorrow.
First of all I remind you, that Progress is game to play humans against humans, without AI. I'm not an AI expert and I decided to provide changes making writing good AI very expensive. If you be AI expert and will join to Progress team, don't scare - maybe we can find best solution.

What is effects iterators?
Imagine we will replace Great Wall wonder with Walls improvement. So defense of each city depends on how many walls user was built (in each city). So we got:

Code: Select all

[effect_great_wall]
name = "Defense_Bonus1"
value = 10
reqs =
{
"type", "name", "range"
"IterationOfCities", "City", "Player"
"Building", "Walls", "City"
}


Code above will makes Progress sum each city with Walls as defense bonus of each city. If we would like to restrict this to only one player, we could:

Code: Select all

[effect_great_wall]
name = "Defense_Bonus1"
value = 10
reqs =
{
"type", "name", "range"
"IterationOfCities", "City", "Player"
"Building", "Great Wall", "Player"
"Building", "Walls", "City"
}

So only player with Great Walls World Wonder will have this bonus. I didn't test my solution yet. Maybe examples doesn't show this idea helpful, but there will be many use cases in future, like iterating adjacent tiles to find medic unit or to provide bonus in nearby cities if some city have wonder/building. I know this can be probably be done in lua, but I think humans prefer effects iterators syntax.

In future I will add triggers effect type. Triggers will be checked on each turn start and export symbols from effects. This could be also helpful.

Lachu
Elite
Posts: 301
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Postby Lachu » Fri May 25, 2018 6:28 pm

I now try to implement triggers in effects.ruleset. Probably the last part is new requirement type to comparing imported object with range. I will explain. Current implementation of triggers exports each variable gained from iterators, like IterationOfPlayers. Another effect could have import table. Example is showed bellow:

Code: Select all

[effect_masonry_research_1]
remember_target_city = TRUE
force_maximum_turn = 3
type = "Output_Bonus"
value= 100
reqs =
{
  "type", "name", "range"
  "city_built(X)", "", "lua_event"
  "ExactlyObject", "", "OBJ(X)"
  #put there correct solution
}
imports =
{
  "case", "type", "name"
  "mr", "", ""
}

[effect_masonry_activator]
type = "Trigger"
force_maximum_turn = 12
triger_id = "mr"
reqs =
{
  "type", "name", "range"
  "IterationOfPlayers", "A", "Global"
  "Tech", "Masonry", "A"
}

Above example makes each A's city built for 12 turns after researching masonry have output bonus for three turns. There's one feature missing. Comparing between objects. We must be sure player, which is testing is the same trigger was launched.ExactlyObject doesn't makes sense, because it test lua type of expression and change object passed to ruleset calculate function by object from expression. Changed object is the same type expression is. I create three syntax. Choose one or suggest your own.

Code: Select all

"type", "name", "range"
#first option
"Exactly", "ObjA", "ObjB"
#second option
"Equal", "func(ObjA, ObjB)", "Compare"
#third option
"Objects", "Equal(ObjA, ObjB)", "EffectsFunc"

Which one make most sense?