Year fragments and the Space Race
Posted: Sun Feb 07, 2021 3:17 pm
So the other day, I was testing a ruleset with an approximately week-based timescale, more specifically 50 year fragments, and one fragment per turn, so 50 turns per year. I was playing against an AI, and since the ruleset is still very rough around the edges (particularly in terms of military stuff), I opted for a space race victory. Built the fastest spaceship (travel time of 7.7 years), launched it, waited seven turns and... realized that it's still the same year, and I'd have to continue for literal hundreds of turns before the spaceship arrives.
Tl;dr: If years take more than a turn, it takes longer for spaceships to arrive, so as the number of year fragments goes up, the viability of spaceship victory goes down.
So then I thought about making a patch to reduce the min value of the spaceship_travel_time server setting. However, looking into the space race code, I realized that wouldn't really help, because everything is year-based. It doesn't matter in what fragment of a year you launch your ship; whether it's the first day or the last day, they're both launched in the same year, so if they have the same travel time, they arrive at the same time.
Also, the fractional travel time (e.g. taking 7.8 rather than 7.7 years) only matters if multiple ships arrive in the same year – spaceship arrivals always happen at the beginning of a year. Yup, that means the spaceship taking exactly 10 years, launched January 1st, 3473 CE, and the spaceship taking 9.99 years, launched December 31st, 3474 CE, both arrive January 1st, 3483 CE (when they should be arriving almost two years apart).
Tl;dr: Space race only cares about years, literally nothing else.
So that's where we are at – the space race code is from before year fragments were a thing; the question is: How do we best go about improving it? That's why I made this forum thread, rather than just opening a ticket.
The simplest possible solution would be to mostly keep the current system, but replace "year" with "turn" everywhere – in the supplied rulesets, this wouldn't make a difference, since by the time spaceships can be built, the timescale has been slowed to a single year per turn. Rulesets that want spaceships to take longer (where a turn represents less than a year) can give higher default values to the spaceship_travel_time server setting. However, rulesets where turns can still take multiple years in the space age (and thus spaceships can be faster), or where changing the timescale while spaceships are in flight is an intended possibility, would suffer from this change.
Tl;dr: We could make the space race work through turns rather than years, which would be simple, but possibly break some people's rulesets.
A more complex, but probably more sensible solution would be to say "one year fragment is equivalent to one year, divided by the number of fragments in a year" and just work with that – adjusting the current space race code to not only store the launch year, but also the launch fragment, and not only compute a year of arrival, but also a fragment of arrival, possibly rolling over into the next year if a spaceship is launched during the latter part of a year.
Tl;dr: We could make the space race consider year fragments, naively assuming that fragments are evenly spaced throughout the year. This would be more work than the previous option.
One could also think about giving the ruleset more control over spaceship stuff – a ruleset-dependent spaceship travel time factor (in addition to the server setting), or maybe more direct control over the mass of different parts, that sort of thing.
On the other hand, a year fragment is not necessarily equivalent to one year divided by the number of fragments; the cyclic nature of year fragments allows ruleset authors to do way more interesting things with them – if I want to have different cycles throughout the course of the game, I might want to organize my year fragments some other way. I might also want different names throughout the course of the game (e.g. earlier in the game, having "winter" and "summer" rather than "January" and "July"), which (at the moment) would necessitate multiple different year fragments with different names that get carefully skipped over through proper Turn_Fragments effects.
And the thing is, apart from the space race, nothing in the game actually cares about time in years/fragments, rather than turns – turn fragments are, at the time of writing, completely up to ruleset authors to do with as they please.
Tl;dr: The naive assumption above may not always be appropriate, so maybe we shouldn't do that.
So, what do we do? We could go with either of the two options above. A third option would be to let ruleset authors decide whether space race works based on years/fragments, or based on turns – though that would be a lot of work to implement, and more prone to errors.
Again, this is why I started a forum thread about this – it's a topic requiring a more complex discussion. So what do y'all think?
Tl;dr: If years take more than a turn, it takes longer for spaceships to arrive, so as the number of year fragments goes up, the viability of spaceship victory goes down.
So then I thought about making a patch to reduce the min value of the spaceship_travel_time server setting. However, looking into the space race code, I realized that wouldn't really help, because everything is year-based. It doesn't matter in what fragment of a year you launch your ship; whether it's the first day or the last day, they're both launched in the same year, so if they have the same travel time, they arrive at the same time.
Also, the fractional travel time (e.g. taking 7.8 rather than 7.7 years) only matters if multiple ships arrive in the same year – spaceship arrivals always happen at the beginning of a year. Yup, that means the spaceship taking exactly 10 years, launched January 1st, 3473 CE, and the spaceship taking 9.99 years, launched December 31st, 3474 CE, both arrive January 1st, 3483 CE (when they should be arriving almost two years apart).
Tl;dr: Space race only cares about years, literally nothing else.
So that's where we are at – the space race code is from before year fragments were a thing; the question is: How do we best go about improving it? That's why I made this forum thread, rather than just opening a ticket.
The simplest possible solution would be to mostly keep the current system, but replace "year" with "turn" everywhere – in the supplied rulesets, this wouldn't make a difference, since by the time spaceships can be built, the timescale has been slowed to a single year per turn. Rulesets that want spaceships to take longer (where a turn represents less than a year) can give higher default values to the spaceship_travel_time server setting. However, rulesets where turns can still take multiple years in the space age (and thus spaceships can be faster), or where changing the timescale while spaceships are in flight is an intended possibility, would suffer from this change.
Tl;dr: We could make the space race work through turns rather than years, which would be simple, but possibly break some people's rulesets.
A more complex, but probably more sensible solution would be to say "one year fragment is equivalent to one year, divided by the number of fragments in a year" and just work with that – adjusting the current space race code to not only store the launch year, but also the launch fragment, and not only compute a year of arrival, but also a fragment of arrival, possibly rolling over into the next year if a spaceship is launched during the latter part of a year.
Tl;dr: We could make the space race consider year fragments, naively assuming that fragments are evenly spaced throughout the year. This would be more work than the previous option.
One could also think about giving the ruleset more control over spaceship stuff – a ruleset-dependent spaceship travel time factor (in addition to the server setting), or maybe more direct control over the mass of different parts, that sort of thing.
On the other hand, a year fragment is not necessarily equivalent to one year divided by the number of fragments; the cyclic nature of year fragments allows ruleset authors to do way more interesting things with them – if I want to have different cycles throughout the course of the game, I might want to organize my year fragments some other way. I might also want different names throughout the course of the game (e.g. earlier in the game, having "winter" and "summer" rather than "January" and "July"), which (at the moment) would necessitate multiple different year fragments with different names that get carefully skipped over through proper Turn_Fragments effects.
And the thing is, apart from the space race, nothing in the game actually cares about time in years/fragments, rather than turns – turn fragments are, at the time of writing, completely up to ruleset authors to do with as they please.
Tl;dr: The naive assumption above may not always be appropriate, so maybe we shouldn't do that.
So, what do we do? We could go with either of the two options above. A third option would be to let ruleset authors decide whether space race works based on years/fragments, or based on turns – though that would be a lot of work to implement, and more prone to errors.
Again, this is why I started a forum thread about this – it's a topic requiring a more complex discussion. So what do y'all think?