Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Calendars (Re: Re: A bunch of patches)
Home

[Freeciv-Dev] Calendars (Re: Re: A bunch of patches)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Calendars (Re: Re: A bunch of patches)
From: "andi payn" <paynfc@xxxxxxxxxxx>
Date: Tue, 08 Jan 2002 02:15:19 +0000

I went ahead and implemented the calendar code as we discussed, and it
works, but it's ugly in a few places.

The basic problem is that each age can have a different number of
months per year, different days per month, etc. Calendar math becomes
very complicated. Fortunately, we don't do much math other than
incrementing by one turn and comparing two dates. The few places where
we do anything more complicated (e.g., the spacerace) I found ways to
fake it that work.

But I have an alternate solution that I think might be better: Create a base calendar, with months and days and leapyear rules that are constant throughout the game (therefore, date math becomes possible). Then create ages that all use the same calendar. I've included a couple of sample ruleset fragments at the end of this message, but I'll try to explain the system:

Each [month_*] has a "name" and a number of "days." Each [leap_*] has
an "every" that specifies how many years between each (which can be
decimal; for two leapyears every 9 years, use 4.5), an optional
"offset" that specifies where the counting starts (defaults to 0), a
"month" that specifies the name of the affected month, and a number of
"days" (positive or negative) to add to the month.

This leapyear system is pretty simple, and takes care of everything
you'd want. You can even create entire leapmonths (I've made a lunar
calendar, with 13 28-day months, plus 28-day leapmonths that pop up
every so often to keep the year accurate to within one day in 13,200
years) by adding a month with no days, and giving it extra days during
leapyear. See the second fragment.

Ages look the same as in my last patch (but let's call them "age"
instead of "calendar," because it makes much more sense), except that
in addition to turn_years, they can specify turn_months and/or
turn_days. All three default to 0 (but at least one must be present
and nonzero), and years and months can be decimal values.

This allows us to display "3 months/turn" instead of "4 turns/year,"
and it allows us to do almost everything we could before, and
more. The only thing we can't do is call one age's turns "Summer" and
"Autumn" and the next age's turns "January" and "Feburary," but I
don't think that's a big loss.

A new server option lets you decide whether dates are always displayed
in dmy format ("7 Nov 2002"), or whether only the parts relevant to
the current age are displayed (so you'd go -4000, -3500, ..., 1999,
Jan 2000, Apr 2000, ..., Oct 2009, 1 Jan 2010, 8 Jan 2010, ...).

If people out there really want, I can also make the date format
flexible. I like dmy, and at least half the world uses it, but I
know that most of my countrymen are happier with mdy, and a few
countries (and some computer geeks) use ymd.

Personally, I like this design better than the other, but I'll finish
up both versions and upload them in the next couple of days. (It'll take that long because I'm going to pull the current CVS version and rebuild it from scratch against that; while I'm at it, I can name some things in a better way, organize the ruleset stuff better, etc.)

First is calendar-patch-1. This provides the same basic calendar
functionality I uploaded to the FTP server before as calendar-patch-0
(the calendar ages stuff, but no subyear calendars), cleaned up a bit,
and rewritten to work as a framework for either daily calendar system.

Then there's calendar-patch-1-subyear-0. It implements daily calendars
as we discussed last week, on top of calendar-patch-1.

As an alternative, there's calendar-patch-1-daily-0. It implements
daily calendars as I discussed in this message, also on top of
calendar-patch-1. It's incompatible with subyear-0.

I'll upload all of them to the bugtracking system, and people can tell
me which they prefer.

The more I think about this, the more I've begun to question the
entire Civ calendar concept. Accelerating calendars are supposed to
model the accelerating rate of social and technological change, which
is a worthy goal. But there are a few problems.

First of all, troops movements, spaceship travel, and other factors
important to the game don't accelerate exponentially along with
technology. A bomber in the last age can't go any farther than a
bomber two ages earlier, but it only takes 1/5th as long to get there?
That's silly. The spacerace has been forced (both in Civ2 and in
FreeCiv) to make sense, but the way it works is clearly a hack.

Second, exponentially-accelerating calendars should make more stuff
happen in a turn, rather than more turns in the same timespan, because
our capability to control technological and social change doesn't
increase exponentially along with that change.

I don't expect anyone to answer these two issues; I think we just have
to accept that there are limitations to any game's modeling of life
and deal with them. But I wanted to mention them anyway.

Speaking of the spacerace, FreeCiv (and I believe Civ2?) have some
code that forces time to travel at one year per turn once you can
build spaceships. So if you launch a spaceship with a 28.3-year flight
time, the game has 28 turns left (unless someone annihilates
you). With a daily calendar, however, this 28.3 years becomes over
10000 turns! Should we not allow subyear calendars in games where
spacerace is enabled? I'm leaning that way, but I haven't done anything yet as far as implementation.

Now, here are the sample calendar rules to implement Civ2 with three
new subyear ages at the end (fill in the gaps yourself, or wait for
the patch):

[month_january]
name = _("Jan")
days = 31

[month_february]
name = _("Feb")
days = 28

...

[month_december]
name = _("Dec")
days = 31

[leap_four]
every = 4
month = "Feb"
days = 1

[leap_century]
every = 100
month = "Feb"
days = -1

[leap_fourcenturies]
every = 400
month = "Feb"
days = 1

[age_prehistory]
name = _("Prehistory")
first_year = -1000
turn_years = 25

...

[age_modern]
name = _("Modern Age")
first_year = 1900
turn_years = 1

[age_future]
name = _("The Future")
first_year = 2000
turn_months = 3

[age_far_future]
name = _("The Far Future")
first_year = 2010
turn_months = 0.5

[age_horizon]
name = _("The Singularity Horizon")
first_year = 2015
turn_days = 1

Sample calendar rules for a lunar calendar (please forgive my terrible
pseudo-Latin):

[month_unember]
name = _("Unember")
days = 28

[month_diember]
name = _("Diember")
days = 28

...

[month_dodecember]
name = _("Dodecember")
days = 28

[month_tridecember]
name = _("Tridecember")
days = 28

[month_quatridecember]
name = _("Quatridecember")
days = 0

[leap_22]
month = "Quatridecember"
days = 28

[leap_42_22]
months = "Quatridecember"
days = -28


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com



[Prev in Thread] Current Thread [Next in Thread]