Extra space in planet descriptions...

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

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Extra space in planet descriptions...

Post by Mauiby de Fug »

When flying about in Galaxy 5 for the Coyote's Run mission, I noticed in one of the planet descriptions on the Data screen that it looked a bit odd, and in trying to work out why, I came to the conclusion that there appeared to be an extra space in the description. I made a note to check properly at some point, and didn't get around to it. My latest Oolite tinkering is attempting to create a searchable database of information about the planets in the Co-operative, and to try and write an oxp that populates the system depending on the information in the planetary description. In doing so, I wrote a short function that can b called from the console which prints a whole bunch of information to the log file, and I noticed that there were descriptions which have extra spaces in them! This is a list of the 30 planets affected this way in Galaxy 1 (the extra space is after "is"):

Code: Select all

17:18:03.350 []: 4, Xequerin, Mainly Industrial, Communist, 7, 3.2, Human Colonials, 14336, 3508, 5, The world Xequerin is  fabled for its weird volcanoes and the Xequerinian mountain lobstoid.
17:18:03.363 []: 6, Rabedira, Average Industrial, Multi-Government, 9, 3.6, Human Colonials, 15552, 3909, 6, The planet Rabedira is  well known for its inhabitants’ ancient loathing of sit coms but ravaged by dreadful civil war.
17:18:03.467 []: 21, Sotiqu, Poor Agricultural, Anarchy, 4, 2, Fierce Frogs, 1920, 4731, 4, The planet Sotiqu is  famous for its exotic goat soup but ravaged by killer disease.
17:18:03.515 []: 28, Arexe, Average Industrial, Democracy, 10, 4.4, Furry Rodents, 31680, 6820, 9, The world Arexe is  fabled for its exciting sit coms and its inhabitants’ ancient loathing of sit coms.
17:18:03.546 []: 33, Inera, Rich Industrial, Corporate State, 14, 6, Blue Horned Lizards, 52800, 5970, 9, This planet is  noted for its exotic fish meat.
17:18:03.627 []: 44, Esesla, Average Agricultural, Multi-Government, 4, 2.1, Small Black Rodents, 4032, 5185, 4, This planet is  noted for Zero-G hockey.
17:18:03.699 []: 54, Ororqu, Average Industrial, Democracy, 12, 5.2, Rodents, 37440, 5222, 11, The planet Ororqu is  well known for its inhabitants’ ancient mating traditions but ravaged by unpredictable solar activity.
17:18:03.733 []: 56, Geisgeza, Poor Agricultural, Dictatorship, 5, 2.7, Human Colonials, 4536, 3746, 10, This planet is  notable for its unusual oceans and the Geisgezaian mountain slug.
17:18:03.859 []: 64, Maregeis, Mainly Industrial, Feudal, 7, 2.9, Human Colonials, 8120, 5705, 9, This world is  fabled for its ancient Maregeisian Bidial tulip plantations.
17:18:03.930 []: 74, Arraesso, Poor Agricultural, Feudal, 4, 2.1, Human Colonials, 2520, 5514, 7, This planet is  notable for its unusual oceans and its inhabitants’ exceptional loathing of food blenders.
17:18:03.946 []: 76, Orteve, Mainly Industrial, Multi-Government, 9, 3.8, Black Fat Humanoids, 12768, 5183, 2, This world is  fabled for its fabulous vicious Gezabeza gargle blasters.
17:18:04.137 []: 101, Laenin, Poor Agricultural, Communist, 4, 2.4, Human Colonials, 4608, 4165, 11, The planet Laenin is  famous for its inhabitants’ ancient loathing of sit coms but cursed by killer disease.
17:18:04.252 []: 115, Ribiso, Average Agricultural, Democracy, 6, 3.3, Human Colonials, 10560, 6497, 8, This planet is  fabled for its exciting vacuum cricket.
17:18:04.382 []: 131, Zadies, Rich Industrial, Multi-Government, 9, 3.5, Human Colonials, 16800, 3960, 4, The planet Zadies is  famous for its inhabitants’ exceptional love for food blenders but scourged by dreadful solar activity.
17:18:04.394 []: 132, Entizadi, Average Industrial, Communist, 12, 5, Human Colonials, 28800, 3419, 9, The planet Entizadi is  famous for its inhabitants’ exceptional love for food blenders but scourged by dreadful solar activity.
17:18:04.402 []: 133, Esanbe, Mainly Agricultural, Communist, 7, 3.3, Small Blue Bug-Eyed Lizards, 12672, 5293, 6, Esanbe is  famous for its inhabitants’ ancient loathing of casinos but plagued by deadly earthquakes.
17:18:04.512 []: 148, Riraes, Poor Industrial, Anarchy, 8, 3.1, Human Colonials, 7936, 6582, 5, The world Riraes is  fabled for its weird rock formations and its pink oceans.
17:18:04.570 []: 156, Aanbiat, Poor Agricultural, Democracy, 7, 3.8, Blue Fat Insects, 9120, 6747, 13, This planet is  fabled for its ancient Aanbiatian Alinet banana plantations.
17:18:04.618 []: 162, Edle, Average Industrial, Dictatorship, 12, 4.9, Human Colonials, 24696, 5031, 8, Edle is  famous for its inhabitants’ exceptional love for food blenders but scourged by frequent civil war.
17:18:04.793 []: 185, Riantiat, Poor Agricultural, Confederacy, 5, 2.9, Horned Birds, 6264, 6589, 8, This planet is  notable for the Riantiatian edible grub and the Riantiatian spotted wolf.
17:18:04.863 []: 194, Beti, Average Agricultural, Dictatorship, 6, 3, Human Colonials, 6720, 3734, 7, This planet is  fabled for its weird volcanoes and the Betiian mountain lobstoid.
17:18:04.916 []: 201, Zaalela, Average Agricultural, Feudal, 5, 2.4, Human Colonials, 3840, 3886, 8, This world is  noted for its fabulous goat soup.
17:18:05.052 []: 218, Anle, Rich Industrial, Confederacy, 11, 4.6, Black Fat Insects, 33120, 5860, 9, The world Anle is  notable for its great tropical forests and Anleian evil brandy.
17:18:05.107 []: 225, Mariar, Poor Industrial, Corporate State, 10, 4.6, Small Blue Horned Humanoids, 32384, 5728, 8, This world is  fabled for its unusual tropical forests.
17:18:05.197 []: 237, Aruszati, Mainly Industrial, Democracy, 10, 4.6, Small Green Bug-Eyed Lobsters, 25760, 5522, 7, This planet is  noted for Zero-G cricket.
17:18:05.234 []: 240, Raleen, Rich Industrial, Confederacy, 11, 4.6, Human Colonials, 33120, 3996, 7, This planet is  notable for the Raleenian tree grub and its inhabitants’ unusual silliness.
17:18:05.255 []: 243, Teesdi, Average Agricultural, Democracy, 7, 3.7, Human Colonials, 11840, 6054, 5, Teesdi is  famous for Teesdiian shrew cutlet but ravaged by occasional solar activity.
17:18:05.284 []: 247, Quorte, Average Agricultural, Corporate State, 6, 3.4, Human Colonials, 11968, 5512, 2, Quorte is  well known for the Quorteian tree wolf but scourged by dreadful solar activity.
17:18:05.299 []: 248, Soladies, Mainly Agricultural, Dictatorship, 6, 2.8, Human Colonials, 9408, 4720, 2, This planet is  fabled for its exciting Soladiesian evil brandy.
17:18:05.319 []: 251, Xexeti, Poor Agricultural, Anarchy, 3, 1.6, Large Red Frogs, 1536, 3474, 8, This planet is  notable for the Xexetiian edible arts graduate and its great volcanoes.
I don't know if this is an easy thing to fix, or if it is something that we're stuck with due to the nature of the algorithm that generates the descriptions...
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Extra space in planet descriptions...

