Skip to content

Instantly share code, notes, and snippets.

@TrueBrain
Last active April 28, 2024 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrueBrain/976cab3b6c88f208636653191ba5c420 to your computer and use it in GitHub Desktop.
Save TrueBrain/976cab3b6c88f208636653191ba5c420 to your computer and use it in GitHub Desktop.
Presets

Introduction

If you have played OpenTTD without NewGRFs and GSes for a bit, with the default settings, you get interested in spicing up your game. Currently this requires some pretty good knowledge of all kinds of things:

  • What NewGRFs are good and which work good together?
  • What settings make the game more interested (cargodist) and which should you never touch (inflation)?
  • What GS increases the fun of a game, and in what climate does it work best?

To get answers to these questions is difficult. You need access to any OpenTTD community, and other people need to help you out to piece everything together.

Our in-game "Online Content" window is of no real help either. It just shows everything in a single list, with no indication of what is good, bad, works well together, etc etc.

Additionally, after installing content, you must not forget to active NewGRFs and GSes, something I personally keep forgetting. And after you did all that correctly, switching between two different types of games is just impossible.

OpenTTD does have one way for people to share their suggested settings, NewGRFs, GSes, etc: scenarios. But this comes with a huge drawback: it also comes with a prerendered map. Additionally, if you forgot to install the GS, you are not really informed of this, and nothing is offered in-game to help you find out what GS you should download.

Looking in the community, there is high demand to address this issue:

This page sets out a way to address the issue, via something nicked Presets. In short, it would be the superset of the current (mostly unused) NewGRF Presets, to be more generic and useful to all.

Presets

What does a preset include?

Currently OpenTTD has NewGRF presets, a hidden dropdown in the NewGRF window. It is a bit broken and awkward to use, but it is a nice start.

My suggestion is to extend this, to include the following:

  • Settings under "economy"
  • Settings under "game"
  • Settings under "linkgraph" (possibly split it between user-settings and game-settings)
  • Settings under "pathfinding" (not sure about this one)
  • Settings under "world"
  • NewGRFs + parameters
  • AIs + parameters
  • GS + parameters

Technical

With the splitting up of settings, this became really simple. We just have to carve out what we want in presets and what not. But other than that, we can already simply store a preset in its own file, and load from it. Basically, it is a subset of the argument -c when starting OpenTTD.

Where to use it?

I suggest we replace the current "New game" window with this. We remove everything that is now on it, and replace it with a dropdown. You can simply select the preset you want, and below it we have two buttons:

  • "Play", which starts the game based on the preset.
  • "Configure & Play", which allows you to configure the preset before playing.

Each preset could contain a small image to show how it looks, short summary of the most important information, etc.

The "Configure & Play" presents you the settings GUI with only the things that can be altered for the game. After alteration, you can save the preset there. This adds the new entry back in the Preset list, and we made a full circle.

Technical

A preset is as additional to the openttd.cfg, in other words: the game loads openttd.cfg and on top of that the preset. This means any missing setting is set to the value the user specified. This allows for optional preset settings. Presets are loaded after "the game started", as in: they are not stored in openttd.cfg, keeping the user preferred setting as theirs.

What presets are there by default?

I suggest we make 8: 4 for each climate, in 2 difficulty settings. Like "Flat" and "Hilly", and some other things we tweak. Just something that is nice for most players, without going overboard.

How about the current "New game" window?

We remove that. We integrate that all in the somewhat modified settings GUI.

BaNaNaS integration?

Yes! And this is where this idea shines: you can upload (via https://bananas.openttd.org/) your preset, for anyone to download. As it is basically a single text-file + image, this is relative easy to do.

How to get there?

Well, to get from here to there, you need some steps. My suggestion:

  1. Figure out what settings must go in a preset, which are optional, and which are not allowed. This most likely also means splitting it in the Settings tables we have. A nice refreshener, so to say.
  2. Add a new argument like -P to load a preset from disk. When used, it starts a new game based on the presets.
  3. Allow saving presets based on an existing game. (a console command for all I care)
  4. Change the Settings GUI into two stages: user-based settings, those that are not in a preset, and game-settings.
  5. Migrate Game Options with the user-based settings. (possibly better to combine 3 and 4)
  6. Change the New Game window to show a dropdown of presets, and add some default presets. Include the current climate pictures in it, and make it look a bit nice.
  7. Allow uploading presets to BaNaNaS, including a nice image. (remember, the game could be in 8bpp, so we might need some image-manipulation to make it look "good enough")
  8. Integrate presets from BaNaNaS in-game, by adding the category to the current Online Content window.
  9. Add a "Browse Online" button to the New Game window as shortcut to open the Online Content window with filter.
  10. ??
  11. Figure out a nice way to have players know what a good preset is. Some kind of voting, popular, starring, ... (N users have starred this preset, I dunno)
@audigex
Copy link

audigex commented Apr 28, 2024

I dislike the concept of a fixed number of "dev/expert-defined" presets, as it is likely to result in a fairly narrow set of newGRF options and is discouraging to newGRF/content creators who's work doesn't make it onto a small list of 8 (per your example) presets

I prefer the concept (suggested in discussion on Discord today) of allowing user-created presets with perhaps a voting system (combined with recency to avoid the list getting too stale?) to allow presets to be more of a community collaboration

Newer and higher voted presets near the top of the list, older and lower voted nearer the bottom, with a bias to push older presets further down over time (even if they continue to be upvoted?), seems like a nice balance

@TrueBrain
Copy link
Author

TrueBrain commented Apr 28, 2024

The 8 presets do not contain NewGRFs, and just give players some rough impression about presets from the start. They are just defaults, to avoid an empty list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment