Postęp game

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

Re: Postęp game

Postby Lachu » Thu Jul 20, 2017 12:33 pm

Progress forum is opened, but it probably requires sourceforge.net account.

To get on, click link below:
https://sourceforge.net/p/progress-call ... iscussion/

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

Re: Postęp game

Postby Lachu » Fri Jul 21, 2017 12:34 pm

I decided to implementway to set lua signal as requirement. Each signal could be emitted only one per turn, to avoid problems.

Syntax:

type, value, range
"signal_name(x,y,z)", "", "lua_scirpt"
"min_health", 50, "x"
"max_health", 60, "x"

I don't know, how from Freeciv attach C code to lua_script.

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

Re: Postęp game

Postby Lachu » Fri Jul 21, 2017 4:01 pm

I have found this C function:

Code: Select all

void luascript_signal_callback(struct fc_lua *fcl, const char *signal_name,
                               const char *callback_name, bool create)

callback struct have only name field and I don't know, how to attach custom C function to lua.

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

Re: Postęp game

Postby Lachu » Sun Jul 23, 2017 5:24 pm

I have done problem described in previous post.

I now must asks: how to translate lua type onto type, which can be understood by requirements system? That's biggest problem I now have.

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

Re: Postęp game

Postby Lachu » Thu Jul 27, 2017 6:26 pm

I have done some changes in requirement vector handling. By now two new range are introduced: lua_event and OBJ(x), where X is a name of object given in type of lua_event requirement.

Example could be very simple:
reqs = {
"type", "value", "range:
"city_built(X)", "", "lua_event"
"ExactlyObject", "", "OBJ(X)"
}

As you probably noted, I also created ExactlyObject req type to make job done with OBJ(X) range. ExactlyObject copies each target_ given to requirement handling function, evaluate lua expression given in OBJ, check type to override var of some type, that be returned value from lua expression and check there's no changes. ExactlyObject with lua_event allow us to use effects on particularly object, in response to some event.

In example above we made effects for newly created cities and only for one turn. Maybe in future, I will allow to propagate effects for turn pass event was created, but that's probably very hard work and I'm no man power.

I put a link to movie demonstrating new rule in action:
https://youtu.be/d0bxZEOUujk

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

Re: Postęp game

Postby Lachu » Tue Aug 15, 2017 7:28 am

I introduced diplomacy points. Diplomacy points are used, when accepting diplomacy tready. Each clausule will costs some points for both side. Only Palace provides diplomacy points (10 points).

I also introduces culture type. Diplomacy costs will be increased by difference of each culture type of two nations.

In my opinion, introducing diplomacy points makes game more realistic. In each government type, there's leader, who signs treaty, so there's no way to sign unlimited treaties per turn. In future, technologies like alphabet will decrease diplomacy points cost.

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

Re: Postęp game

Postby Lachu » Tue Nov 07, 2017 8:13 pm

Tomorrow, I will public my work of effects accumulator's for Progress.

Effect accumulator is extension of effect mechanism to allow do new thinks, such like:
- Discovering future tech will gain bonus, mod author could mark how many times user get benefits from discovering future tech
- It could be used in conjunction with eureka system (not implemented yet) to restrict times user get bonus in research to certain technology
- If I implement effects like set city size, there's possibility to set first build city by player larger population than normal (or for built palace in first player's city)
- New way to implement technology like philisophy
-
...
And many, many more.
Below I describe syntax:

Code: Select all

[effect_internal_name]
type = "Type_Of_Effect"
value= the_value
remember_target_player = VALUE(TRUE/FALSE; default false)
remember_target_city = VALUE(TRUE/FALSE; default false)
remember_other_player = VALUE(TRUE/FALSE; default false)
remember_target_city = VALUE(TRUE/FALSE; default false)
remember_target_building = VALUE(TRUE/FALSE; default false)
remember_target_tile = VALUE(TRUE/FALSE; default false)
remember_target_unit = VALUE(TRUE/FALSE; default false)
remember_target_unittype = VALUE(TRUE/FALSE; default false)
remember_target_output = VALUE(TRUE/FALSE; default false)
remember_target_specialist = VALUE(TRUE/FALSE; default false)
remember_target_action = VALUE(TRUE/FALSE; default false)

