Postęp game

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

Re: Postęp game

Post by Lachu »

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: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

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?
User avatar
vodot
Veteran
Posts: 81
Joined: Thu May 17, 2018 4:54 pm

Re: Postęp game

Post by vodot »

I'm not a software writer, Lachu, so some of this is going over my head, but I really like the capabilities you're describing!
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

I have uploaded newest version of Progress today.

It introduces experimental and basic support for restrictions.
Currently only multiplier restrictions are supported, but I will expand it to new mechanism in future.

Restrictions are definition of correct values. Multipliers restrictions should restrict children of restriction, like multiplier or other restriction. In fact, I split start/stop/step/etc. fields from multipliers and move it into restrictions.

Possibilities are many for multipliers, but even bigger for rest of Progress mechanism, like battle. Of course, currently we support only multipliers.

For example, progress1 ruleset contains tax rates restrictions and multipliers. Yes - I removed tax rates code from game and move it into restrictions.

I must reminder, that Progress don't allow to play with AI, so I can introduce new features quicker.
Now I need testers for restrictions mechanism. I didn't test many thinks yet, so the mechanism is experimental. I didn't test requirements for restrictions for example. There's many bugs also. Test, if you can, please.
https://sourceforge.net/projects/progre ... 0Linux%29/

Currently we have only 6 restrictions in progress1 ruleset: tax, science, luxury, military, propaganda, all_tax. First five restrict some multiplier to bound between 0 and 10. all_tax restricts previous five to value from 10 to 10.
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

I decided to add new start position mode. I cannot find code to check start position mode - for example: one player per continent, each player on the same continent, etc.
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

I have trouble with implementing new action - take order. Take order will be a special action for great person (especially for great politician). Great Politician could take order to become a great leader, so civilization get special bonuses depending on great leader, who rule this civilization. There can be only one great leader for one civilization. One think is great leader skills. On each turn, freeciv-server will calculate global ranging and depending on our score, our great leader will get skill points (science, economy, military). We can associate effects with skill points, by using special multipliers. I also plan to develop small and big legacy bonuses using actions accumulators.

I think whole C code I wrote to support this functionality are good (there really small piece of code). I could missing only ruleset dependent part, so I put here parts of progress1 ruleset.

Code: Select all

# units.ruleset
[control]
; Names for custom unit type flags. There can be up to 45 of these.
; name          = rule name; In some circumstances user may see this
;                 as part of some sentences, so try to make it descriptive
;                 and sensible.
; helptxt       = displayed in the help for unit types with this flag (optional)
 flags =
   { "name", "helptxt"
     _("Cities")
     _("Workers")
     _("Politican")
     }
 ...
 [unit_me]
name = "Sławomir Lach"
placement = "residental"
class = "Generic"
great_type = "politican"
tech_req      = "None"
obsolete_by   = "None"
graphic       = "u.warriors"
graphic_alt   = "-"
sound_move    = "m_warriors"
sound_move_alt = "m_generic"
sound_fight   = "f_warriors"
sound_fight_alt = "f_generic"
build_cost    = 0
pop_cost      = 0
attack        = 0
defense       = 1
hitpoints     = 10
firepower     = 1
move_rate     = 1
vision_radius_sq = 2
transport_cap = 0
fuel          = 0
uk_happy      = 0
uk_shield     = 0
uk_food       = 0
uk_gold       = 0
flags         = "NoBuild", "Politican"
roles         = ""
helptext      = _("\
This great person will make FLOSS rule the world!\
")
And action enabler in game.ruleset

Code: Select all

[actionenabler_take_order]
action = "Take order"
actor_reqs =
{ "type",   "name", "range", "present"
  "DiplRel", "Foreign", "Local", FALSE
  "UnitFlag", "Politican", "Local", TRUE
}
After I click goto and > take order and selecting unit tile, there error complaining unit cannot do the action - no reason are given.
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

I have problem with packets.def file. I would like to add connection pointer to handle_server_join_response function, but nothing works. I also tried to use no_handle and add function signature (operation) and implementation by myself, but freeciv always add signature.
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

On the sourceforge.net repository is version supporting leaders. Currently only one leader unit is defined - Lach Sławomir, so first civilization reached 10 great leader points in one of it's city will receive great leader.

Great Leader have one action, called take order. Once this action is selected, previously selected great leader for us civilization will be executed (or similar) and the new take order. You must only remember, that great leader will learn new skill, when leading your country. This skills is distributed to some domains - military skill points, economics skill points, science skill points. On each turn, civilizations are sorted dependent on power in some aspects, like military, economy, science and our leader will receive skill bonus based on position in list.

So you shouldn't change leader too often, because your's civilization can lost significant bonus. Currently no other leader effects are implemented, but in future I will make leader will make area in some distance from leader to better prosperity. I will also add small leader bonus, which will be multiplied by number of turns leader lead and big bonuses, also multiplied by number of turns leader lead. Difference between small and big bonus is big bonus will be lost, when we change leader. What would be this bonuses? Each leader will have special bonus - Joseph Stalin will increase military production (both in small and big bonus), Jadwiga will increase science, etc.
I must only add support by leadingBy requirement, but another part of big/small bonus could be achieved by effects accumulators.
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

I added isLeadingBy requirement. This requirement checks given unit is leading our nation. Progress1 ruleset use this requirement to create small and big legacy bonus for Sławomir Lach leader. To test it, built palace, wait for Sławomir Lach born, take order with Sławomir Lach, set science tax policy to 10, wait for Bill from micro circuit born, take order by Bill from micro circuit. In each step, watch science points your civilization produced.

I'm waiting for your proposition about historical leader and effect of leading civilization.

Try download newest flatpak bundle from https://sourceforge.net/projects/progre ... k/download and test it. Currently I have detected one bug - sometimes game crash, when some civilization get technology by event (like tech paradise).
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Postęp game

Post by Lachu »

I have partially done counters. Counters will be concept similar to multipliers (mod creator could use it like multipliers), but aims to be set by game engine, especially by effects calculating mechanism. On each turn start, game recalculates each counter. I have idea how to omit problem with equation loop (for example A = B + 1 and B = A - 2). That's will be tricky and don't give result you expected as normal math, but given notation doesn't allow to calculate A and B as single value too.

The main problem is to append requirement such like Player's smile points is greater than requires Player's smile points to activate an golden era. I don't know which syntax use. Maybe separate list, like:

Code: Select all

reqs = {
; some normal reqs here
} 
formula = {
 Player:A > Player:B,
 Player:A < Const:50
}
Or add requirement like:

Code: Select all

"Above", "(A, B)", "Player"
"Bellow", "(A,50)", "Player"
Post Reply