Jump to content

Kerbdometer v0.9 (w/ Toolbar)


O-Doc

Recommended Posts

TL;DR - Hello world script that shows frames per second in top right corner.

Download:

So, I've been putting off installing mods into KSP for this exact reason. Yesterday I dumped a couple of dozen modules into a fresh KSP install. The goal is to pretty up the game enough to invite my film crew onto the set. Today has been spent learning how to mod so I can get an objective FPS readout as I strip out each mod to figure out the offending code and textures. Yep, that only took 12 hours to go from user to developer. :(

The next step will be to explore the KSP mod ecosystem with Toolbar and Module Manager integration. Then, we'll look at a generic API for modules to plug into this module for performance profiling using these three libraries:

Changelog:


0.2
Simple FPS display

0.4
* Added Blizzy's Toolbar integration, now required
* Temp bug fix for FPS growing when gui is not drawing

0.6
* Added draggable GUI window
* Added GUI persistence
* Added system collection data
* Updated toolbar icons

0.8
* Added loaded objects counter
* Added GUI skin to config
* Added persistent toolbar toggle

0.9
* Set window resize to event gui change events

Enjoy!

EDIT: Uses the Aleister Crowley License: "Do what thou wilt".

Edited by O-Doc
Link to comment
Share on other sites

Please publish a link to the sourcecode, or embed it with the package.

And, to show the license you chose for this with the opening post (not only in the package). That all as required by rule 5.2.

When both the above are met, feel free to restore the download link. I look forward to being able to use this.

Link to comment
Share on other sites

There's already a mod for this. I think it's called 'ShowFPS'.

Update: Phew, found it! I thought I was going crazy there for a minute, even though I have it installed in my game right now, lol. :confused:

Anyway, I thought that I'd gotten it off of this forum, but apparently not. I remember (now, after the fact) browsing on the new CurseForge a few weeks ago, and I stumbled across this, so I figured 'eh, why not?'

Here's the link: http://kerbal.curseforge.com/ksp-mods/220663-showfps

I guess it's something adapted from Linux to work on Windows. Or at least KSP for Windows. :)

So, there you go. Sorry if I'm stealing your thunder, O-Doc. But hey, maybe yours will be better, I hope you don't get discouraged. Later everyone. :D

Edited by Neutrinovore
Additional information
Link to comment
Share on other sites

Please publish a link to the sourcecode, or embed it with the package.

And, to show the license you chose for this with the opening post (not only in the package). That all as required by rule 5.2.

When both the above are met, feel free to restore the download link. I look forward to being able to use this.

OK, I've packaged the source code. And modified the OP to include the license information, I thought I could get away with cramming that stuff into the download itself. :)

There's already a mod for this. I think it's called 'ShowFPS'.

Update: Phew, found it! I thought I was going crazy there for a minute, even though I have it installed in my game right now, lol. :confused:

Anyway, I thought that I'd gotten it off of this forum, but apparently not. I remember (now, after the fact) browsing on the new CurseForge a few weeks ago, and I stumbled across this, so I figured 'eh, why not?'

Here's the link: http://kerbal.curseforge.com/ksp-mods/220663-showfps

I guess it's something adapted from Linux to work on Windows. Or at least KSP for Windows. :)

So, there you go. Sorry if I'm stealing your thunder, O-Doc. But hey, maybe yours will be better, I hope you don't get discouraged. Later everyone. :D

That's great, someone has the same problem + solution I had. To be honest, I searched for only about half an hour for this. I could have searched harder but, it was as good an opportunity as any to make a hello world type mod from tutorial code.

The main idea thread I'm going to follow with this plugin is generate runtime graphical data to compare resource consumption of all my installed mods, and maybe the game itself. I have one or two mods installed which are grinding the gears of my machine, while, all the others seem OK. I'd like to know where the bottlenecks are so I can decide if I can do without those mods.

Link to comment
Share on other sites

OK, I've packaged the source code. And modified the OP to include the license information, I thought I could get away with cramming that stuff into the download itself. :)