Post by Eric Walch »

Mauiby de Fug wrote:
When flying about in Galaxy 5 for the Coyote's Run mission, I noticed in one of the planet descriptions on the Data screen that it looked a bit odd, and in trying to work out why, I came to the conclusion that there appeared to be an extra space in the description.
Now you say it, I noticed that extra space yesterday doing the Coyote mission. but, unlike you i didn't invest any further.
Most likely its a string that is sometimes left empty. looking at your list, it should be not that difficult to find the spot and see if its 'avoidable'.

Most likely its the last element the array:

Code: Select all

		(
			"very",
			"mildly",
			"most",
			"reasonably",
			""
		),
Seems difficult to fix without risking to corrupt other stuff.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Extra space in planet descriptions...

Post by Mauiby de Fug »

Yeah, I thought that it might well be awkward. And you're right - the extra space occurs when there isn't an adjective for the degree of fame. How I missed that pattern I don't know.

I'd be interested to know how one can see the contents of the array and the algorithm that creates the descriptions...
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Extra space in planet descriptions...

Post by Eric Walch »

Mauiby de Fug wrote:
I'd be interested to know how one can see the contents of the array and the algorithm that creates the descriptions...
The algorithm is easy. It just expands the string "[system-description-string]" after first setting the random generator to a fixed seed for the needed system.

