sarbian

[1.5.x-1.6.x] Custom Barn Kit 1.1.19 (January 2nd) - Parachute Included

Recommended Posts

4 hours ago, Dman979 said:

Guys, let's cool down a bit here, please.

Time for radiator panel awareness! Apparently not enough people use them.

Share this post


Link to post
Share on other sites
17 hours ago, sarbian said:

I am starting to getting tired of this. I spent 30 minute testing and I could not duplicate any of the problems reported in the last 6 post. And since no one thought that posting a log might be of any interest I won't have a look at all for 2 weeks.

Hello Sarbian!

Issue reproduced on a fresh install of KSP 1.3 64 bits, "just" SETI Metamodpack (ckan installation with all recommended and suggested mods), here my output log.

 

Bonjour Sarbian!

La description du problème en français parce que c'est plus facile :P

J'ai constaté le problème sur mon installation principale de KSP très très moddée. J'ai donc reproduit le bug sur une installation fraîche de KSP 1.3 64 bits avec le pack SETI installé via CKAN (l'installation avec mods recommandés et suggérés, la totale). Le output log ci dessus vient de cette version. Voici comment j'ai reproduit le bug avec un test sur la Runeway (c'est la même chose pour le launchpad):

- Mise à jour de celle ci, l'argent est bien décompté, le visuel de la piste change.

- Je vais dans le SPH, aucune mise à jour n'est faite, je suis toujours bloqué sur 9t (au lieu de 18t avec l'upgrade).

- Si je revient sur la scène du KSC, la piste est revenue au tiers 1 et l'argent n'est pas rendu.

Par contre, pas de problème si j'upgrade les bâtiments jusqu'au tiers implémentés par Squad, juste ceux rajoutés par SETI, ce qui pose évidemment des soucis d'évolution.

Je joue à KSP depuis le début, j'ai une dizaine d'heures de jeu en vanilla, au moins 2990 autres en moddées. Je peux donc dire que sans ton travail, jamais j'aurais pris autant de plaisir dessus. Pour moi, c'est un comble de lire les reproches de certains et j'en suis navré, d'autant plus quand ils proviennent d'autres moddeurs. Merci pour tout ce que tu fais :kiss: :wink:

Edited by Misucat

Share this post


Link to post
Share on other sites

@sarbian Your requested reproduction: 

KSP version: 1.2.2.1622

Mods: MM, Blizzy's Toolbar, CustomBarnKit, SETI Custom Barn Kit Config

Log: https://drive.google.com/open?id=0B1o-ANenOxXoS1UtOFRaUzR6d1k (only 300kB!)

Time to reproduce: 10-15 seconds

Steps to reproduce: 

  1. Start a new game (I set it to max starting funds and min funds penalty for ease)
  2. Go to the VAB; see that the Engineer's Report shows a limit of 9T, which is correct for Yemo's L1 pad. Exit the VAB.
  3. Upgrade the Launch Pad
  4. Enter the VAB; see that the Engineer's report still shows 9T, even though we just upgraded the pad to 18T. Exit the VAB.
  5. See that the Launch Pad has been reset to L1 (I actually did not see this behavior on my main playthrough, but did continue to see the VAB report the wrong tonnage limit)
  6. Repeat steps 3-5 until convinced.

Thank you for your assistance, and have a nice day!

Share this post


Link to post
Share on other sites

[Mod edit: Quotes from deleted post snipped]

4 hours ago, coolguy8445 said:

Also, I would have assumed that my particular issue wouldn't be one that would readily benefit from a log file and, again, the file is massive and full of cruft from other broken mods. So let me get you a short, clean copy,

Don't do this. You've already wrongly assumed the log file wouldn't be helpful now you're assuming to know what in the log file will be helpful (or not helpful, depending how you look at it I guess). Modders know exactly what to look for in log files to help them figure things out. They can search for things. Don't ever "clean up" a log file.

Edited by technicalfool

Share this post


Link to post
Share on other sites
14 hours ago, Drew Kerman said:

[Mod edit: Quotes from deleted post snipped]

Don't do this. You've already wrongly assumed the log file wouldn't be helpful now you're assuming to know what in the log file will be helpful (or not helpful, depending how you look at it I guess). Modders know exactly what to look for in log files to help them figure things out. They can search for things. Don't ever "clean up" a log file.

By "short and clean" I meant one from a playthrough without all the other mod cruft, dear. Which is exactly what I gave him in my last post. An unadulterated logfile, from a playthrough with only the directly-related mods. Which, I believe, is what I said I would do. I made no comment about manually cleaning up the file (Ain't nobody got time for that!). And I believe I also mentioned that I'm a software engineer, and have thorough experience in trawling through logs and not having enough information to go on. Again, this really just came down to this only being like my second bug report, and my not remembering to post a logfile. As with Sarbian: No need to be a jerk about it.

Share this post


Link to post
Share on other sites

I found some time to debug this mess before my vacation so have fun with 1.1.15. Hopefully it should fix it all.

Trivia test. What is the result of this code :

float n = 0.35f;
log("Test " + (int)(n * 20) + " " + (0.35f * (int)20));

 

Share this post


Link to post
Share on other sites
3 hours ago, sarbian said:

Trivia test. What is the result of this code :


float n = 0.35f;
log("Test " + (int)(n * 20) + " " + (0.35f * (int)20));

 

Too...many...implicit...casts!  Could be runtime/engine implementation dependent.  Unless the language spec has very clear implicit cast rules.  Don't know C# that well, so uncertain about its implicit casts....

Test 7 7.0

?

Share this post


Link to post
Share on other sites
4 hours ago, sarbian said:

I found some time to debug this mess before my vacation so have fun with 1.1.15. Hopefully it should fix it all.

Trivia test. What is the result of this code :


float n = 0.35f;
log("Test " + (int)(n * 20) + " " + (0.35f * (int)20));

 

Test 7i 7f. I assume that it used to return a float when it should return an int.

Share this post


Link to post
Share on other sites

I have a feeling the (int)(n*20) returns 6. I ran into that problem when supporting Custom Barnkit in KCT. So my guess is something along the lines of "Test 6 6.9999999"

Share this post


Link to post
Share on other sites
10 minutes ago, magico13 said:

I have a feeling the (int)(n*20) returns 6. I ran into that problem when supporting Custom Barnkit in KCT. So my guess is something along the lines of "Test 6 6.9999999"

gotta love floating point math

Share this post


Link to post
Share on other sites
5 minutes ago, TheRagingIrishman said:

gotta love floating point math

Oh yeah.  Years ago, I coded a very simple full-screen text-terminal lunar lander game.  The hardware offered 36-bit and 72-bit floating point numbers.  Using 36-bit floats lead to these sort of weird round-off errors.  As the program was tiny and far from compute-bound, I just switched to using all 72-bit floats just to easily get rid of them.  More exactly, push them down below me noticing and hopefully having any significant effect.

Share this post


Link to post
Share on other sites

It's been so long since I had to think about this stuff.

My compiler says:

Quote

Test 6 7

 

Share this post


Link to post
Share on other sites

Yes, it gives "Test 6 7". The 6 makes sense when you know how things works underneath but the 7 does not. Why does the compiler uses a different method ? :(

Share this post


Link to post
Share on other sites
float n = 0.35f;
log("Test " + (int)(n * 20) + " " + (0.35f * (int)20));

 

21 minutes ago, sarbian said:

Yes, it gives "Test 6 7". The 6 makes sense when you know how things works underneath but the 7 does not. Why does the compiler uses a different method ? :(

Well, with the result, I can guess how some of the casts are implemented.  The explicit cast float-to-int appears to truncate.  0.35 in binary likely being a bit smaller than true decimal 0.35, so "0.35 * 20" (with 20 being implicitly cast to float before the multiplication) becomes a float a teeny bit less than 7 and truncate then gives 6.  i assume the "0.35f + (int)20" becomes almost the same value as "(0.35f * 20)".  The implicit cast  float-to-string must then get rounded to get 7.

So it comes down to the implementation of the casts.  Only way to avoid that is to use explicit functions like truncate, floor, ceiling, and round and use them in a way to give what you want.

Share this post


Link to post
Share on other sites

And I don't get the same result at work :o

@Jake I know that I the best result comes from using the explicit calls and that's what I do with CBK but the lack of consistency between my test at home (VS 2017 .NET 3.5 + Unity Mono) and work (DotNet Core 2.0 cmd line) sure is confusing.

 

Share this post


Link to post
Share on other sites

There is only one cast in that statement. the first output is computing as 6.999... and geting truncated in the cast. The second calculation has a result type of float which is then being converted to a string. The default formatting of the float is a little bit smarter in some environments and it formats 6.999 to 7.

Share this post


Link to post
Share on other sites
7 minutes ago, tomf said:

There is only one cast in that statement....

I respectfully disagree with you there.  Addition and other operations are usually defined only between same-type operands.  Every time there are 2 operands not of the same type, the syntax should define (and the implementation will effectively define) what happens to the operands to make them the same type.  Those are implicit casts.  To avoid getting bit by just this type of shenanigans, knowing what implicit casts happen where and how to code to get the result desired is vital.

Edited by Jacke

Share this post


Link to post
Share on other sites
1 hour ago, Jacke said:

I respectfully disagree with you there.  Addition and other operations are usually defined only between same-type operands.  Every time there are 2 operands not of the same type, the syntax should define (and the implementation will effectively define) what happens to the operands to make them the same type.  Those are implicit casts.  To avoid getting bit by just this type of shenanigans, knowing what implicit casts happen where and how to code to get the result desired is vital.

You are correct that the addition is between the same type operands, In this case the +'s are acting as string concatenation. When concatenating the numeric values they are automatically converted to strings (whether or not that counts as a cast I couldn't say, the documentation calls it a conversion).

Share this post


Link to post
Share on other sites
2 hours ago, tomf said:

You are correct that the addition is between the same type operands, In this case the +'s are acting as string concatenation. When concatenating the numeric values they are automatically converted to strings (whether or not that counts as a cast I couldn't say, the documentation calls it a conversion).

Years ago I did some manual coding of conversions for languages which lack good ones (or any) in the runtime or the hardware, so I'm a bit more used to thinking about (and forgetting) what's going on under the hood.  Cast, implicit cast, conversion, format, different names just mean the same thing in different ways, changing in a regular way from one representation of a object to another (ie. the same number as a string (with many equal value variants), integer, or float).  Those things still burn you when you think the two parts of @sarbian's formula will always come out the same.

But getting back to Custom Barn Kit, I have a couple of questions.

Is it still true the levels of the facilities internally in KSP are represented by different floating values?

And is there any way by code to change the facility level except by the player's UI?  I was wondering about increasing facility level as a result of a contract and thought I should ask here before bringing it up in the Contract Configurator topic.

Share this post


Link to post
Share on other sites
1 hour ago, Jacke said:

Is it still true the levels of the facilities internally in KSP are represented by different floating values?

It is. And I have no idea why because I never saw anything that uses the float values directly...

1 hour ago, Jacke said:

And is there any way by code to change the facility level except by the player's UI?  I was wondering about increasing facility level as a result of a contract and thought I should ask here before bringing it up in the Contract Configurator topic.

Yes, there are calls to do that. UpgradeableFacility.SetLevel(int lvl).  The main problem is grabbing the proper instance of UpgradeableFacility. 

ScenarioUpgradeableFacilities.protoUpgradeables is a Dict with the id of the facilities and ProtoUpgradeable. And ProtoUpgradeable has List<UpgradeableFacility> facilityRefs

So something like (not tested):

ScenarioUpgradeableFacilities.protoUpgradeables[SpaceCenterFacility.LaunchPad.ToString()].facilityRefs[0].SetLevel(2);

 

Share this post


Link to post
Share on other sites

Hello just now circling back on this and installed your version 1.1.15.

 

It fixed the disappearing tracking station however it looks like now that there is a problem loading the customizations for each building.  None of the custom settings are being applied.

I have attached a screen shot of a new career showing the normal upgrade price for the VAB.  I found this in the KSP.log referencing a failed call using Observatory that was unknown.  I have not dug into the output txt but it is included with the KSP.log in the shared google drive folder.

 

[LOG 15:06:08.049] [CustomBarnKit] Loading new upgrades prices
[ERR 15:06:08.137] Exception handling event onNewGameLevelLoadRequestWasSanctionedAndActioned in class CustomBarnKit:System.ArgumentException: The requested value 'Observatory' was not found.
  at System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Enum.Parse (System.Type enumType, System.String value) [0x00000] in <filename unknown>:0 
  at CustomBarnKit.CustomBarnKit.LoadUpgradesPrices (GameScenes data) [0x00000] in <filename unknown>:0 
  at EventData`1[GameScenes].Fire (GameScenes data) [0x00000] in <filename unknown>:0 

[EXC 15:06:08.141] ArgumentException: The requested value 'Observatory' was not found.
	System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase)
	System.Enum.Parse (System.Type enumType, System.String value)
	CustomBarnKit.CustomBarnKit.LoadUpgradesPrices (GameScenes data)
	EventData`1[GameScenes].Fire (GameScenes data)
	UnityEngine.Debug:LogException(Exception)
	EventData`1:Fire(GameScenes)
	<FireLoadedEvent>c__Iterator6C:MoveNext()
	UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

 

 

Here is the link to the logs.

 

https://drive.google.com/drive/folders/0B3tLMNmF1UxvNkFhajMtejhMM2c?usp=sharing

 

Thanks.

Share this post


Link to post
Share on other sites
17 hours ago, terminalmonky said:

Hello just now circling back on this and installed your version 1.1.15.

 

It fixed the disappearing tracking station however it looks like now that there is a problem loading the customizations for each building.  None of the custom settings are being applied.

I have attached a screen shot of a new career showing the normal upgrade price for the VAB.  I found this in the KSP.log referencing a failed call using Observatory that was unknown.  I have not dug into the output txt but it is included with the KSP.log in the shared google drive folder.

 


[LOG 15:06:08.049] [CustomBarnKit] Loading new upgrades prices
[ERR 15:06:08.137] Exception handling event onNewGameLevelLoadRequestWasSanctionedAndActioned in class CustomBarnKit:System.ArgumentException: The requested value 'Observatory' was not found.
  at System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Enum.Parse (System.Type enumType, System.String value) [0x00000] in <filename unknown>:0 
  at CustomBarnKit.CustomBarnKit.LoadUpgradesPrices (GameScenes data) [0x00000] in <filename unknown>:0 
  at EventData`1[GameScenes].Fire (GameScenes data) [0x00000] in <filename unknown>:0 

[EXC 15:06:08.141] ArgumentException: The requested value 'Observatory' was not found.
	System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase)
	System.Enum.Parse (System.Type enumType, System.String value)
	CustomBarnKit.CustomBarnKit.LoadUpgradesPrices (GameScenes data)
	EventData`1[GameScenes].Fire (GameScenes data)
	UnityEngine.Debug:LogException(Exception)
	EventData`1:Fire(GameScenes)
	<FireLoadedEvent>c__Iterator6C:MoveNext()
	UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

 

 

Here is the link to the logs.

 

https://drive.google.com/drive/folders/0B3tLMNmF1UxvNkFhajMtejhMM2c?usp=sharing

 

Thanks.

Ok I am digging into this more and it seems that this may be something to do with Seti-CustomBarnKit.  Learning about this slowly and probably making an ass out of myself grasping at straws here but after removing that all the values line up with your Default.cfg.   

Not sure why Seti-CustomBarnKit config is not working though.  Not finding any errors specifically as to why its not being applied.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.