That's great, someone has the same problem + solution I had. To be honest, I searched for only about half an hour for this. I could have searched harder but, it was as good an opportunity as any to make a hello world type mod from tutorial code.

The main idea thread I'm going to follow with this plugin is generate runtime graphical data to compare resource consumption of all my installed mods, and maybe the game itself. I have one or two mods installed which are grinding the gears of my machine, while, all the others seem OK. I'd like to know where the bottlenecks are so I can decide if I can do without those mods.

Right, excellent, ShowFPS doesn't do any kind of logging or anything like that. Literally the ONLY thing it does is put a little display in the upper right corner of the screen (inconveniently placed to be covered up by an opened 'Resource' panel, btw) showing the current fps rate. It's strictly on/off, no settings, no options, nuthin'. :)

So, good, your plugin will better serve your needs than ShowFPS could ever do.

Although, I suppose you could peek at the source code. I don't know what that license is, but if it's not too restrictive you may be able to adapt, or at least learn from that code, then you wouldn't have to start from absolute zero. :)

Anyway, my work here is done. Good luck in accomplishing your goals, O-Doc.

Neutrinovore out. :D

Link to comment
Share on other sites

Installed and running this addon. Very good, absolutely effective and not obtrusive at all :).

Just one weird thing: when the game is paused, fps shown grows very fast to figures not believable.. possible that a variable is not refreshed (e.g. elapsed time between frames) and the math is then inaccurate?

Link to comment
Share on other sites

OK, I'll do my own logic once I get the toolbar integration done. The script is being called in OnGui() not Update() so the counter is tied to the gui draw not the gameplay frames. This is my first poke at Unity scripting so expect a few of these issues in early releases. :)

Thanks for the feedback, very useful.

Link to comment
Share on other sites

OK, I'll do my own logic once I get the toolbar integration done. The script is being called in OnGui() not Update() so the counter is tied to the gui draw not the gameplay frames. This is my first poke at Unity scripting so expect a few of these issues in early releases. :)

Actually, knowing if gui frames are not getting drawn at the same rate as gameplay frames would be interesting in itself.

Link to comment
Share on other sites

Actually, knowing if gui frames are not getting drawn at the same rate as gameplay frames would be interesting in itself.

That's a great idea. I can see how that would be very handy.

Link to comment
Share on other sites

Next version is ready. I've done a rudimentary integration with Blizzy's Toolbar(now required) and a cheesy hotfix for that issue when the game is paused. I may decouple from the toolbar in the future, when I learn how to add buttons to the interface and do resource juggling, lulz.

Link to comment
Share on other sites

  • 3 weeks later...

nice mod. and still works in 0.24

But would be nice if you could move the counter somewhere else. We have the new Toolbar now and the counter is exactly over it.

Or make the counter movable like in the Advanced Navball Mod.

Link to comment
Share on other sites

  • 2 weeks later...

Sorry guys, I missed these posts. I'm having a look at doing short stretch goal today of making the next version. So, source code will go up on github.

Planned features:

Actual UI window for the mod

Graphs to track FPS, memory, Game objects by type

Additional mechjebby chart options like altitude, speed, etc

We'll see how we go today. :)

Link to comment
Share on other sites

Well, I found out I had other plans this weekend so, I didn't get to the graphing functionality. I did manage to find handful of hours to learn more about the UI stuff and get the plugin into a proverbial box. :)

So, I'll put graphing into the v1.0 release target along with the collections data, once I have more time to refactor code into some factories with interface flags, etc. In the mean time, I'm trying to keep the code as simple as possible while learning this whole Unity stuff.

Link to comment
Share on other sites

  • 2 weeks later...

Just a very quick update;

I've refactored the code to take care of the window size reset issue which makes the window disappear at very low frame rates. It's now gone onto an event delegate. More refactoring to come when I do the graphs. I'm also going to think about how the GUI is going to look like moving forward.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

×
×
  • Create New...