Year fragments and the Space Race

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
User avatar
Caedo
Elite
Posts: 512
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Year fragments and the Space Race

Postby Caedo » 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?
~ A.V. L.

Ignatus
Elite
Posts: 490
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Year fragments and the Space Race

Postby Ignatus » Sun Feb 07, 2021 4:11 pm

I think assuming that year fragments are even would improve the thing to an appropriate level. We can't currently change the fragments' pace during the game and probably don't want it in any observable time. In fact, we could do more in the game based on years (e.g. make planted forest grow in specific number of years, or like in Civ3 double a building culture output after 5000 years).

User avatar
Caedo
Elite
Posts: 512
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: Year fragments and the Space Race

Postby Caedo » Thu Feb 25, 2021 11:36 pm

I just noticed there's a two-and-a-half-year-old ticket by JTN on this topic that I hadn't noticed when starting this thread – the same issue I brought up above regarding the assumption that all year fragments are of uniform length is mentioned there as well.

Now, one thing we could do is give ruleset authors the option to tell us the relative lengths of their turn fragments, the same way they tell us the names of their turn fragments. With the floating-point-year approach JTN outlined in the ticket (rather than the integer-based approach I was about to start implementing), this likely wouldn't even be too complicated.

To be fair, in most cases, if ruleset authors want non-uniform length, they could do so by padding out the year fragment list with additional entries that always get skipped. The only case where that wouldn't work is if some fragments are supposed to not represent any time at all – for instance, in my example above about having just seasons in the early game, and then later splitting those into multiple months, you might want to have separate turn fragments with names "winter", "summer" etc. so you can display that, but in the endgame, you wouldn't want an announcement that says "spaceship will arrive in 2047/Winter", when in fact, as far as players are concerned, there is only "December", "January" and "February". A different way to accomplish that goal would be to allow each turn fragment multiple names, and have a new effect that determines which name is used.

At this point, I feel like we can't really talk about long-term solutions for the spaceship issue without talking about long-term calendar design – including the question of if we even want things to be based on time, rather than turns (those are some cool ideas btw @Ignatus). So I guess the eventual question is – do we postpone fixing spaceships until we've figured out the calendar, or do we want some spaceship solution now (e.g. just assuming uniform year fragments, or working completely off of turns), knowing that we'll have to refine it once we take care of the calendar?
~ A.V. L.

Ignatus
Elite
Posts: 490
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Year fragments and the Space Race

Postby Ignatus » Fri Feb 26, 2021 9:03 pm

I'd vote for assuming uniform year fragments. It should be the default any way.