The "gimmick" concept and scripting of it
Posted: Mon May 02, 2022 10:32 pm
I have already written in many places about this concept, some of my patches that are prepared with it in mind are commited to git, but there is some controversy with other developers about details so I put it here for comment.
Different hardcoded rules and tokens of the game have different degree of interconnection with the bulk of other rules and the general conceptions that make Freeciv itself in our eyes. For example, the most general description of the game that seems not to be going to change ever within this project is sth like "playing in a tile-divided world where each tile may contain a stationary, resource-producing city and/or (usually) mobile, acting around units, both controlled by some human or AI player, with resources in general sense arriving and being spent in regular turns..." Some other conceptions (e.g. that citizens work tiles or are specialists, or the six main resource types) are discussable but changing them requires deep modification of both code and game rules. Some rules (e.g. ones of firepower modification, and especially coastal bombardment rule) can be changed in one or few observable patches, their effect on the game still needs good analysis but likely not much of it.
I name "gimmicks" the least fixed things in the game that act in one or two places in the code and might have acted much different in their form without much difference in the game's content if some programmer years ago would glance at another rock group picture on the wall. For example, Internet wonder reveals all cities, why wouldn't it, naturally, reveal cities of all civs having studied Computers to each other? The gimmicks I target specially as a developer are ones defined in effects: "Upgrade_Unit", "Reveal_Map", "Reveal_Cities" etc.
The callbacks I requested in a ticket were by intent placed at the moments when such bonuses arrive. Things random like these should be decided not by one idle mind but by as many as may bother writing a ruleset. An API flexible enough should be given to such ones, and let scripts do the thing in a softcoded way, cuz why to hardcode what is soft by its nature.
Some gimmicks are already softcoded to some extent, notably "Inspire_Partisans" one and hut entering (the former still is bound to a single unit type of the ruleset, and the latter uses special sort of extras but that is justified for the need of a workable explorer advisor). Why full softcoding is not done in v.3.1 even with "Upgrade_Unit" where the API is ready: the effects not only trigger the bonus, they also contribute to AI reasoning and to autohelp generation. My idea was using the effect hardcodedly for those purposes only while the actual bonus is given by a script that may or may not consult the effect value. But among other devs it kinda brought up shrugs and frowns since it's not a honest way of design; indeed it may misguide AI and give wrong help points, and the ruleset author needs much attention and reading lots of (hopefully, not yet written) friendly manuals to catch it. You can follow the links or search on the resources you know to see the other ideas how it should be done.
So, comments are welcome on should we actually unhardcode all the gimmick bonuses and how it should be done for better.
Different hardcoded rules and tokens of the game have different degree of interconnection with the bulk of other rules and the general conceptions that make Freeciv itself in our eyes. For example, the most general description of the game that seems not to be going to change ever within this project is sth like "playing in a tile-divided world where each tile may contain a stationary, resource-producing city and/or (usually) mobile, acting around units, both controlled by some human or AI player, with resources in general sense arriving and being spent in regular turns..." Some other conceptions (e.g. that citizens work tiles or are specialists, or the six main resource types) are discussable but changing them requires deep modification of both code and game rules. Some rules (e.g. ones of firepower modification, and especially coastal bombardment rule) can be changed in one or few observable patches, their effect on the game still needs good analysis but likely not much of it.
I name "gimmicks" the least fixed things in the game that act in one or two places in the code and might have acted much different in their form without much difference in the game's content if some programmer years ago would glance at another rock group picture on the wall. For example, Internet wonder reveals all cities, why wouldn't it, naturally, reveal cities of all civs having studied Computers to each other? The gimmicks I target specially as a developer are ones defined in effects: "Upgrade_Unit", "Reveal_Map", "Reveal_Cities" etc.
The callbacks I requested in a ticket were by intent placed at the moments when such bonuses arrive. Things random like these should be decided not by one idle mind but by as many as may bother writing a ruleset. An API flexible enough should be given to such ones, and let scripts do the thing in a softcoded way, cuz why to hardcode what is soft by its nature.
Some gimmicks are already softcoded to some extent, notably "Inspire_Partisans" one and hut entering (the former still is bound to a single unit type of the ruleset, and the latter uses special sort of extras but that is justified for the need of a workable explorer advisor). Why full softcoding is not done in v.3.1 even with "Upgrade_Unit" where the API is ready: the effects not only trigger the bonus, they also contribute to AI reasoning and to autohelp generation. My idea was using the effect hardcodedly for those purposes only while the actual bonus is given by a script that may or may not consult the effect value. But among other devs it kinda brought up shrugs and frowns since it's not a honest way of design; indeed it may misguide AI and give wrong help points, and the ruleset author needs much attention and reading lots of (hopefully, not yet written) friendly manuals to catch it. You can follow the links or search on the resources you know to see the other ideas how it should be done.
So, comments are welcome on should we actually unhardcode all the gimmick bonuses and how it should be done for better.