Difference between revisions of "Talk:FOCS Scripting Details"

From FreeOrionWiki
Jump to: navigation, search
m (Dilvish moved page Talk:Effects to Talk:FOCS Scripting Details: make page name more accurate (not limited to Effects))
 
(28 intermediate revisions by 9 users not shown)
Line 1: Line 1:
=Drek's notes=
+
=Future Ideas=
 +
==Move To Effect==
  
Geoff's most recent version of the effect's document looks great to me; a good, simple baseline for v.3. 
+
(Self explanitory)
  
If during the design process, it turns out we need some of the stuff from my old document that isn't present in Geoff's (like multiplication for meters or picking a game object from a list to spawn for random events) then it can be added back in when needed.
+
==Purgatory==
  
:-This is meant for v0.3 only... certainly later we can add more effects and conditions and the like, as well as other things we previously discussed, like multiple effects phases and such.
+
Places object into "purgatory" (for lack of better term). Object is removed from game map, and is not accessible or visible or controllable to players. Object's attributes / properties / status is otherwise the same (could retain galaxy map position for convenience). Later, object can be removed from purgatory, and is placed back on galaxy map in exact condition it was when it was removed.  This can be used to represedn "phasing" things out of this universe, or to represent a delay between disappearing at from one place and reappearing somewhere else, such as might be desired for an effects-based movement mechanism, using the "move to" effect.
  
For now, I suggest using Geoff's document.  Everything seems clearly explained.  There's little I would debate present in the document. And it's obvious he put a lot of work into it.
 
  
Important additions to the conditions:
+
=Suggested Changes (Sept. 17/18)=
  
*  For starlane hops and direct distance, distance of 0 means every object within the same system as the parent.
+
==Stacking==
  
* Empire no parameters.  If present, every object in the parent object's empire.
+
Should change stacking to not involve object class.  Stacking number should be the only consideration.  If an two effects could fire on an object and they both have the same stacking number, only one can fire.  How to decide which in cases of conflict isn't clear...  For numerical effects, the larger could apply, but we haven't explicitly outlawed preventing stacking of non-numerical effects (with numericals or non-numericals).
  
:I don't follow what you mean... -Geoff
+
'''drek says:'''Agreed.
  
* Galaxy Every object is tested.
+
'''Ellestar:''' Ok, max is in. But how about a diminishing returns stacking type? Well, maybe it's not really essential.
 +
Also, how events will be stacked? I suppose, we don't want 2 events "revolution" on one planet. Maybe duration should be reset to a maximum. Or, maybe, duration should be added. Also, what to do with events that don't have a duration? Just don't apply second event to the same target?
  
* Region Every object in a given region is tested.
+
==Scope Conditions==
  
:-No "regions" for v0.3.
+
Should remove inclusive / exclusive conditions.  Should say that ideally all conditions could be used in either capacity, but programmers are free to put limits on this if they feel it is necessary / beneficial / easier to do so.  Could suggest not using "expensive" to calculate conditions for inclusion (eg. distance from source).
  
* Self (true or false) the source object itself.  true = the source object is effected regardless of other conditions false = not effected regardless of other conditions.  Usage: for example, there might many effects that only effect the source object.  The only listed condition would be Self=true.  Self counts as a distance condition.
+
'''drek says:''' Not thrilled, but fine, if it'll end that thread.
  
* There must be a test for Focus.  For example, if primaryfocus is farming then fire effect.
+
==Random Parameter Values==
  
(Hrm, going to edit Geoff's thingy to include all of the above stuff.  Pretty much need all of it.)
+
Remove!
  
 +
'''drek says:''' Ok.
  
For empire afflition there was a good idea on the forums to make it like unix file permissions.  There'd be flags for friends, enemies, and self empire--an effect could operate on any or all of the above.  In addition, we need a condition that references a specific empire, for the Homeworld special.  (Human Homeworld only works for the Federation, Klingon Homeworld only works for the Klingon Empire, etc.) 
+
==Turn Processing Order==
  
Effects that can spawn, destroy (or conditions that test) an object or object type should accept a list of objects.
+
*Set all max meters to 0.  Current meter values remain unchanged from previous turn's values.
 +
*Fire all meter altering effects:
 +
**Max meter values are added to to by primarily effects that consistently fire every turn, establishing a consistent max meter value
 +
**Current meter values may be modified by effects as well, but rarely compared to current meter values, and primarily by one-shot effects, rather than effects that consistently fire every turn, as this would cause the current meter value to grow very much each turn.
 +
*Apply current meter growth formula (not based on effects)
 +
*Cap current meters by max meter values as applicable
 +
*Fire all non-meter-altering effects
 +
*Do rest of turn
  
A CreateRandomObject would be cool as a sister to CreateObject.  (for events).  For example, an effect might be a 1% chance of creating an event each turn, chosen from a list.
+
Note that meter altering effects fire before ship movement, or anything else, so ship move orders given in turn N do not affect meter values in turn N+1, but do affect meter values in turn N+2.
  
Er, another thing.  Eventually, it would be cool to have the option to base "Chance" off of a meter value, for spawning events.  For example, a high happiness might reduce the chance of a government effect spawning a random riot.
+
In future there may be seveal times during a turn when a non-meter-altering effect can fire.  This will occur before, after and between thing like ship movement, production/popgrowth/research and combatEffects-altering meters will always happen at the very start of a turn, however, before anything else, effects or otherwise.
  
Don't know if it's useful or not yet, but was thinking that any numeric value (for example, for an effect operating on a ship's hitpoints or a planet's meter) should accept dice notation.  (2d6+2= two six sided dice plus 2)
+
'''drek says:''' Seems ok.
 +
 
 +
Ellestar: IMHO a check if a planet is blockaded should go before an effects phase and before ship movement phase. That way, ships that arrived in a previous turn will blockade a planet by applying an effect on a planet.
 +
 
 +
Geoff:  No blockading in v0.3, as far as I know.
 +
 
 +
==Technology as Game Object?==
 +
 
 +
When a technology is researched / gained, it might be implimented as a game-created 0 duration game object that has effects which unlock other classes of game object for the player.  A separate infinite-duration game object could simultaneously be created to give persistant benefits of the technology as well. Alternatively, a persistant actor labelled as a special could be attached to an empire, bestowing some benefits.
 +
 
 +
Technology could also not be treated as a game object at all, but rather as a special internal system unrelated to game objects, and having a separate content description scheme.  Presumably it would be easier, efficient and faster to use the same system as much as possible though.  In practice, construction of game objects like "buildings" through non-effects based planet production is probably quite similar to researching a technology treated as a game object through non-effects based research.
 +
 
 +
'''Drek says:'''  my guess is tzlaine would not be pleased to see either of these paragraphs in design doc.  Let's just be silent on the issue of how tech is implemented.  Doesn't matter if it's a pair of objects, a single object, or a flag in a list.
 +
 
 +
 
 +
==Effect Group Activation Conditions==
 +
 
 +
Need to add a variety of conditions, similar to scope conditions, but dependent on properties of the source object (and dependencies via hierarchy), and which determine whether the effects group is "on" for a given turn.  Should include conditions for:
 +
*properties of owner empire / presence of special attached to owner empire (for empire-wide special resources perhaps)
 +
*focus setting
 +
*stockpiles
 +
*co-located with object of type/class/category
 +
*within X distance/jumps
 +
 
 +
Actually... most of the scope conditions should be usable, though there'll be a few extras that only apply to source objects
 +
 
 +
Maintainance fees (or resource requirements and consumption while active) would also be nice to have as an acitvation condtion, as would some sort of player controlled turning on / off.  How to do this is a bit unclear however, since effects fire at the very start of a turn, before the game would have a chance to deduct maintainance fees (or collect taxes with which to pay them).  We could perhaps determine if fees will / can be paid before firing effects, or we could have have things deactivate at the end of a turn if their maintainance is unpaid, rather than deactivating the effect during the turn when the shortfall would occur.
 +
 
 +
Any effect group that includes an effect that modifies meter(s) cannot use meter value as an activation condition.  As such, it seems that it will be necessary to not have meter values as an activation condition for effects groups.
 +
 
 +
'''Drek says:''' sounds great.  co-located and distance can possibly be combined into a single condition
 +
 
 +
'''Ellestar:''' Why there is no *random (restricted only for events that don't modify meters) and *meter value activation condition? We need both for random events, and it's better to have *meter value activation condition for buildings (check for a last turn meter value).
 +
 
 +
==Side Note: Effect Group Exclusivity==
 +
 
 +
Should perhaps say that effect groups may only have effects that alter meters or that do not alter meters, not a mix...
 +
 
 +
'''Drek says:''' not important.  Game can simply store effects for firing later in turn processing.
 +
 
 +
'''Ellestar:''' That's why i said that you'll need to store effects to run them in a later priority stages. A system with effects that can create other effects (or effect groups in your document) is more flexible.
 +
 
 +
Geoff:  No priority stages in v0.3, other than meter-altering and not-meter-altering.
 +
 
 +
'''Ellestar:''' And  you need it to have effects of one effect group in a different priority stages (like meter-altering and not-meter-altering) so not to have this restriction.
 +
 
 +
==Non-Effects Game Object Info==
 +
 
 +
Yoghurt was going to work up some stuff about coding objects in Python... don't know what's happening with that...
 +
 
 +
Game object descriptions will need some non effects info.  For v0.3, this could be:
 +
*Buildings require a prerequisite tech, a cost per turn, a construction time in turns, a name, and all the effects stuff.
 +
*"Specials" can be randomly assigned at the start of the game to planets. They require just a name and a list of effects.
 +
*Planets, ships, systems, empires, etc. all are treated effectively like they are in v0.2, except that they can be in the scope of an effect and have a few properties that can be modified by effects. 
 +
 
 +
There is no player ship desgin in v0.3, so ships could be coded as a temporary class of scripted object (object class = MarkIV or somesuch).  In future, presumably the ship design component will make internally self-scripted object classes (or something similar), which ship game objects will use as their object class.
 +
 
 +
For v0.3, only buildings and specials can have effects (?), which are encoded in Python XML.  This might be extended to include technologies, if programmers are so inclined.
 +
 
 +
'''Drek says:''' Doesn't matter if it's expressed in Python, XML, comma seprated text fields, or punchcards.  (XML, btw, is a completely different animal from Python)  Should probably remove all references to XML, simply call them "content files" or something like that.
 +
 
 +
I'd leave out mention of specials until they are slated by Aq.  We need to chat with him on when they are to be added to the document.
 +
 
 +
Buildings can have multiple prerequests, including technology, planet specials (I know, contradicting myself in the span a two lines), and most importantly planet focus.  That buildings can have a planet focus prerequisite was the subject an an early public review, one of Aq's pet ideas.
 +
 
 +
* Technologies: require a prerequisite tech, a cost per turn, a research time in turns, a name, and all the effects stuff.
 +
 
 +
==Unlocking?==
 +
 
 +
Techs or specials or whatever that "unlock" things for empires to build (or research?) could work either of two ways:
 +
*The "unlocked" status of an object could be stored as part of the empire or the object itself, and be persistant.  The "unlock" effect would only need to fire once, and the object is unlocks would stay unlocked until relocked by some other effect
 +
*The "unlocking" effect needs to fire every turn, and a persistant object needs to exist to hold and fire the effect.
 +
 
 +
I'm inclined to suggest the first option.
 +
 
 +
'''Drek says:''' Agreed, the first.
 +
 
 +
==Some Explanitory Text?==
 +
 
 +
Each effects group is a list of one or more effects. There can be more than one effects group in a game object, so the object description has "effects groups". The first quoted statement was a point in a list of things in an object description, one of which was the effects groups that the object contains. Similarly, the effects part of an effects group is a list of the classes and parameters for the effects in the effects group.
 +
 
 +
==New Scope Condition?==
 +
 
 +
Something along the lines of "has meter of type X" might be helpful, though this could probably be implimented automatically by the "set meter value" effect, which would only work on objects with the specified type of meter.
 +
 
 +
'''Drek says:''' I don't see the need.  Can happen, as you suggest, automatically.  If a condition or effect references a non-existant meter, it fails. 
 +
 
 +
'''Ellestar:''' And, as i said, you don't need "All objects" scope condition because "All objects" don't have all meters, can't be targets of any non-metered effect etc. It should be "All valid objects" because of the same reason. If an object is not need, there is no need to add it in the first place, and a program can decide that a program don't need this object type in a list of scope objects. My thoughts about that are scattered in 3-4 posts in 1-2 page of the discussion. Conditions that check object type should only further reduce a list of avaliable objects, "All valid objects" should be a default scope condition.
 +
 
 +
==List of fired and unfired effects==
 +
 
 +
It will helpful to have the game player client maintain a list (aka "ledger") of effects that are expected to fire or expected to not fire on object while the player is giving orders.  Based on the current orders, the game will predict meter values for all meters for the next turn.  If the player alters an order which changes the prediction, it's desirable to have an immediately accessible list of effects that could fire on the object.  This is better / faster than having to iterate through all effects in the game every time a player changes an order that could cause a scope condition to change a particular effect form firing or not firing on a particular object or set of objects.
 +
 
 +
(For effect activation conditions, it's only necessary to check the effects of the object whose orders were changed.  Any effects it has that are turned on or off as a result of the order change can be reapplied or unapplied to all relevant game objects)
 +
 
 +
'''Drek says:''' Yes, for each meter, and perhaps the stockpiles as well.  Beyond the use you described above, the list would be available for player to read via a method to be determined by the UI team.  (for example, a tooltip hovering over a meter meter might detail the effects that acted on the meter.)  For this reason, each effect needs a name and possibly a description.
 +
 
 +
==Multiplication Factors?==
 +
 
 +
Current there are no "modify meter multiplier" effects, which IMO is as it should be, but if we want one, we should specify how they'd work (so that ordering of additive and multiplicative bonuses doesn't matter).
 +
 
 +
"Multiplication should be stored separately from meter value, so if you start with a meter of 5, and a multiplicatin of 1, then make the multiplier 2, then add 5 to the meter, you end up with a meter of 10 and a multiplier of 2... ie. the multiplier is multiplied by the meter value only at the exact moment you evaluate the total meter value. Adding to a meter after adding to a multiplier only changes the root meter value, which is unaffected by changing the multiplier value."
 +
 
 +
'''Drek says:''' Sounds like a convoluted way of describing a simple concept.
 +
 
 +
Each max and current meter has a multipler.  At the start of turn processing, all multipliers are set to a value of 1.  (suchandsuchEffect) adds to these multipliersAt stage (whatever) the multipliers attached to max meters are multiplied with each max meter.  At stage (whatever) the multipliers attached to current meters are multiplied with each current meter.
 +
 
 +
hrm, what I just wrote probably reads like crap.  nevermind.
 +
 
 +
'''Ellestar:''' Is it a good idea to use multiplications? Now, maximum value of a meter is capped at 100, and we have a +15 bonus only from focus. Now, if we have one multiplication of *2, then a bonus of +35 can already give a maximum value.
 +
I thought about divisions to make a more strong penalties. If a planet have +60 health, then a penalty of -10 for the lack of food doesn't look really significant. Now, if we're using a penalty "after calculating a meter value, reduce a health meter by -10 or -30%, whatever is more), then it will be more important.
 +
 
 +
Geoff:  There are no multiplication effects in v0.3.  If we did though, multiplications could be on the order of 1.05 or 1.20, rather than 2 or 5.  Division can be represented by multipliers of less than 1.
 +
 
 +
==Do we need to show the previous turn's meter values?==
 +
 
 +
drek: "Maybe not on the sidebar, but it should be somewhere.
 +
 
 +
Otherwise, how can the player review the effects of events that only last a single turn?"
 +
 
 +
Geoff: "This probably needs to be dealt with on a case-by-case basis as well... I imagine most single-turn events would have sitrep notes though, or be something that the player knew about the turn before, so were already incorporated into the client UI's prediction of the relevant meter values during the previous turn (eg. in the case of ships which only modify a meter for one turn due to moving or somesuch)."
 +
 
 +
'''Drek says:''' I'm thinking of single turn events, like Earthquakes or whatever.  Or events with unpredictable durations, like Riots.  Doesn't hurt things to have last turn's values listed -somewhere-.
 +
 
 +
'''Ellestar:''' Hmm. If you're calculating meters first, then random events (and everything else too) will be generated at a later stage (besides, in examples on forums a lot of them take meter values as parameters, so they should be either generated later than meter-altering effects or take values from a previous turn). So, if random events will be generated at a later stages, then a player will see a report about an event from a server, but an event will have an effect on a meters only at the start of the next turn, and that can be predicted by a client.
 +
But, of course, player should see last turn values. That way, he'll be able to see progress by comparing last turn values and predicted values.
 +
 
 +
Geoff:  In future, it might be good to have an "Object Age" or "Universe Age / Year" activation condition, as well as a way to turn on/off visibility of an object to a player using effects.  Thus an event could be made one turn, but stay invisible, then appear the next turn and be visible and have meter-altering effects on the same turn it becomes visible.
 +
 
 +
That said, for now we could make on object that is a "potential event" with a chance activation condition on an effect group that has effects that do whatever the event is supposed to do.  Programmers could make the event visible to the player (or post a sitrep) only if the relevant effects group is active in a given turn.
 +
 
 +
==Explain Intention of Effects Groups==
 +
 
 +
drek: Possibly rewrite the effect groups blurb to make it more obvious what the intention is. (grouping a bunch of effects together so that conditions only need to be calculated once)
 +
 
 +
Mockup for fake XML as reference (shouldn't be in actual design, probly):
 +
 
 +
ObjectClass WonderFarm {
 +
    Category = Building
 +
    Cost = 5
 +
    Buildtime = 10
 +
    PrereqTech = WonderFarming
 +
    EffectGroup {
 +
        Effect {
 +
            EffectClass = ModifyMeter
 +
            Meter = Farming
 +
            Amount = 5
 +
        }
 +
        Effect {
 +
            EffectClass = ModifyStockpile
 +
            Resource = Food
 +
            Amount = 113
 +
        }
 +
        ScopeCondition {
 +
            ConditionClass = ObjectType
 +
            ObjectType = Planets
 +
        }
 +
    }
 +
    EffectGroup {}
 +
}
 +
'''Drek says:''' This looks like scripting code (like Python).
 +
 
 +
XML is HTML, cept you get to make up the tags.
 +
 
 +
<object type=Building name=Wonderfarm cost=5>  <prereq> pretech=WonderFarming prewhatever=blah </prereq> <EffectGroup> <Conditions> condition blah blah </conditions> <effects> blah blah blah </effects> </EffectGroup> </object>
 +
 
 +
I wouldn't worry about this.  The programmers will come up with something, then someone (probably me, you, or the guy who coded it) will document the format.  It's the sort of thing that's debated on the programming list; if your interested in this sort of thing, might want ask tzlaine to sign you up for that list.
 +
 
 +
Thanks for dealing with this.  I lost patience with it weeks ago.
 +
 
 +
heh.
 +
 
 +
= Clarification or link needed =
 +
 
 +
In many of the topics there is a note about name and description:
 +
<pre>"The note about Special name and description text also applies to xxx"</pre>
 +
 
 +
I do not see any specific notes for these.  If one is added, or already exists, a link to the note may be helpful.

Latest revision as of 00:14, 25 September 2017

Future Ideas

Move To Effect

(Self explanitory)

Purgatory

Places object into "purgatory" (for lack of better term). Object is removed from game map, and is not accessible or visible or controllable to players. Object's attributes / properties / status is otherwise the same (could retain galaxy map position for convenience). Later, object can be removed from purgatory, and is placed back on galaxy map in exact condition it was when it was removed. This can be used to represedn "phasing" things out of this universe, or to represent a delay between disappearing at from one place and reappearing somewhere else, such as might be desired for an effects-based movement mechanism, using the "move to" effect.


Suggested Changes (Sept. 17/18)

Stacking

Should change stacking to not involve object class. Stacking number should be the only consideration. If an two effects could fire on an object and they both have the same stacking number, only one can fire. How to decide which in cases of conflict isn't clear... For numerical effects, the larger could apply, but we haven't explicitly outlawed preventing stacking of non-numerical effects (with numericals or non-numericals).

drek says:Agreed.

Ellestar: Ok, max is in. But how about a diminishing returns stacking type? Well, maybe it's not really essential. Also, how events will be stacked? I suppose, we don't want 2 events "revolution" on one planet. Maybe duration should be reset to a maximum. Or, maybe, duration should be added. Also, what to do with events that don't have a duration? Just don't apply second event to the same target?

Scope Conditions

Should remove inclusive / exclusive conditions. Should say that ideally all conditions could be used in either capacity, but programmers are free to put limits on this if they feel it is necessary / beneficial / easier to do so. Could suggest not using "expensive" to calculate conditions for inclusion (eg. distance from source).

drek says: Not thrilled, but fine, if it'll end that thread.

Random Parameter Values

Remove!

drek says: Ok.

Turn Processing Order

  • Set all max meters to 0. Current meter values remain unchanged from previous turn's values.
  • Fire all meter altering effects:
    • Max meter values are added to to by primarily effects that consistently fire every turn, establishing a consistent max meter value
    • Current meter values may be modified by effects as well, but rarely compared to current meter values, and primarily by one-shot effects, rather than effects that consistently fire every turn, as this would cause the current meter value to grow very much each turn.
  • Apply current meter growth formula (not based on effects)
  • Cap current meters by max meter values as applicable
  • Fire all non-meter-altering effects
  • Do rest of turn

Note that meter altering effects fire before ship movement, or anything else, so ship move orders given in turn N do not affect meter values in turn N+1, but do affect meter values in turn N+2.

In future there may be seveal times during a turn when a non-meter-altering effect can fire. This will occur before, after and between thing like ship movement, production/popgrowth/research and combat. Effects-altering meters will always happen at the very start of a turn, however, before anything else, effects or otherwise.

drek says: Seems ok.

Ellestar: IMHO a check if a planet is blockaded should go before an effects phase and before ship movement phase. That way, ships that arrived in a previous turn will blockade a planet by applying an effect on a planet.

Geoff: No blockading in v0.3, as far as I know.

Technology as Game Object?

When a technology is researched / gained, it might be implimented as a game-created 0 duration game object that has effects which unlock other classes of game object for the player. A separate infinite-duration game object could simultaneously be created to give persistant benefits of the technology as well. Alternatively, a persistant actor labelled as a special could be attached to an empire, bestowing some benefits.

Technology could also not be treated as a game object at all, but rather as a special internal system unrelated to game objects, and having a separate content description scheme. Presumably it would be easier, efficient and faster to use the same system as much as possible though. In practice, construction of game objects like "buildings" through non-effects based planet production is probably quite similar to researching a technology treated as a game object through non-effects based research.

Drek says: my guess is tzlaine would not be pleased to see either of these paragraphs in design doc. Let's just be silent on the issue of how tech is implemented. Doesn't matter if it's a pair of objects, a single object, or a flag in a list.


Effect Group Activation Conditions

Need to add a variety of conditions, similar to scope conditions, but dependent on properties of the source object (and dependencies via hierarchy), and which determine whether the effects group is "on" for a given turn. Should include conditions for:

  • properties of owner empire / presence of special attached to owner empire (for empire-wide special resources perhaps)
  • focus setting
  • stockpiles
  • co-located with object of type/class/category
  • within X distance/jumps

Actually... most of the scope conditions should be usable, though there'll be a few extras that only apply to source objects

Maintainance fees (or resource requirements and consumption while active) would also be nice to have as an acitvation condtion, as would some sort of player controlled turning on / off. How to do this is a bit unclear however, since effects fire at the very start of a turn, before the game would have a chance to deduct maintainance fees (or collect taxes with which to pay them). We could perhaps determine if fees will / can be paid before firing effects, or we could have have things deactivate at the end of a turn if their maintainance is unpaid, rather than deactivating the effect during the turn when the shortfall would occur.

Any effect group that includes an effect that modifies meter(s) cannot use meter value as an activation condition. As such, it seems that it will be necessary to not have meter values as an activation condition for effects groups.

Drek says: sounds great. co-located and distance can possibly be combined into a single condition

Ellestar: Why there is no *random (restricted only for events that don't modify meters) and *meter value activation condition? We need both for random events, and it's better to have *meter value activation condition for buildings (check for a last turn meter value).

Side Note: Effect Group Exclusivity

Should perhaps say that effect groups may only have effects that alter meters or that do not alter meters, not a mix...

Drek says: not important. Game can simply store effects for firing later in turn processing.

Ellestar: That's why i said that you'll need to store effects to run them in a later priority stages. A system with effects that can create other effects (or effect groups in your document) is more flexible.

Geoff: No priority stages in v0.3, other than meter-altering and not-meter-altering.

Ellestar: And you need it to have effects of one effect group in a different priority stages (like meter-altering and not-meter-altering) so not to have this restriction.

Non-Effects Game Object Info

Yoghurt was going to work up some stuff about coding objects in Python... don't know what's happening with that...

Game object descriptions will need some non effects info. For v0.3, this could be:

  • Buildings require a prerequisite tech, a cost per turn, a construction time in turns, a name, and all the effects stuff.
  • "Specials" can be randomly assigned at the start of the game to planets. They require just a name and a list of effects.
  • Planets, ships, systems, empires, etc. all are treated effectively like they are in v0.2, except that they can be in the scope of an effect and have a few properties that can be modified by effects.

There is no player ship desgin in v0.3, so ships could be coded as a temporary class of scripted object (object class = MarkIV or somesuch). In future, presumably the ship design component will make internally self-scripted object classes (or something similar), which ship game objects will use as their object class.

For v0.3, only buildings and specials can have effects (?), which are encoded in Python XML. This might be extended to include technologies, if programmers are so inclined.

Drek says: Doesn't matter if it's expressed in Python, XML, comma seprated text fields, or punchcards. (XML, btw, is a completely different animal from Python) Should probably remove all references to XML, simply call them "content files" or something like that.

I'd leave out mention of specials until they are slated by Aq. We need to chat with him on when they are to be added to the document.

Buildings can have multiple prerequests, including technology, planet specials (I know, contradicting myself in the span a two lines), and most importantly planet focus. That buildings can have a planet focus prerequisite was the subject an an early public review, one of Aq's pet ideas.

  • Technologies: require a prerequisite tech, a cost per turn, a research time in turns, a name, and all the effects stuff.

Unlocking?

Techs or specials or whatever that "unlock" things for empires to build (or research?) could work either of two ways:

  • The "unlocked" status of an object could be stored as part of the empire or the object itself, and be persistant. The "unlock" effect would only need to fire once, and the object is unlocks would stay unlocked until relocked by some other effect
  • The "unlocking" effect needs to fire every turn, and a persistant object needs to exist to hold and fire the effect.

I'm inclined to suggest the first option.

Drek says: Agreed, the first.

Some Explanitory Text?

Each effects group is a list of one or more effects. There can be more than one effects group in a game object, so the object description has "effects groups". The first quoted statement was a point in a list of things in an object description, one of which was the effects groups that the object contains. Similarly, the effects part of an effects group is a list of the classes and parameters for the effects in the effects group.

New Scope Condition?

Something along the lines of "has meter of type X" might be helpful, though this could probably be implimented automatically by the "set meter value" effect, which would only work on objects with the specified type of meter.

Drek says: I don't see the need. Can happen, as you suggest, automatically. If a condition or effect references a non-existant meter, it fails.

Ellestar: And, as i said, you don't need "All objects" scope condition because "All objects" don't have all meters, can't be targets of any non-metered effect etc. It should be "All valid objects" because of the same reason. If an object is not need, there is no need to add it in the first place, and a program can decide that a program don't need this object type in a list of scope objects. My thoughts about that are scattered in 3-4 posts in 1-2 page of the discussion. Conditions that check object type should only further reduce a list of avaliable objects, "All valid objects" should be a default scope condition.

List of fired and unfired effects

It will helpful to have the game player client maintain a list (aka "ledger") of effects that are expected to fire or expected to not fire on object while the player is giving orders. Based on the current orders, the game will predict meter values for all meters for the next turn. If the player alters an order which changes the prediction, it's desirable to have an immediately accessible list of effects that could fire on the object. This is better / faster than having to iterate through all effects in the game every time a player changes an order that could cause a scope condition to change a particular effect form firing or not firing on a particular object or set of objects.

(For effect activation conditions, it's only necessary to check the effects of the object whose orders were changed. Any effects it has that are turned on or off as a result of the order change can be reapplied or unapplied to all relevant game objects)

Drek says: Yes, for each meter, and perhaps the stockpiles as well. Beyond the use you described above, the list would be available for player to read via a method to be determined by the UI team. (for example, a tooltip hovering over a meter meter might detail the effects that acted on the meter.) For this reason, each effect needs a name and possibly a description.

Multiplication Factors?

Current there are no "modify meter multiplier" effects, which IMO is as it should be, but if we want one, we should specify how they'd work (so that ordering of additive and multiplicative bonuses doesn't matter).

"Multiplication should be stored separately from meter value, so if you start with a meter of 5, and a multiplicatin of 1, then make the multiplier 2, then add 5 to the meter, you end up with a meter of 10 and a multiplier of 2... ie. the multiplier is multiplied by the meter value only at the exact moment you evaluate the total meter value. Adding to a meter after adding to a multiplier only changes the root meter value, which is unaffected by changing the multiplier value."

Drek says: Sounds like a convoluted way of describing a simple concept.

Each max and current meter has a multipler. At the start of turn processing, all multipliers are set to a value of 1. (suchandsuchEffect) adds to these multipliers. At stage (whatever) the multipliers attached to max meters are multiplied with each max meter. At stage (whatever) the multipliers attached to current meters are multiplied with each current meter.

hrm, what I just wrote probably reads like crap. nevermind.

Ellestar: Is it a good idea to use multiplications? Now, maximum value of a meter is capped at 100, and we have a +15 bonus only from focus. Now, if we have one multiplication of *2, then a bonus of +35 can already give a maximum value. I thought about divisions to make a more strong penalties. If a planet have +60 health, then a penalty of -10 for the lack of food doesn't look really significant. Now, if we're using a penalty "after calculating a meter value, reduce a health meter by -10 or -30%, whatever is more), then it will be more important.

Geoff: There are no multiplication effects in v0.3. If we did though, multiplications could be on the order of 1.05 or 1.20, rather than 2 or 5. Division can be represented by multipliers of less than 1.

Do we need to show the previous turn's meter values?

drek: "Maybe not on the sidebar, but it should be somewhere.

Otherwise, how can the player review the effects of events that only last a single turn?"

Geoff: "This probably needs to be dealt with on a case-by-case basis as well... I imagine most single-turn events would have sitrep notes though, or be something that the player knew about the turn before, so were already incorporated into the client UI's prediction of the relevant meter values during the previous turn (eg. in the case of ships which only modify a meter for one turn due to moving or somesuch)."

Drek says: I'm thinking of single turn events, like Earthquakes or whatever. Or events with unpredictable durations, like Riots. Doesn't hurt things to have last turn's values listed -somewhere-.

Ellestar: Hmm. If you're calculating meters first, then random events (and everything else too) will be generated at a later stage (besides, in examples on forums a lot of them take meter values as parameters, so they should be either generated later than meter-altering effects or take values from a previous turn). So, if random events will be generated at a later stages, then a player will see a report about an event from a server, but an event will have an effect on a meters only at the start of the next turn, and that can be predicted by a client. But, of course, player should see last turn values. That way, he'll be able to see progress by comparing last turn values and predicted values.

Geoff: In future, it might be good to have an "Object Age" or "Universe Age / Year" activation condition, as well as a way to turn on/off visibility of an object to a player using effects. Thus an event could be made one turn, but stay invisible, then appear the next turn and be visible and have meter-altering effects on the same turn it becomes visible.

That said, for now we could make on object that is a "potential event" with a chance activation condition on an effect group that has effects that do whatever the event is supposed to do. Programmers could make the event visible to the player (or post a sitrep) only if the relevant effects group is active in a given turn.

Explain Intention of Effects Groups

drek: Possibly rewrite the effect groups blurb to make it more obvious what the intention is. (grouping a bunch of effects together so that conditions only need to be calculated once)

Mockup for fake XML as reference (shouldn't be in actual design, probly):

ObjectClass WonderFarm {
    Category = Building
    Cost = 5
    Buildtime = 10
    PrereqTech = WonderFarming
    EffectGroup {
        Effect {
            EffectClass = ModifyMeter
            Meter = Farming
            Amount = 5
        }
        Effect {
            EffectClass = ModifyStockpile
            Resource = Food
            Amount = 113
        }
        ScopeCondition {
            ConditionClass = ObjectType
            ObjectType = Planets
        }
    }
    EffectGroup {}
}

Drek says: This looks like scripting code (like Python).

XML is HTML, cept you get to make up the tags.

<object type=Building name=Wonderfarm cost=5> <prereq> pretech=WonderFarming prewhatever=blah </prereq> <EffectGroup> <Conditions> condition blah blah </conditions> <effects> blah blah blah </effects> </EffectGroup> </object>

I wouldn't worry about this. The programmers will come up with something, then someone (probably me, you, or the guy who coded it) will document the format. It's the sort of thing that's debated on the programming list; if your interested in this sort of thing, might want ask tzlaine to sign you up for that list.

Thanks for dealing with this. I lost patience with it weeks ago.

heh.

Clarification or link needed

In many of the topics there is a note about name and description:

"The note about Special name and description text also applies to xxx"

I do not see any specific notes for these. If one is added, or already exists, a link to the note may be helpful.