Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 On 09/04/2008, Ulrik Sverdrup wrote: I realize this bug has distinct parts 1. /set startyear 2. MinYear 3. Use Slow_Down_Timeline to effects-ize the calendar The first one is the least intrusive. It seems to me that number 1 without number 2 ( 3) is not providing much value. I would implement this in 2 - 3 - 1 order. I don't like the way Slow_Down_Timeline maps between effect values and hardcoded turn lengths (in years). Would it be much harder to do more generic Turn_Length -effect? Value of this effect would tell current year increment/turn. [effect_calendar_base] name = Turn_Length value = 50 [effect_calendar_slowdown1] name = Turn_Length value = -25 reqs = { type, name, range MinYear, -1000, World } nreqs = { type, name, range MinYear, 0, World Tech, Plastics, World } [effect_calendar_slowdown2] name = Turn_Length value = -30 reqs = { type, name, range MinYear, 0, World } nreqs = { type, name, range Tech, Plastics, World } [effect_calendar_plastics] name = Turn_Length value = -49 reqs = { type, name, range Tech, Plastics, World } It would be possible, using enough reqs and nreqs, to reproduce space tech effects exactly like they currently are. (Note that I'm not saying that those effects are needed - just that it would be possible to implement them in ruleset.) - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 Hello Would it be interesting to update this for the current trunk? If you think the current draft works (mostly) well as designed, it should be fairly easy to get this in, I looked at it yesterday. I realize this bug has distinct parts 1. /set startyear 2. MinYear 3. Use Slow_Down_Timeline to effects-ize the calendar The first one is the least intrusive. Regards Ulrik ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 Here is a small doc and a patch to trunk r13023. It is ready for comment or commit if wanted. On my wishlist is to get the startyear patch into the 2.1 branch Ulrik # Using Effects for the Calendar # For default ruleset and flexibility for mods and the future. ## Change summary ## Add `startyear` server option Add `MinYear` requirement type year greater or equal Add `Slow_Down_Timeline` effect to slow down normal calender the old slow down renamed to `Slow_Down_Timeline_2` Modify `game_next_year` in game.c Update default ruleset and documentation Update cityturn.c and helpdata.c ## Motivation ## Use game.info.turn (int) to drive the game Use game.info.year (int) to drive the story Continuing use of .year We have to use .year in savegames and official representation to make the saves and game behaviour *memoryless*: no replays neccessary for reloading a save or getting back to the same point. Effects `Slow_Down_Timeline` and `Slow_Down_Timeline_2` where `_2` takes precedence and represents the current space module slowdown (only active when spacerace is 1), and the `Slow_Down_Timeline` is (by default) an emulation of the old calendar system, numbering: value yrs/turn 0 50 1 25 2 20 3 10 4 5 5 2 =6 1 _`game.info.year` should be strictly monotonous as a function of .turn_ Also, the quirk that year has to be 0 for the 1 yr/turn to apply has been removed. Requirement type Introducing the `MinYear` requirement type. Range must always be World. Can also be converted to a less than test with negation and combinations yield an equality test. `MinYear` is thought to only operate on the current game clock. It does not support testing for effects at a certain year the future. Anyway, the thought is that a `MinYear` effect is the best when the calendar is changing. Special years make more sense to civlization history than special turns. ## Sideffects and unwanted quirks ## The timeline is now unpredictable, even more so that previously. This should pose no problem theoretically as the space modules code has always been there so code cannot simply use years to look ahead in time with. The new effects code adds the possibility of any kinds of effects that are activated by year ranges. Adding Year as a requirement qualifier means that we commit ourselves to this view of the game, that every turn should have a year assigned and so on. However, this can still (theoretically) be an int between +/-32000, so it is possible to run a game during 3000 to 5000 AD or from 2200 to 500 BC, with deaccelerating timelines. Also, the startyear and the calendar slowdowns go together. With turn configuration, startyear would only be an offset. Now, startyear puts you right there in relation to the timeline; if you start at year 1 AD, the calendar doesn't run at 50 years/turn from there. Some rounding could be needed (and neccessary if we go down from say 6 to 1 or 0), so that 50 yrs/turn will be rounded to nearest 10 years; and 25, 20 and 10 to the nearest 5. This rounding should always be made in the positive direction so no loops can occur. ## Design Desicions ## Use `Slow_Down_Timeline` or `Slow_Down_Timeline_2` for space slowdowns? Using the former s good for legacy. Using the latter is good in that it is a clearer mark that the space slowdown is a quirk. Should rounding be used for year increments? It complicates the code, but is useful in situations where the ruleset wants a non-year triggered timeline change to *more* years per turn. Is `MinYear` a good name? ## Further work ## Futher things that could be worked on * Patches for civ1 and civ2 ruleset coming soon * Incorporate minor changes to 2.1 branch, like `startyear` and/or any renamed effects (like `Slow_Down_Timeline_2`) to * Clean up .year usage, make client only use strings for the date. ## Example ## Make Upkeep extra expensive during [-1000,500) with [ inclusive, exclusive). Works! [effect_example] name= Upkeep_Factor value = 1 reqs= { type, name, range MinYear, -1000, World } nreqs = { type, name, range MinYear, -500, World } ## Calendar effects ## This is how a calendar effects would look, one per speedup [effect_calendar_1] name= Slow_Down_Timeline value = 1 reqs= { type, name, range MinYear, -1000, World } Index: doc/README.effects === --- doc/README.effects (revision 13023) +++ doc/README.effects (arbetskopia) @@ -40,9 +40,9 @@ A requirement type is the type of the requirement and can be one of None (default), Tech, Gov, Building, Special, Terrain, UnitType, -UnitFlag, UnitClass, Nation, OutputType, MinSize, AI and -TerrainClass. MinSize is the minimum size of a city required. AI is ai -player difficulty level.
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 Hello freeciv-dev I have worked on this yesterday and today and I'm mostly done with the first parts. So far I have coded against trunk and written up some documentation for the changes. I'll clean it up and post the work when I have time on thursday. What I have is just using effects to be able to customize the calendar. Converting to only turns will wait until later; as it is currently that would require a replay of the full game to load a savegame and calculate the current year (know when the space module techs were found etc) and such hackery. To avoid that, I'm only doing this relatively minor change. ## Change summary ## Add `startyear` server option Add `YearGte` requirement type year greater or equal Add `Slow_Down_Timeline` effect to slow down normal calender the old slow down renamed to `Slow_Down_Timeline_2` Modify `game_next_year` in game.c Modify default ruleset and documentation ulrik ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 On Sun, 24 Jun 2007, Ulrik Sverdrup wrote: The previous attempt is very well designed and aims at removing game.info.year, and drive everything with turns. Well designed and we should have that as goal. However, this requires porting effort for every client and is more intrusive. My view was to first accept that we have a year-based timeline that can run from a negative start year to a positive end year. We still send the year as an int to the client each turn, etc. This is a more of an internal change in the server, not an API change, and should be easier. That way of fixing just the timeline speedup abstraction could be handled just inside game.c's game_next_year and the rulesets and effects files.* *However I realize that a year-based effect requirement requires some development on effects code and might not even be easy. I just want maintainer okays and design decisions, so that it is known what we want to achieve so we can start implementing it. I am fine with both approaches. Do not worry about leaving clients than gtk2 and SDL broken, and for SDL we have an active client maintainer who I am sure can help out. - Per ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 On Sat, 23 Jun 2007, Ulrik Sverdrup wrote: We need a more flexible calender for rulesets, and with effects I think we have a quite efficient way to do it. There is some work done in this direction already, but probably quite outdated now. Take a look at http://rt.freeciv.org/Ticket/Display.html?id=2912 - Per ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 2007/6/24, Per I. Mathisen [EMAIL PROTECTED]: URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 On Sat, 23 Jun 2007, Ulrik Sverdrup wrote: We need a more flexible calender for rulesets, and with effects I think we have a quite efficient way to do it. There is some work done in this direction already, but probably quite outdated now. Take a look at http://rt.freeciv.org/Ticket/Display.html?id=2912 - Per Thanks I saw it before I sent in my bug email, but #2912 tries to do more general changes and nothing happened, I hoped we could do something about the specific year and timeline speedup issues separately, without so many side effects. I'm looking at the patch from #2912 now and can review it. Do you or anyone know the reason it did not go further? No interest? Ulrik ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 On Sun, 24 Jun 2007, Ulrik Sverdrup wrote: I'm looking at the patch from #2912 now and can review it. Do you or anyone know the reason it did not go further? No interest? More interesting things came up, I believe. - Per ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 2007/6/24, Per I. Mathisen [EMAIL PROTECTED]: URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 On Sun, 24 Jun 2007, Ulrik Sverdrup wrote: I'm looking at the patch from #2912 now and can review it. Do you or anyone know the reason it did not go further? No interest? More interesting things came up, I believe. - Per Regarding this bug and #2912 The previous attempt is very well designed and aims at removing game.info.year, and drive everything with turns. Well designed and we should have that as goal. However, this requires porting effort for every client and is more intrusive. My view was to first accept that we have a year-based timeline that can run from a negative start year to a positive end year. We still send the year as an int to the client each turn, etc. This is a more of an internal change in the server, not an API change, and should be easier. That way of fixing just the timeline speedup abstraction could be handled just inside game.c's game_next_year and the rulesets and effects files.* *However I realize that a year-based effect requirement requires some development on effects code and might not even be easy. I just want maintainer okays and design decisions, so that it is known what we want to achieve so we can start implementing it. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39413) Effects-ize the calender
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 We need a more flexible calender for rulesets, and with effects I think we have a quite efficient way to do it. My idea was that we need a relatively easy way to do this so that it actually happens. 1. Implement 'startyear' server option 2. Modify Slow_Down_Timeline option: Always apply Allow both positive and negative values, the cumulative value counts and should be ignored if negative 4. Add YearGt, YearLt requirement types for effects (year greater than or equal, year less than or equal. Could alternatively be based on turns). 3. Implement all calendar slow down with this effect, and cut out parts where years are hardcoded in the code 4. Make sure client/server communication works and make sure savefiles work. Without this, only the very civlike rulesets and scenarios can have timelines that work for them. The minimal fix would be to provide 'startyear'; then with the help of Slow_Down_Timeline the timeline can be slowed down early in the game (if spacerace is allowed, which it can be without being buildable) For example the ancients modpack would benefit from this, and potentially any modpack ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev