-
-
Notifications
You must be signed in to change notification settings - Fork 908
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: [UI] Split AI/Game Script configuration windows and add them to world gen window #10058
Conversation
I'm very happy to see this being worked on, and it's always nice to see new contributors getting involved. A couple thoughts:
|
@2TallTyler, thanks for your interest. Here's what I think:
As a side note, would anyone happen to know why the commit check is saying that the commit message is in the incorrect format? It seems to me like it is, unless it's somehow too long. (I do know why the tabs check is failing, and I'll fix that at the end). |
It's because of the merge commit, your commit message is fine. |
Good argument for the configure GS button. I'm sold. I definitely prefer the generate button below. The gap below town names doesn't bother me — I'm pretty sure a previous version of the game had a similar gap somewhere in this menu which was only eliminated. |
Alright, should be good to go. Just commited @2TallTyler's ideas (i.e. moving the generate button) and fixed some accidental tab issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lines that Actions is complaining about has already been fixed in 33da4df; It seems to be complaining about an earlier commit. The current changes to genworld_widget.h
only adds 4 lines with correct tab spacing. Also, the commit message complaint is referring to the commit that merges master into my branch.
Indeed, commit checker checks each commit individually. |
You'll want to do an interactive rebase to combine all six commits into one, then force-push. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although maybe not for this PR, but the 3rd button kinda bothers me. And I understand your reasoning for making that button, but the UI now feels weird.
NewGRF -> AI/GS -> GS
It is a bit confusing why GS is there twice. In an ideal world, I guess, the AI/GS should be come just AI, and the GS should allow changing the GS. That would give a much more solid flow, I would think.
But I can fully understand if that is a bit too much for a change at once, but I would love to read your view on it.
|
Moving the Generate button was my suggestion above. 😛 It looked strange to have a lot of buttons below the Generate button. Maybe keeping it at the bottom, but making it normal or double height instead of triple, would look better. |
|
I think splitting AI/GS windows should be a separate commit before adding the buttons to the worldgen window. And please rebase to remove the merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't comment on all locations with coding style issues ;)
Most are caused by VS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems VS doesn't want to cooperate ;)
As a side note for the main menu/title screen UI, a good option would be to remove the highscore table (similar to what #7786 does) and thus remove the button from the main menu and replace it with the "NewGRF Settings" button. This way "AI Settings" and "Game Script Settings" will be on their own row and the UI will be properly lined up again. Keep in mind that this of course would interfere with #7786 since the "NewGRF Settings" button goes where the "Help and Manuals" button would go in #7786. |
I like the idea of shortcuts in the new game window. I also like the idea of creating separate windows for AI and GS selection and settings. It could use other changes there as well, but that's a separate topic. However, I don't know if the proposed changes are the best way. What I definitely miss in this window, apart from these three shortcuts, is also a shortcut to gameplay settings - not all settings, including those related to the interface, but those that define the gameplay. In general, there are some interesting concepts that would be worth considering. Some time ago, Andrew350 proposed, probably not the first, to combine the NewGRF and AI/GS setup windows. This solution solves the problem of the three buttons in the intro. Over a decade ago andythenorth created a very interesting and inspiring mockup for me, showing the concept of a new game settings window (I think). Also TrueBrain introduced the concept of redesigning the new game window as well as the intro, where the main change would be to add a preset selection option, which would be the player's primary choice and which I think is a really enjoyable and useful solution. I also have my own concept largely inspired by the ideas above. It is not complete and not everything is consistent.
Sorry, I'm not presenting you with a ready-made concept that you can simply approve or reject. However, I mention it because I think it is worth considering what it should look like. :) |
@LC-Zorg The main goal of this PR was to add the GS/AI settings to the world gen window. I split GS and AI after the fact because there was a disagreement about the GS parameter config button, and I agreed with the suggestion to split them. However, I wanted to split them as minimally as possible and keeping to the same layout/design as much as I could. Thus, while your suggestions are valid, I feel they are beyond the scope of this pr, especially when trying to drastically alter the title menu or NewGRF settings as well. Your suggestions would be a good PR on its own, especially since they are all concepts right now. |
Needs a rebase 🙂 |
I like this a lot :) Is there a reason to keep the 3 buttons in the title menu? I am not sure how the scenario editor should work (I never use it myself). Maybe the easiest option would be to also add the three buttons to |
Fixed merge conflicts then rebased👏 Should be good now since, despite the failed commit check, the commit message is in the correct format.
I would think to keep them in the title menu; a couple reasons come off the top of my head. They're convenient for if you just want quick access to ai, game script, or newgrf straight from when you load the game (for example, you load the game just to check what newgrf or ais you have). Not to mention, new players probably wouldn't notice the existence of ai, game script, or newgrf as much if they're underneath having to create a new game.
The scenario editor has the in-game toolbar which has the settings button with the "Game Script settings" and "AI Settings" options already. Adding to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't delved too deep into how the code works, but here's a bunch of code style and documentation items.
The failed commit check is a format thing. You can't have more than one type. Personally I'd call this a Feature.
src/game/game_gui.cpp
Outdated
wi_rect.top = pt.y - rel_y + (this->line_height - SETTING_BUTTON_HEIGHT) / 2; | ||
wi_rect.bottom = wi_rect.top + SETTING_BUTTON_HEIGHT - 1; | ||
|
||
/* For dropdowns we also have to check the y position thoroughly, the mouse may not above the just opening dropdown */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should either be changed to make sense or removed, then. No sense keeping it the way it is. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're moving items around in the generate world GUI because of the moved Generate button, I'd suggest the following:
Left side (land generation):
- Map size
- Land generator
- Terrain type
- Variety distribution
- Smoothness
- Map edges
Right side (everything besides land):
- Date
- Sea level
- Rivers
- Town names
- No. of towns
- No. of industries
That gives a nice even 6 items on each side. 🙂
Good catch; The merge conflict was an absolute mess so I forgot to put that back in. It's there now.
You forgot about snow/desert coverage, so I can't do this exactly 😭. I tried to make the new game menu as consistent as possible with the heightmap generation menu, while also trying to keep these suggestions. Thus, I've moved rivers to the left half on both windows, but kept sea level on the right since that's only on the new game menu. I've also added some comments in the source code to help clarify the structure of the GUI tree and cleaned up the structure a bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new layout looks great. And gives me space to do #10093. 😉
Sorry, I don't know if these are new changes to review or if I missed them before.
… to world gen window
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for being patient with all my nitpicks. 🙂
Motivation / Problem
A while ago, @frosch123 mentioned in the discord that adding Game Script, AI, and NewGRF settings buttons to the world gen window is an old request/idea but always gets swamped by other requests. As I personally also want this feature, I decided to do it myself. This will allow users to edit Game Script/AI settings, NewGRF settings, and Game Script configuration from both world generation windows (new game and heightmap).
What's most convenient is that users can now edit Game Script paramters directly from the world generation window, without having to go back to main menu > AI/Game Script Setttings > select Game Script > Configure, and can instead just click "Configure Game Script". This also aligns with OpenTTD's goal of improving the user interface; I made the changes in the way that they are not too intrusive (the new buttons do not over-complicate the world generation window) and have the same styling as the other buttons. This will be most enjoyed by any players who regularly use and change either their game script or their game script configuration/parameters.
Description
This commit simply adds 3 buttons to the bottom of the world generation window, each of which just show windows which are already in the game:
The first two buttons do exactly the same as their main menu counterpart; the "Configure Game Script" button directly shows the Game Script Parameters window for the currently selected game script and allows players to directly configure the Game Script. As mentioned earlier, this allows players to easily and fully configure their NewGRFs and scripts right from the world generation screen.
The buttons are double the height of the other buttons so they are easy to see but are also at the bottom of the window so they do not intrude any part of the world gen interface (The idea to put them at the bottom was thanks to @ldpl). They are also colored the same as the other buttons (excluding the "Generate" button) to match OpenTTD's theme.
Limitations
This feature solves the problem of inconvenient menu navigation for all players. The feature is pretty much complete, and nothing else needs to be added to it. It is possible to change the look and feel of the buttons in the future, or add more buttons with similar functionality, but my aim was to make functionality that was already in the game more convenient and user-friendly. As this is a simple addition, there should be no bugs or problems that occur because of it.
The only notable source code change is that
void ShowAISettingsWindow(CompanyID slot)
inai_gui.cpp
was added via decleration to its corresponding header file (i.e. the header file for the AI gui) and is no longer static, so that it could be visible to the world gen GUI file (genworld_gui.cpp
). This should not have a real effect on any part of the game however.It is important to note however that I did add strings to
english.txt
, some of which were duplicates. I itentionally did not re-use the strings from the main menu (e.g. reusing "NewGRF Settings") because I did not want them to share the same strings (causing edits to them to relfect in both places) and possibly confuse people if they were looking for a seperate set of strings. It would also make the strings inconsistent: the first two buttons would use shared strings, while the "Configure Game Script" button would have its own string in a different section inenglish.txt
. Not to mention, I don't see string codes being re-used anywhere in OpenTTD. Regardless, this could be easily changed if need be, but I ended up doing what I believed is best.Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.