When you look in description.plist you'll find:

Code: Select all

"system-description-string"		= "[14] is [22].";
Whenever you find [xx] in a description it will be the xx-th array of the "system_description" key that is expanded at that place. At the end it gives the full description.

e.g. try typing expandDescription("[system-description-string]") in the console and you get all random descriptions because the seed keeps changing in normal play.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Extra space in planet descriptions...

Post by Mauiby de Fug »

Ah, that's just what I wanted! Nice to see some of the patterns I've noticed, and interesting to see various things in there which I haven't actually seen in-game yet... My guess is that i might be fixable by taking a space out of one part and adding another one in another, although it wouldn't look as consistent. I may dabble with it in the next few days and see what results I can get. Is there a way to generate the particular system seed that is used for a system?
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Extra space in planet descriptions...

Post by Kaks »

Hmm, we can always leave everything as it is now but add an extra last step: parse the resulting string and replace all double spaces with a single space. That should do the trick without any side effects!

In other words, I'll do some proper testing tomorrow morning, and barring accidents, it should be all sorted by this time tomorrow... :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Extra space in planet descriptions...

Post by Mauiby de Fug »

Or instead of writing a new function, all you have to do is add a space and take away a space, so that lines 157 through to 163 become

Code: Select all

		(
			"very ",
			"mildly ",
			"most ",
			"reasonably ",
			""
		),
and lines 304 to 310 become

Code: Select all

		(
			"[1][0] for [9]",
			"[1][0] for [9] and [9]",
			"[7] by [8]",
			"[1][0] for [9] but [7] by [8]",
			"a[15] [16]"
		),
Not the prettiest fix, but I'd think it'd be faster than doing an additional check at the end!
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Extra space in planet descriptions...

Post by Eric Walch »

Mauiby de Fug wrote:
Or instead of writing a new function, all you have to do is add a space and take away a space, so that lines 157 through to 163 become
Problem with changing spaces in existing arrays is that other oxps that use those strings now could get double spacings. e.g. cargo_wreck always has used some of those arrays to create random messages. And in UPS I also use some of them to create randomness without defining my own arrays.

Just replacing double spaces by a single could also be dangerous when people use additional spaces to layout their messages. Unless you only do it for the specific case of planet descriptions.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Extra space in planet descriptions...

Post by Kaks »

I'm planning to only do it in the specific case of automatically generated planet descriptions. In the case of hard coded planet descriptions, the safest course is to assume that OXP makers have their own reasons for adding extra spaces - to 'force' a new line, for example! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Extra space in planet descriptions...

Post by Kaks »

Ok, committed the - very specific - fix, as described above! :)

From rev.4609 onwards, any randomly generated system description (a.k.a. anything generated using '[system-description-string]') shouldn't have any extra space anymore.

No changes to the underlying algorithm and/or strings were required - or indeed desirable - as per the reasons mentioned by Eric.

Please do check if tonight's build is behaving as expected! :)

Cheers,

Kaks.


PS: MdF, you'll be pleased to know I didn't need to write any new function! ;)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Re: Extra space in planet descriptions...

Post by Mauiby de Fug »

Jolly good! I have to say that I wasn't aware that oxps could access this sort of thing or that they were doing so, but it makes sense to make use of what's there.
Post Reply