Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Configurable ending year #7747

Open
wants to merge 1 commit into
base: master
from

Conversation

@nielsmh
Copy link
Contributor

nielsmh commented Sep 18, 2019

Adds two new settings:

  • Game length, from 1 to 1000 years (50 year increments, defaults to 100), or zero for "fixed ending year"
  • Scoring end year, default 2050

The new default with this change is new games will end 100 years after the starting date, old games loaded should keep the original ending year of 2050, and scenarios should not get a year stamped onto them until a game is started.

Known bug, which may not be a bug: Old scenarios get converted to original end year, instead of using the new setting.

@nielsmh

This comment has been minimized.

Copy link
Contributor Author

nielsmh commented Sep 18, 2019

When you start a new game from a scenario, should it use the scenario's ending year setting, or the newgame ending year setting?

@nielsmh nielsmh force-pushed the nielsmh:endingyear branch from 3a6f0df to c89bed2 Sep 18, 2019
@nielsmh

This comment has been minimized.

Copy link
Contributor Author

nielsmh commented Sep 18, 2019

After a bit of discussion on IRC: Scenarios will use the scenario creator's ending year. Starting a new game from an old scenario will use the original ending year of 2050, since the scenario might be designed with that in mind.
Loading an old scenario into the editor will also set the ending year to 2050 and let it be reconfigured before saving the scenario again.

The Game length setting does not apply to scenarios, only to new games generated or created via heightmap.

@nielsmh nielsmh force-pushed the nielsmh:endingyear branch from c89bed2 to 9940250 Sep 18, 2019
@nielsmh

This comment has been minimized.

Copy link
Contributor Author

nielsmh commented Sep 24, 2019

Did another quick test, setting a fixed ending year and starting the game on that year, and on the year after. Neither triggers the score screen when you start the game, i.e. start year after ending year results in no scoring screen, start year equal to end year results in a one-year game.

src/date.cpp Show resolved Hide resolved
@James103

This comment has been minimized.

Copy link
Contributor

James103 commented Sep 29, 2019

Would it be possible to allow setting a configurable starting date and/or ending date besides "the end of a specific year"? For example, if you want to create a scenario where you had to deliver supplies for a Martian mission before the launch window expires, this can allow you to realistically set the end date as "5th August 2020", instead of just being locked in to the end of the year on a specific year, in this case "[31st Dec] 2020".

@Eddi-z

This comment has been minimized.

Copy link
Contributor

Eddi-z commented Sep 29, 2019

while that probably could be done, i don't think it's a good idea. the settings gui lacks a proper input method for dates, and splitting it into 3 settings for day, month and year sounds like overkill.

@Eddi-z

This comment has been minimized.

Copy link
Contributor

Eddi-z commented Sep 30, 2019

A different idea might be to have a way for a GameScript to invoke the end screen on arbitrary conditions, not just date.

@James103

This comment has been minimized.

Copy link
Contributor

James103 commented Sep 30, 2019

Note that changing the ending date from the default of "31st Dec 2050" will require the following to be changed:

  • On the newspaper: The date says "Saturday, December 31st, 2050". The date should dynamically change based on that, with also the correct day of the week as well. For example, if the end screen was triggered on 29th Sep 2019, then the date on the newspaper should say "Sunday, September 29th, 2019".
  • The high score screen says "Top companies who reached 2051". This will have to be changed, I don't know how exactly.
  • If the price on the newspaper is not "Free", then it should be some amount depending on the year of the end screen, the inflation factor, and the currency used by the game at the time.
@nielsmh

This comment has been minimized.

Copy link
Contributor Author

nielsmh commented Sep 30, 2019

I checked for myself too, yes TTD does run the ending sequence at the 2049-2050 year change, so it has a proper 100 year game, not 101 years as implemented in OpenTTD.
It's true the newspaper sprite says "December 31, 2050" but that's not the date the original game actually ends on.
The full ending sequence of TTD also includes some more details: The screen fades to black, then the newspaper fades in, it's not an instant switch as implemented in OpenTTD. The music also changes to the title theme during the ending sequence, and then restarts when the game resumes.

It also appears the ending year has actually been a setting previously, see commit 683b65e (svn r14755). However it was a GUI setting then, not a game setting.

I still think this should be made configurable again. The default setting should probably not be "100 years" but "fixed 2051" to stay fully compatible, at least for now. A primary reason to make ending year a setting again is to make it possible to not have the game ending sequence at all.

@planetmaker

This comment has been minimized.

Copy link
Contributor

planetmaker commented Sep 30, 2019

Making changes to the ending year requires some changes to the base set(s), at least one sprite: https://github.com/OpenTTD/OpenGFX/blob/master/sprites/png/gui/newspaper.png
Not a big deal to remove the explicit date from it.
However the date can be written by the game instead of included in the sprite.

Not sure how the TTD newspaper sprite looks like and whether it includes the date, too.

@nielsmh

This comment has been minimized.

Copy link
Contributor Author

nielsmh commented Sep 30, 2019

The original TTD sprite also includes the date, and it's in a different position from the OpenGFX one.

Copy link
Member

LordAro left a comment

The stuff about whether the default game should end 2049/2050 instead of 2050/2051 should be a separate issue. This PR is fine

@James103

This comment has been minimized.

Copy link
Contributor

James103 commented Nov 27, 2019

Is there any way to resolve the conflict with saveload.h so that this pull request can be merged? I think this will help a lot when designing custom scenarios as well.

@nielsmh nielsmh force-pushed the nielsmh:endingyear branch from 9940250 to c8f1933 Nov 27, 2019
@nielsmh

This comment has been minimized.

Copy link
Contributor Author

nielsmh commented Nov 27, 2019

Fixed saveload version. I also changed the default setting to be fixed 2050 ending year (keep current behaviour) instead of 100 year game length.

@LordAro

This comment has been minimized.

Copy link
Member

LordAro commented Nov 27, 2019

Why both game_creation.ending_year and game_creation.game_length settings? Seems to me that this would only cause confusion, and there's no mention of how the 2 settings interact in the helptext
I'd probably just take ending year

@Eddi-z

This comment has been minimized.

Copy link
Contributor

Eddi-z commented Nov 27, 2019

I kinda agree. there should only be one setting.

You can provide both options on the game setup screen, but when you change one, it should also change the other, so internally they'd be mapped to the same setting.

Unrelated: have we had some discussion about whether this should affect gameplay features like inflation and model age?

@nielsmh

This comment has been minimized.

Copy link
Contributor Author

nielsmh commented Nov 28, 2019

I don't quite like this way of doing it myself either, but the settings GUI is also limiting in how it can be presented. I thought I described the two settings and their interaction well enough but maybe not.

Only game_creation.ending_year actually affects which year end the scoring screen triggers.
The game_creation.game_length setting is used at game start to reset the ending_year setting to start_year + game_length in just the new game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.