The display_name property from shipdata.plist and shipdata-overrides.plist does not work

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
Simba
Above Average
Above Average
Posts: 27
Joined: Fri Aug 30, 2024 7:58 pm

The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by Simba »

https://wiki.alioth.net/index.php/Shipd ... splay_name

When I try to write my own value in the display_name property, the names of the ships on F3 and in the save description remain the same as in the name property. I checked both on 1.90 and on the latest version 1.91.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6816
Joined: Wed Feb 28, 2007 7:54 am

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by another_commander »

display_name works for me on 1.91

Image
Simba
Above Average
Above Average
Posts: 27
Joined: Fri Aug 30, 2024 7:58 pm

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by Simba »

another_commander wrote: Wed May 21, 2025 8:18 pm
display_name works for me on 1.91

Image
It doesn't work for me, it doesn't work for Krager either. Can you start a new game and see how it works there? And can you also show me what your shipdata-overrides.plist looks like?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6816
Joined: Wed Feb 28, 2007 7:54 am

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by another_commander »

Starting a new game works fine and the shipdata-overrides can be something as simple as

Code: Select all

{
	"cobra3-player" =
	{
		display_name = "Yarrrrrr!!";
	};
}
Throw this shipdata-overrides.plist inside a Config folder in AddOns and that should do it.
Simba
Above Average
Above Average
Posts: 27
Joined: Fri Aug 30, 2024 7:58 pm

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by Simba »

another_commander wrote: Thu May 22, 2025 5:11 am
cobra3-player
Wait, the bug is that the display_name property is not inherited when using like_ship. I've been trying to change it in oolite_template_adder and oolite_template_cobra3 all this time, expecting all template inheritors to get the new value the same way.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6816
Joined: Wed Feb 28, 2007 7:54 am

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by another_commander »

I am not sure it is a bug. OOShipRegistry.m in the source code contains the following inside the - (NSMutableDictionary *) mergeShip:(NSDictionary *)child withParent:(NSDictionary *)parent method:

Code: Select all

// Certain properties cannot be inherited.
if ([child oo_stringForKey:@"display_name"] == nil)  [result removeObjectForKey:@"display_name"];
if ([child oo_stringForKey:@"is_template"] == nil)  [result removeObjectForKey:@"is_template"];x
The above two keys are forcibly removed from ship dictionaries when resolving like_shiip.

This code was inserted by Jens, one of our principal maintainers, more than 16 years ago. I cannot tell or even remember why display_name should not be inherited (unlike is_template, which obviously shouldn't be), but I do know that if Jens excluded it, there is probably a good reason for it.

There is still a chance that this restriction could be lifted without harmful results, but it should be done only after very careful consideration and testing. Oolite's code is mature after all these years in development, very much so in fact. When it comes to gameplay and general internal structure, there is very little that's left to chance or without extensive playtest. However, if anyone can recall exactly why display_name should not be inherited please give us a shout here.

My recommendation would be to compile the game without the above display_name restriction and test it a lot. If tests don't uncover any breakage, consideration could be given in making the change officially, but remember, it's Jens who put this in, so be very, very sure if you decide to go ahead and change it.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2706
Joined: Sat Jun 11, 2011 6:07 am
Location: Nova Hollandia
Contact:

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by Wildeblood »

another_commander wrote: Thu May 22, 2025 4:35 pm
I am not sure it is a bug. OOShipRegistry.m in the source code contains the following inside the - (NSMutableDictionary *) mergeShip:(NSDictionary *)child withParent:(NSDictionary *)parent method:

Code: Select all

// Certain properties cannot be inherited.
if ([child oo_stringForKey:@"display_name"] == nil)  [result removeObjectForKey:@"display_name"];
if ([child oo_stringForKey:@"is_template"] == nil)  [result removeObjectForKey:@"is_template"];x
The above two keys are forcibly removed from ship dictionaries when resolving like_shiip.

This code was inserted by Jens, one of our principal maintainers, more than 16 years ago. I cannot tell or even remember why display_name should not be inherited (unlike is_template, which obviously shouldn't be), but I do know that if Jens excluded it, there is probably a good reason for it.
I thought display_name in shipdata was... I can't find the exact word, redundant, maybe.
I thought displayName on a ship object was created from shipClassName + shipUniqueName (possibly via some rule in descriptions.plist).
Make pteridomania great again!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6816
Joined: Wed Feb 28, 2007 7:54 am

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by another_commander »

Wildeblood wrote: Thu May 22, 2025 4:44 pm
I thought display_name in shipdata was... I can't find the exact word, redundant, maybe.
I thought displayName on a ship object was created from shipClassName + shipUniqueName (possibly via some rule in descriptions.plist).
I honestly cannot remember if, how and when this happened, but display_name in shipdata is definitely still a thing.

-

For those who want to test the change, I have uploaded a test executable here.
Simba
Above Average
Above Average
Posts: 27
Joined: Fri Aug 30, 2024 7:58 pm

Re: The display_name property from shipdata.plist and shipdata-overrides.plist does not work

Post by Simba »

Wildeblood wrote: Thu May 22, 2025 4:44 pm
I thought display_name in shipdata was... I can't find the exact word, redundant, maybe.
I thought displayName on a ship object was created from shipClassName + shipUniqueName (possibly via some rule in descriptions.plist).
https://wiki.alioth.net/index.php/Shipd ... splay_name
According to the wiki, this field exists for localization and by default contains a value from name.
another_commander wrote: Thu May 22, 2025 4:35 pm
This code was inserted by Jens, one of our principal maintainers, more than 16 years ago. I cannot tell or even remember why display_name should not be inherited (unlike is_template, which obviously shouldn't be), but I do know that if Jens excluded it, there is probably a good reason for it.
I think I understand the reason. Suppose there is a template A in shipdata and a template B inheriting it. Template A has a name field (so display_name contains the same value), and template B also has a name field. In this case it is necessary that the display_name field of the ship created on the basis of template B should be overridden as well. And this should happen even if the display_name field was explicitly specified in template A. But the scenario was not envisioned in which the name field is not specified in template B (and display_name too), i.e. it does not imply a change of the ship's name relative to template A.
Post Reply