Patch: New game in-game

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
loclahost
Engineer
Engineer
Posts: 46
Joined: 18 Dec 2008 07:39
Location: Sweden

Patch: New game in-game

Post by loclahost »

Usually when I play random maps it takes a couple of tries to get a map I like. And to create a map you need to go "Quit the current game, start a new game, tweek the settings, check out the new map, quit the current game, start a new game..." and that's the way I've been doing it for the last five years I've been playing openttd.

But today I thought "Don't be so lazy! It's open source for a reason. Start modifying!" and here it is: A very simple patch to add a "New game" option to the save/load menu. It pops up the new game dialog inside the current game. I hope having saved one (or maybe two?) mouse clicks makes you as warm inside as it makes me :D.

Comments and feedback are appreciated; it felt too easy so maybe there is a reason why this behavior isn't in trunk?

Edit:
v2: Updated patch to allow all inputs in the new game dialog to be edited.
Attachments
newgameingame_v2_22731.diff
(2.89 KiB) Downloaded 149 times
Last edited by loclahost on 09 Aug 2011 08:27, edited 1 time in total.
User avatar
Nickman
Engineer
Engineer
Posts: 66
Joined: 27 Jun 2006 23:07

Re: Patch: New game in-game

Post by Nickman »

Did you check wether the "old" map gets completely thrown away?
By that I mean that all used memory is cleared when creating a new map using your new menu item?

It's the only problem I could think of :)
loclahost
Engineer
Engineer
Posts: 46
Joined: 18 Dec 2008 07:39
Location: Sweden

Re: Patch: New game in-game

Post by loclahost »

Nickman wrote:By that I mean that all used memory is cleared when creating a new map using your new menu item?
I did use the system monitor to check for that. It showed no difference in ram usage when using my function ten times. I'm not really a c/c++ developer so I don't know how to profile more than that. gdb and gprof is not my home turf :wink:
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Patch: New game in-game

Post by FooBar »

Don't have anything set up to compile, but this sounds like something I'd use. Nice idea, I like it!

Only think I can imagine that might go "wrong" is that you accidentally select the option from the menu and your current game is lost. I suppose that if you close the "New map" window, that your current game will remain usable? If so, then it's probably guarded enough, although an additional red warning "If you proceed, all unsaved progress of the current game will be lost. Continue? Yes/No" wouldn't hurt. Yes, it's an extra click but at least users are informed what they're about to do.
loclahost
Engineer
Engineer
Posts: 46
Joined: 18 Dec 2008 07:39
Location: Sweden

Re: Patch: New game in-game

Post by loclahost »

Yes, it opens up in a new, closeable window, just like when selecting "New game" from the start screen. If you close it the current game remains as it where before.

Found a bug though. It seems that the "Number of towns" and "Number of industries" input refuses to register the changes made to them (whatever you chose in the dropdown it stays the same). All other inputs work as intended. New version will probably be out tomorrow to fix this.
loclahost
Engineer
Engineer
Posts: 46
Joined: 18 Dec 2008 07:39
Location: Sweden

Re: Patch: New game in-game

Post by loclahost »

Solved the problem with the fields that couldn't be edited. See first post for new patch.
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Patch: New game in-game

Post by supermop »

neat idea!
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Patch: New game in-game

Post by adf88 »

You don't need any patches. Just tweak the settings once, before you start a game, they will be saved. All you have to do to restart a game is quit to the main menu and click "New game"->"Generate" - that's all, less then 2 seconds.
:] don't worry, be happy and checkout my patches
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Patch: New game in-game

Post by Zuu »

adf88 wrote:You don't need any patches. Just tweak the settings once, before you start a game, they will be saved. All you have to do to restart a game is quit to the main menu and click "New game"->"Generate" - that's all, less then 2 seconds.

For that you can also open the console and type newgame and press enter. So if you are quick on the keyboard, this is faster and more convinient.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
loclahost
Engineer
Engineer
Posts: 46
Joined: 18 Dec 2008 07:39
Location: Sweden

Re: Patch: New game in-game

Post by loclahost »

Well adf88, the whole point was that I'm to lazy to go back to the main menu. And I'd like to change the settings between maps :wink:.

Since no one have reported any problem with this patch I'll switch to my next patch idea, also one for those as lazy as me. It will be a "Play current scenario" sub-menu choice that will launch the current scenario from the scenario editor as a game. It's a bit trickier than the new game in-game patch so don't hold your breath...
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Patch: New game in-game

Post by MagicBuzz »

I have a few suggestions :
- After creating a new game, let the "new game" window opened for 20 seconds. So you can recreate many new games on the fly without reopening the window.
- Display the new game with the same zoom level as before creating the new game.
- If the minimap was open before creating a new game, re-open it.


With those evolutions, I think your patch would be very usefull and really user-friendly.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Semrush [Bot] and 6 guests