Pony: buy menu availability cb / var

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Pony: buy menu availability cb / var

Post by PikkaBird »

michael blunck wrote: I think it´ll be better to let the players decide which "group" of vehicles they´re going to use (French ones, or German ones), rather than make that decision by random (?). And then, why shouldn´t they use different sets at all?
The decision need not be random. It could be done with parameters, like you suggested. If the vehicle counting var were implemented, one could even have the player select French or German trains by building their first locomotive.

Functionally, of course, this can already be done. I can already give different players different vehicle sprites, so for example I could show "French" locomotives to the "German" player greyed out with a slash through them. I can also control whether or not a train can leave the depot, so I could make it impossible for the "German" player to start a "French" train. This additional callback would simply make things easier for players, by allowing me to clear their purchase menu of vehicles they're not allowed (because they have chosen not to be allowed) to use.
W/o having detailed information about the actual map (size, mountainousness(?), distribution and sizes of towns, types and numbers of industries, ...) it´d be hard to impossible for a newGRF to decide about the number of particular engines to be allocated to the player.
This seems to be a variant on Lakie's old argument-against-everything: "if xyz feature is implemented, newgrf authors will use it to do horrible things to the player and TTD will be ruined forever!". Firstly, no we won't, we're smarter than that. Secondly, even if we do, the worst we can do is produce an unplayable GRF that no-one will use. I'm just asking for a tool; if I misuse it it's no skin off anyone's nose but my own.
Eddi wrote:tbh, i think limiting the engine count should rather be left to a gamescript [...] We already have this problem with Industry NewGRFs, where the NewGRF itself has really heavy control mechanism and nobody can build properly balanced economy mechanisms on top of that.
"It should be done in GS" is the new bane of every NewGRF feature discussion, and I'm sorry I even mentioned GS in the feature request. No, it - for almost any value of it - should not be done in GS, for the following two reasons;

One, you can only have one GS running at a time. GS are specifically for "setting conditions, goals, achievements and quests". Any kind of "mechanism" more specific than that - production by individual industries, availability of individual vehicles - is the province of NewGRF.

Two, as you so rightly pointed out, a GS cannot be linked to a specific NewGRF. So to transfer some of my NewGRF's functionality to a GS means I need to write a script generic enough to function with any, or no, NewGRFs. This would be, at best, nearly impossible to achieve.

Now, if these two obstacles were removed - if the GS could detect and interact with the GRF, and if loading any number of "mechanic" GSes didn't preclude players from also loading a proper "goal" GS - then yes, this could be done in GS. But what would be the point? All you would have achieved is making the player find, install and configure two files instead of one to use this train or industry or house set. Where's the sense in that?
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Pony: buy menu availability cb / var

Post by Alberth »

nobody can build properly balanced economy mechanisms on top of that
It's not only GS, it is also not possible in the OpenTTD game engine itself, I think. I tried, and failed.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: Pony: buy menu availability cb / var

Post by peter1138 »

michael blunck wrote:
PikkaBird wrote:
mb wrote: There´s already prop18 (AI rank)? [...] At least in TTDPatch, you could set the climate bit to "unavailable" (0) for the human player (but not for the AI).
Would be relevant if we were playing TTDPatch, certainly.
Well, this should work in OTTD as well. The only difference I see is that OTTD uses dedicated AIs, so the question arises how (well) the existing AIs can/are use/using existing specs.
OpenTTD used to support this property with the old built-in AI, but it is not supported with NoAI. Since NoAI, AIs are no longer allowed to cheat (no free landscaping etc) and therefore they can only build the same engines as regular players, and can only make their selection with the same information that players can see.
He's like, some kind of OpenTTD developer.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Pony: buy menu availability cb / var

Post by michael blunck »

PikkaBird wrote:
mb wrote: W/o having detailed information about the actual map (size, mountainousness(?), distribution and sizes of towns, types and numbers of industries, ...) it´d be hard to impossible for a newGRF to decide about the number of particular engines to be allocated to the player.
This seems to be a variant on Lakie's old argument-against-everything: "if xyz feature is implemented, newgrf authors will use it to do horrible things to the player and TTD will be ruined forever!". Firstly, no we won't, we're smarter than that. Secondly, even if we do, the worst we can do is produce an unplayable GRF that no-one will use. I'm just asking for a tool; if I misuse it it's no skin off anyone's nose but my own.
I´m just playing a bit "devil´s advocate" here, I´m not per se against your proposal. I just want to be helpful shaping your ideas. :cool:

