DMagic

[1.3.x] Contracts Window + [v8.1] [7/28/2017]

Recommended Posts

Hello, there's amassive FPS drop when the contracts window is visible, from 60 to 19 in all scenes. Using version 3.2.

screenshot0.png

screenshot1.png

Share this post


Link to post
Share on other sites
Hello, there's amassive FPS drop when the contracts window is visible, from 60 to 19 in all scenes. Using version 3.2.

http://s2.postimg.org/4t1222axx/screenshot0.png

http://s2.postimg.org/dpbu601k5/screenshot1.png

Have this issue as well x64 bit ubuntu. Left me frustrated for a day thinking my hardware was the issue finally realized it is this mod when i closed it and my game ran at normal time. Could it have to do with contract that share a title swapping places every few seconds i.e. have 3 contracts for the same thing such as visual surveys the 3 will switch back and forth positions in the window unless they are all pinned to the top. quite annoying when trying to find out whether the contract is for above or below an altitude on top of all the lag introduced when the window is open. let me know if you need more info hope this gets fixed as this mod is a MUST HAVE.

Share this post


Link to post
Share on other sites

OK. I think I've finally figured out this performance thing. It seems that some of the Fineprint contracts (and maybe some others) have very complex methods for generating the parameter titles, and checking those methods every time the GUI is refreshed is killing performance when those parameters are shown. It seems like survey contracts are the worst, but not all of the time, and there might be other offenders.

The solution is to cache the contract and parameter titles (and notes, and just about everything else the window is showing). I think this will cause problems with things like Contract Configurator and maybe others that have dynamic contract/parameter titles. I refresh some of the contract info every 5 seconds, so I'll just have to add this new info to that method; it might be better to use some GameEvents to trigger these title refreshes though.

I'm also trying to sort out some of the lower level GUI stuff. I have gratuitous overuse of GUILayout calls, some I'm in the process of positioning as much as possible manually to avoid some of the overhead caused by GUILayuot.

I should have something ready this weekend.

Share this post


Link to post
Share on other sites
OK. I think I've finally figured out this performance thing. It seems that some of the Fineprint contracts (and maybe some others) have very complex methods for generating the parameter titles, and checking those methods every time the GUI is refreshed is killing performance when those parameters are shown. It seems like survey contracts are the worst, but not all of the time, and there might be other offenders.

The solution is to cache the contract and parameter titles (and notes, and just about everything else the window is showing). I think this will cause problems with things like Contract Configurator and maybe others that have dynamic contract/parameter titles. I refresh some of the contract info every 5 seconds, so I'll just have to add this new info to that method; it might be better to use some GameEvents to trigger these title refreshes though.

I'm also trying to sort out some of the lower level GUI stuff. I have gratuitous overuse of GUILayout calls, some I'm in the process of positioning as much as possible manually to avoid some of the overhead caused by GUILayuot.

I should have something ready this weekend.

It'll definitely cause problems with Contract Configurator. The stock app *never* refreshes the titles unless it gets a OnParameterChanged event (or a couple others). However, if those OnParameterChanged events queue up when the app is closed, it'll refresh itself fully (all contracts) for each event once it is opened (which I've seen cause lag anywhere from a couple seconds to 2-3 minutes where the screen is frozen). As such, I limit my use of OnParameterChanged (and can't use it for something like a simple title update).

So I wrote code that finds the underlying GUI elements and changes their labels directly when a title changes, which is a horrible and ugly hack.

For Contracts Window+, if you provide some sort of hook where I can call in to say a specific parameter has changed its title, I can add a call via reflection to that wherever I do my current hack for the stock app. That won't cover everything (as I rely on the fact that the stock app resets completely if one parameter changes), but it should catch 90% of the stuff in Contract Configurator.

Share this post


Link to post
Share on other sites

Version 3.3 is out; get it on Kerbal Stuff.

This update addresses several performance issues. Most of the problem was being caused by repeatedly requesting the contract parameter title from certain contracts. Some of them have complicated methods for generating those titles and this was really slowing things down.

The overall GUI code should be more efficient now, with more manual positioning of elements and less reliance on the slow, automatic layout functions.

Share this post


Link to post
Share on other sites

Awsome to hear that was super fast turn around on the problem. Either way this mod is so good i couldn't even uninstall it even with the former problems. I will post back with results

