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

Merged
merged 1 commit into from Dec 28, 2019
Merged

Conversation

nielsmh
Copy link
Contributor

@nielsmh 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
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
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
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.

@James103
Copy link
Contributor

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
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
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
Copy link
Contributor

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
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
Copy link
Contributor

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
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.

LordAro
LordAro previously approved these changes Nov 23, 2019
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

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
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
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
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
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.

@nielsmh
Copy link
Contributor Author

nielsmh commented Dec 26, 2019

I tried making it read the old setting back in, not sure I did that right. The title game (which is from SLV_4.1) seems to receive 0 in the variable.

Also, I would like to request this is merged on the 28th if possible, on the anniversary of the commit that removed the setting ;)

@nielsmh
Copy link
Contributor Author

nielsmh commented Dec 26, 2019

Tested converting ending year from very old savegames: OpenTTD 0.6.3 (last release version before customisable ending year was removed) with ending year changed in openttd.cfg, created a savegame and loaded with this PR: The configured ending year did get loaded.

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fine

@nielsmh nielsmh merged commit 2fd871e into OpenTTD:master Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants