Counters, trggers and changes in survive
Posted: Sat Mar 12, 2022 5:18 pm
I developing counters for Freeciv.
Also, I am maintainer of Progress;
In progress, I introduced remember_* field to effects, where asterix is range name, such like player Also, I add to effects field telling how long effect should be activated.
When, many years ago, I told about this features, someone told to implement it to Freeciv. This person have an idea: change survive to contains turn requirement entry will be activate. Either requirement change state from true to false, it will be still activated for survive turns.
I think, survive could been changed to string and could be one of:
Inf/true
8/false
Or natural number.
We must save turn of activation, name/type of re entry and value.
For example:
T122, Tech, Bridge Building
When we check requirement entry is true:
1. Evaluate requirement entry
2. Find similar pair on list
3. If is not true, go to point five
4. Else, update Turn or create list of truth requirement entry and go to next requirement entry. If isEnd
5.Check Turn + Survive is higher than current turn
6. If this true, evaluate as true. End
7. Evaluate to false, remove from list
If survive is inf, can end on point 2, if entry on list exist
Triggers are similar to effects, but event-driven. Also, we must split effect only for effects, only for triggers and for both.
For example:
1. Add to Counter, Set Counter Value and Victory will be triggers
2. OutputBonus will be effect
3. HealUnit will be both
How triggers could work?
Imagine, we need to increase counter Victory Points with type Scenario Hall Of Fame. It have two requirements. When event update_something(REQ_NAME, REQ_VALUE, Unit, Tile, Player, City, .. ) was fired, we find each effect with REQ_NAME and REQ_VALUE in reuirements list. We perform algorithm given above, but when we evaluate each entry in trigger requirement list as true, we call INC_COUNTER_VALUE.
Triggers will have fields:
1. Name/Type
2. Subject
3/ Value
4. Requirement list
Thanks to this mechanism, many actions could be possible, like adding units experience, adding religions, loyalty of cities, etc.
Also, I am maintainer of Progress;
In progress, I introduced remember_* field to effects, where asterix is range name, such like player Also, I add to effects field telling how long effect should be activated.
When, many years ago, I told about this features, someone told to implement it to Freeciv. This person have an idea: change survive to contains turn requirement entry will be activate. Either requirement change state from true to false, it will be still activated for survive turns.
I think, survive could been changed to string and could be one of:
Inf/true
8/false
Or natural number.
We must save turn of activation, name/type of re entry and value.
For example:
T122, Tech, Bridge Building
When we check requirement entry is true:
1. Evaluate requirement entry
2. Find similar pair on list
3. If is not true, go to point five
4. Else, update Turn or create list of truth requirement entry and go to next requirement entry. If isEnd
5.Check Turn + Survive is higher than current turn
6. If this true, evaluate as true. End
7. Evaluate to false, remove from list
If survive is inf, can end on point 2, if entry on list exist
Triggers are similar to effects, but event-driven. Also, we must split effect only for effects, only for triggers and for both.
For example:
1. Add to Counter, Set Counter Value and Victory will be triggers
2. OutputBonus will be effect
3. HealUnit will be both
How triggers could work?
Imagine, we need to increase counter Victory Points with type Scenario Hall Of Fame. It have two requirements. When event update_something(REQ_NAME, REQ_VALUE, Unit, Tile, Player, City, .. ) was fired, we find each effect with REQ_NAME and REQ_VALUE in reuirements list. We perform algorithm given above, but when we evaluate each entry in trigger requirement list as true, we call INC_COUNTER_VALUE.
Triggers will have fields:
1. Name/Type
2. Subject
3/ Value
4. Requirement list
Thanks to this mechanism, many actions could be possible, like adding units experience, adding religions, loyalty of cities, etc.