petern wrote: [prop18 (AI rank), AI climate availability]

OpenTTD used to support this property with the old built-in AI, but it is not supported with NoAI. Since NoAI, AIs are no longer allowed to cheat (no free landscaping etc) and therefore they can only build the same engines as regular players, and can only make their selection with the same information that players can see.
PikkaBird wrote: a) hiding "confusing" vehicles from an AI player.
b) hiding "AI Only" vehicles from a human player
So, such a new CB would re-introduce "cheating"?

regards
Michael
Image
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Pony: buy menu availability cb / var

Post by Eddi »

if "changing game rules" is "cheating", then all of the newgrf spec is "cheating"
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Pony: buy menu availability cb / var

Post by michael blunck »

Eddi wrote:if "changing game rules" is "cheating", then all of the newgrf spec is "cheating"
Before starting another discussion, let´s first clarify what "the game rules" are and in what specific way newGRFs are changing them?

Mind you, we´re not talking about TTD ...

regards
Michael
Image
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: Pony: buy menu availability cb / var

Post by peter1138 »

michael blunck wrote:
PikkaBird wrote: a) hiding "confusing" vehicles from an AI player.
b) hiding "AI Only" vehicles from a human player
So, such a new CB would re-introduce "cheating"?
If it that was all it could be used for, then yes in my humble opinion.
Eddi wrote:if "changing game rules" is "cheating", then all of the newgrf spec is "cheating"
The key is not that "game rules" are changed, but that they're different for players and AIs, and if companies merge makes for some lovely inconsistencies.
He's like, some kind of OpenTTD developer.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Pony: buy menu availability cb / var

Post by PikkaBird »

I have resubmitted the feature request with as few hooks for distracting barely-tangental discussion as I could manage. :roll:
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Pony: buy menu availability cb / var

Post by PikkaBird »

A callback to limit vehicle appearance in the purchase list, for the purpose of giving players exclusive vehicles in multiplayer games (for example, player 1 gets German trains and player 2 gets French trains).

SPEC:

The callback runs whenever a window ("available vehicles" list, depot purchase list, auto-replace window) is opened by the player, whenever the player receives a prototype offer, and whenever a new vehicle model is introduced or expires.

Callback returns:

0 to allow the vehicle to be shown in the list or for the player to be offered the vehicle (default behaviour).
1 to hide the vehicle in the list, or to automatically reject a prototype offer without displaying the window.

Vars:

Var 10 = 0 if we are viewing the "available vehicles" list, 1 if we are viewing a depot purchase list or the auto-replace menu, and 2 if we are getting a prototype vehicle offer.

Useful vars may include 43 (Player info) and 7F (GRF Parameters). Because the callback only runs when the window is opened, vars which rely on changing information (such as current date) should not be used, because the callback information will not be refreshed in open windows; you may end up with two open windows showing different information, and apparently allowing you to build different vehicles.

Sound simple enough?
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: Pony: buy menu availability cb / var

Post by Michi_cc »

PikkaBird wrote:The callback runs whenever a window ("available vehicles" list, depot purchase list, auto-replace window) is opened by the player
That's a no-go by itself, client-only actions may not trigger updates of the internal game state or you risk desyncs in multiplayer. It could be done if the callback is also run during buy command execution, but only if the callback has no means to change any state in the NewGRF, or if it is purely meant as a visual thing and the server doesn't do any checking when executing the command.

-- Michael Lutz
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Pony: buy menu availability cb / var

Post by michael blunck »

PikkaBird wrote:
mb wrote: I think it´ll be better to let the players decide which "group" of vehicles they´re going to use (French ones, or German ones), rather than make that decision by random (?). And then, why shouldn´t they use different sets at all?
The decision need not be random. It could be done with parameters, like you suggested. If the vehicle counting var were implemented, one could even have the player select French or German trains by building their first locomotive.

Functionally, of course, this can already be done. I can already give different players different vehicle sprites, so for example I could show "French" locomotives to the "German" player greyed out with a slash through them. I can also control whether or not a train can leave the depot, so I could make it impossible for the "German" player to start a "French" train. This additional callback would simply make things easier for players, by allowing me to clear their purchase menu of vehicles they're not allowed (because they have chosen not to be allowed) to use.
PikkaBird wrote: [downsized feature request]

A callback to limit vehicle appearance in the purchase list, for the purpose of giving players exclusive vehicles in multiplayer games (for example, player 1 gets German trains and player 2 gets French trains).
Well. So, again: I still don´t see your original need for this new feature, rather than keeping the purchase menu more tidy? Since you´re proposing smaller sets for yourself, where´s the need for *you* to offer different sets of engines (French, German, ...) in *one* set?