Share this post


Link to post
Share on other sites

Updated this and Contract Configurator mod and the FPS seems to be fine now, but I can't really say it is because of the update, because for some reason I lost almost all of my active contracts after the update. Only 3 active contracts are now in my list, but there was 10. Updated via CKAN.

Share this post


Link to post
Share on other sites
Updated this and Contract Configurator mod and the FPS seems to be fine now, but I can't really say it is because of the update, because for some reason I lost almost all of my active contracts after the update. Only 3 active contracts are now in my list, but there was 10. Updated via CKAN.

See this post in the ContractConfigurator thread (the issue is unrelated to Contracts Window+, but an incompatibility in the save format between Contract Conifgurator 0.5.12 and 0.6.0). I'll get a fix out ASAP, but it looks like it may not be until tonight.

- - - Updated - - -

Nevermind, did a really quick fix for that issue only. 0.6.1 is out, go to the Contract Configurator thread to get it. :)

Share this post


Link to post
Share on other sites

Not sure whether to post here or in the Contract Configurator thread, but will version 3.3 of CW+ conflict with CC now that the former implemented local caching in the new update? There was some discussion on the previous page in this thread about it, but it's not clear to me how/if that was resolved or what the ill effect actually are.

Share this post


Link to post
Share on other sites
Not sure whether to post here or in the Contract Configurator thread, but will version 3.3 of CW+ conflict with CC now that the former implemented local caching in the new update? There was some discussion on the previous page in this thread about it, but it's not clear to me how/if that was resolved or what the ill effect actually are.

See my response from the Contract Configurator thread:

I wouldn't say it conflicts, but there will be up to a 5 second delay in some parameters getting their title updated. DMagic has provided all the hooks I need to make it instant, I just need to do the updates on the Contract Configurator side. Those changes will be out in the next version, that will be released in the next couple days (depending mostly on how much free time I have). In the meantime, upgrading Contracts Window + will be at most a minor inconvenience for Contract Configurator contracts.

Share this post


Link to post
Share on other sites

Version 3.4 is out; get it on Kerbal Stuff.

This update addresses a few minor issues with updating sub-parameters; titles, notes and rewards (modified through the config window) are updated appropriately.

It also addresses compatibility issues with Contract Configurator when updating sub-parameters.

Share this post


Link to post
Share on other sites

Dear DMagic,

I told the Contracts Window to replace the stock button, at first it worked fine but then my game glitched and the mod disappeared. It shows in neither stock toolbar nor Blizzy's toolbar. Reinstalling the mod didn't help. Could you please tell me how can I reset the mod completely + delete all leftovers from my save.

Share this post


Link to post
Share on other sites
Dear DMagic,

I told the Contracts Window to replace the stock button, at first it worked fine but then my game glitched and the mod disappeared. It shows in neither stock toolbar nor Blizzy's toolbar. Reinstalling the mod didn't help. Could you please tell me how can I reset the mod completely + delete all leftovers from my save.

Do you have the log files for when this happens? That's a strange bug, but the stock toolbar is full of strange bugs, so it's not exactly surprising. Blizzy's toolbar is always my first choice. I'll see about adding a check to see if the stock contracts app is actually being replaced when that option is selected, so that it can at least fall back to using the regular stock toolbar button.

To fix this you'll have to edit your save file (make backups and don't complain to me if something gets broken :wink:).