max_activation_number = VALUE(INT; default 0)
force_minimum_turn = VALUE(INT; default 0)
force_maximum_turn = VALUE(INT; default 0)
effect_vacation = VALUE(INT; default 0)
force_maximum_turn" = VALUE(INT; default 0)
max_turn_activated = VALUE(INT; default 0)
reqs = requirement_list

For example:

Code: Select all

[effect_science_bonus]
type = "Output_Bonus"
value= 2000
remember_target_player = TRUE;
max_turn_activated = 7
reqs =
{
  "type", "name", "range"
  "OutputType", "Science", "Local"
}

We can use above to boost science of each player (remember_target_player is necessary now) by 21%, but only for 7 fist turn. To boost science of each player for 7 turns, when player build first city, we could connect it with my previous changes (events requirements) like bellow:

Code: Select all

[effect_science_bonus]
type = "Output_Bonus"
value= 2000
remember_target_player = TRUE;
max_turn_activated = 7
reqs =
{
  "type", "name", "range"
  "OutputType", "Science", "Local"
  "city_buld(X)", "", "lua_event"
}

And now remember_target_player is necessary, because without it, effect will activate themselves once any player build first city, so if player A build city in turn 1 and player B built city in turn 10, then player B won't get boost bonus.

I think you understood my idea. Presented here effects works with current code. I will polish code responsible for this mechanism tomorrow and probably publish changes.

Aughh.. I'm very sad, because I must use GCC function wrapper for free, but that cost my program can take on themselves.

User avatar
dunnoob
Elite
Posts: 326
Joined: Mon Dec 23, 2013 3:13 am
Location: Hamburg
Contact:

Re: Postęp game

Postby dunnoob » Tue Nov 07, 2017 9:36 pm

Lachu wrote:I think you understood my idea.
Yes, nice, and at some point in time please add one spam link to your progress, because google refuses to tell me anything about progress game or similar.

Remotely related, something with survives is completely wrong from my PoV: Maybe some custom effects (in the direction of custom flags) could enable corresponding custom requirements, with these custom requirements surviving even if their custom effects are not more applicable. Unfinished idea for 3.2 or later. ;)

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

Re: Postęp game

Postby Lachu » Wed Nov 08, 2017 4:33 pm

https://sourceforge.net/projects/progre ... =directory

Below I also inserted link to my channel on the youtube, where I put small number of movies related to progress.
https://www.youtube.com/channel/UCFj5lq ... 3sSEgzRkdw

Flatpaks with newest features aren't prepared yet, but I have put changes into repository.
I must admit, I doesn't test my solution before writing previous post and there's not difference if you put "city_buld(X)", "", "lua_event" on the requirement list - effect always start to been active, when you build yours first city. It makes sense, because, there's no reason to calculate city output, when player haven't any city yet.

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

Re: Postęp game

Postby Lachu » Wed Nov 08, 2017 5:17 pm

In Civilization IV, defense bonus for fortress units is growing during time. We can do similar things with effects accumulators:

Code: Select all

[effect_fortress_hp_regen]
type    = "HP_Regen"
remember_target_unit = TRUE
remember_target_tile = TRUE
value   = 5
reqs    =
    { "type", "name", "range"
      "Extra", "Fortress", "Tile"
      "UnitClass", "Land", "Local"
    }
   
 
[effect_fortress_hp_regen2]
type    = "HP_Regen"
remember_target_unit = TRUE
remember_target_tile = TRUE
value   = 10
accumulation_to_wake = 5
reqs    =
    { "type", "name", "range"
      "Extra", "Fortress", "Tile"
      "UnitClass", "Land", "Local"
    }   
   
  [effect_fortress_hp_regen2]
type    = "HP_Regen"
remember_target_unit = TRUE
remember_target_tile = TRUE
value   = 15
accumulation_to_wake = 10
reqs    =
    { "type", "name", "range"
      "Extra", "Fortress", "Tile"
      "UnitClass", "Land", "Local"
    }   

I use HP_REGEN instead of increasing defense, but I think, that's easy to change.