Given the vast majority of players using more then one train set concurrently, I don´t see a justification for a single newGRF to keep the purchase menu "tidy"?

regards
Michael
Image
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Pony: buy menu availability cb / var

Post by Eddi »

michael blunck wrote:Given the vast majority of players [...]
Given that 89% of all statistics are made up on the spot?
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Pony: buy menu availability cb / var

Post by michael blunck »

Eddi wrote:
michael blunck wrote:Given the vast majority of players [...]
Given that 89% of all statistics are made up on the spot?
Just check newGRF lists available on this forum. :|

(Under the assumption that´s a representative random sample ...)

regards
Michael
Image
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Pony: buy menu availability cb / var

Post by Eddi »

michael blunck wrote:(Under the assumption that´s a representative random sample ...)
Exactly, neither did you actually present a sample, nor did you present any reasons why it should be considered "representative"
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Pony: buy menu availability cb / var

Post by PikkaBird »

Michi_cc wrote:or if it is purely meant as a visual thing and the server doesn't do any checking when executing the command.
I'm quite happy with (and had always imagined this being) purely client-side, apart from the auto-rejecting of vehicle prototypes. It affects what vehicles the player sees in the list, not what vehicles the game allows the player to build.
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Pony: buy menu availability cb / var

Post by Eddi »

that is, quite honestly, the stupidest suggestion so far...
Robbedem
Engineer
Engineer
Posts: 111
Joined: 14 Jan 2013 18:08

Re: Pony: buy menu availability cb / var

Post by Robbedem »

Eddi wrote:that is, quite honestly, the stupidest suggestion so far...
I disagree. I'm sure that for many players such a function would be usefull. Perhaps it could be accomplished by using a hide toggle?
It would work like this: you start with everything visible, you can then check the hide function behind the vehicles you won't use and in the upper bar you could select "show all" or "show unselected".
But since I don't know how to code I'm not sure if this is the best way.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Pony: buy menu availability cb / var

Post by PikkaBird »

petern wrote:if companies merge makes for some lovely inconsistencies.
Actually, that's another way in which this callback would be superior to the currently available method of "set control", which is the start/stop callback; buy menu hiding would allow a player to continue to operate "foreign" vehicles acquired via a company merge, even if they can't build more of them.
Robbedem wrote:hide toggle [...] It would work like this:
Changes to the OpenTTD GUI are way outside the scope of what we're discussing here.
User avatar
SquireJames
Tycoon
Tycoon
Posts: 1863
Joined: 07 Aug 2004 11:56
Skype: squirejames5
Location: Stoke-on-Trent
Contact:

Re: Pony: buy menu availability cb / var

Post by SquireJames »

Eddi wrote:that is, quite honestly, the stupidest suggestion so far...
Troll is a bad colour on you Eddi.

I personally can see the value in your suggestion Pikka. It could even be used in an intra-country basis, for example something set during the Big Four Era, each player could be assigned one of the four and be limited to the locomotives from that company. Beyond trains, it could work for a wider scale game with Western and Eastern blocs being limited to Western and Eastern aircraft. i.e The "RTS Game Style" unit selection we have been discussing.
Image
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Pony: buy menu availability cb / var

Post by Alberth »

SquireJames wrote:
Eddi wrote:that is, quite honestly, the stupidest suggestion so far...
Troll is a bad colour on you Eddi.

I personally can see the value in your suggestion Pikka. It could even be used in an intra-country basis, for example something set during the Big Four Era, each player could be assigned one of the four and be limited to the locomotives from that company. Beyond trains, it could work for a wider scale game with Western and Eastern blocs being limited to Western and Eastern aircraft. i.e The "RTS Game Style" unit selection we have been discussing.
Eddi was referring to
PikkaBird wrote:I'm quite happy with (and had always imagined this being) purely client-side, apart from the auto-rejecting of vehicle prototypes. It affects what vehicles the player sees in the list, not what vehicles the game allows the player to build.
which basically says "you can still buy all vehicles, you just cannot see them in the vehicle list."

This means that AIs will not be limited (as they don't look at the list), and there are edge cases where two players in MP, in the same company each buy an engine, but from a different "bloc" at the same time, effectively disabling themselves of buying any other engine.

If you want this to fly (and it might be a good idea), the game engine itself should enforce it, not the GUI.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 6 guests