Search for the section shown below in your persistent.sfs file. Switch the replaceStockToolbar = True to replaceStockToolbar = False (you can also set stockToolbar = false to switch back to Blizzy's toolbar), load up KSP, and it should be back to normal.


SCENARIO
{
name = contractScenario
scene = 7, 6, 8, 5
version = 1.0.3.3
allowZero = True
warnedZero = True
alterActive = True
stockToolbar = True
replaceStockToolbar = True
Contracts_Window_Parameters
{

Share this post


Link to post
Share on other sites

I reinstalled teh game from scratch and imported my save with your fixes. The window works again ) thx

Share this post


Link to post
Share on other sites

Hey DMagic I have what should hopefully be a very simple request. (my apologies if it's not)

Any chance you could remove the space from the mod folders name? Pretty please :D

I believe this is the source of my woes trying to get ATM to not touch the Contract Window textures.

The latest version of ATM now defaults to opt out instead of opt in. I have been trying to tell it to not touch the Contract Window folder but I believe the space in the folder name is causing it to be unable to specify the folder in a config file, I don't think ATM has any method for handling spaces (at least none that I know of, I tried the ? like what MM uses but that didn't work)

I know that I can go into the ATM settings cfg and change it back to opt in only, but with the large number of mods I am running I find it a lot easier to just let it do it's thing and then add opt out cfgs when I notice an issue, so far I have squashed all of the "conflicts" in my game except this one :(

Edited by Akira_R

Share this post


Link to post
Share on other sites
Can we get an option to sort and filter by SoI? That'd be awesome.
Hey DMagic I have what should hopefully be a very simple request. (my apologies if it's not)

Any chance you could remove the space from the mod folders name? Pretty please :D

No (for reasons that have probably been explained before) and yes, respectively.

I found an annoying issue, it keeps flipping contracts in the list every few seconds:

Pin the contracts, hide one or the other, or change the sort type.

I have several new additions to this addon in the works. I've made several changes that simplify things in some ways and allow for more customization.

There is now only one window mode, instead of one narrow and one wide; the re-size icon can be used to expand in either dimension. The contract rewards will only be shown if you expand the window horizontally, and you can choose to only expand the window enough to show Funds rewards, rather than having to show all types.

hUa7aYv.gif

I've also added the ability to create a save mission lists. There is a master list that contains all active contracts, from there you can add contracts to different mission lists or create a new list. Each contract has an icon in its title bar that opens up the mission list. An icon along the top allows you to switch between lists. Contracts can be added to more than one list (they are never removed from the master list), and their settings (whether their parameters are shown or if they are pinned to the top of the list) are stored separately for each mission. You can remove contracts from any other mission, or you can delete the mission entirely. The sorting order and type for each mission is also saved separately.

mDtp7KP.jpg

There are still a few kinks to work out, but everything is mostly working correctly.

Share this post


Link to post
Share on other sites

Where does this mod store its configuration? My install got a bit wonked up and.I can't figure out how to get it back. I'd set it to replace the stock contracts window, but it's since gone missing (the stock window is there but the CW+ isn't, nor are any of its toolbar icons.

Edit: Nevermind, it's buried inside the save file (and all quicksaves), making extracting it quite annoying.

Edited by StarkRG

Share this post


Link to post
Share on other sites

Version 4.0 is release; get it on Kerbal Stuff

Warning: File and folder names have changed. You MUST fully delete all old installations before updating

The primary difference is the new mission lists described above. Contracts can be added to separate lists now, each list is persistent, and contracts can be added to as many lists as you want.

The contract reward modifier section has been improved and separated into its own addon; [THREAD=113277]check it out here[/THREAD].

Check the first post for a complete changelog and description of the new version.

Edited by DMagic
Installation warning

Share this post


Link to post
Share on other sites

FYI, the space that you took out of the folder name means that KSP-AVC isn't detecting the updated version. Only way I know of to handle that is to just keep the old directory around in your source tree with an updated .version file for a while until people upgrade.

Share this post


Link to post
Share on other sites

With 4.0 when I have 2 contracts of the same name, say "Perform Visual Surveys of Minmus" they swap positions every so often, looks like every time the window is updated.

Share this post


Link to post
Share on other sites

Is it possible and/or planned to make a selected mission list persistent to a craft?

Having to reselect the mission every time I bounce between crafts during a comm network mission is getting tiresome.

Share this post


Link to post
Share on other sites
Hi DMagic,

awesome mod. But would it be possible to give it a more KSP-like UI design? Kerbal Alarm Clock would be here a very good example.

This is one of those things that's been on the list for a long time, but I'm in no hurry to get to it. The KSP UI isn't quite as compact as the Unity UI, so everything would have to be adjusted again.

Contracts Window + uses a lot of manual positioning of UI objects, changing to the KSP skin would likely require re-positioning of all of those objects (twice, since changing the UI scale also requires adjusting the position of basically everything) to make sure they stay compact and aligned correctly.

The window is designed to stay open all of the time and not take up more space than necessary, so I make it as compact as possible and try not to draw UI objects unnecessarily (ie. not drawing rewards when the window isn't expanded). This means I can't use Unity's automatic layout system and have to position most objects manually, meaning specifying exactly which pixel each object is positioned at. Doing that four times is not something I look forward to.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now