Jump to content

MechJeb not deterministic depending on FPS


Chris_C

Recommended Posts

While my laptop isn't a slouch it certainly doesn't have a power house for a gpu... that said it can play KSP fairly well with very modest settings.

Having taken a break from KSP (I know can you believe it...real life, sooo inconvenient sometimes!) The new update prompted a look see.

MechJeb was behaving rather poorly, but obviously before posting some vague useless and time wasting "it doesn't work" issue on the tracker I though I should investigate further and gather as many clues as I could - see if I could find anything in logs etc... First port of call was reproducing the various issues on another machine, get it onto my desktop and it behaves like an absolute dream...

It then dawned on me that most of the input to MechJeb probably happens at intervals ie once every frame probably, given the nature of the calculations - there will be very large differences in output in different input intervals are used... If you've ever played with physics libraries changing the number of iterations in solvers or the frame rate will usually have massive impact for similar reasons.

This is no doubt obvious to the developers, however I posted here as its not obvious to less technical but avid KSP / MechJeb users.

I do wonder how many "issues" on MechJebs tracker at at least partly if not wholly caused by systems running at low frame rates - I wonder if MechJeb shouldn't dump FPS to the logs every 5-10 seconds (maybe even have a debug mode you must use before having an issue accepted....yeah like people would use that....)

 

Link to comment
Share on other sites

Actually, Unity provides an operation that runs at a fixed physics simulation time (20ms of game time). When the ingame time turns yellow or red, Unity is slowing down the progression of game time so it can maintain this simulation interval. The physics simulation is run seperately to the displayed frames (you can have any number (0, 1, 2, 3...) of physics frames per rendered frame)

Unless I'm mistaken, physics warp is the only thing that modifies the simulation step (hence the wierd stuff that happens only during physics warp)

Edited by Crzyrndm
Link to comment
Share on other sites

I was implying that MJ runs any vessel control updates during the unity physics update, ie. at a fixed timestep, as does any other mod doing anything that relies on using a constant timestep

Edited by Crzyrndm
Link to comment
Share on other sites

43 minutes ago, Chris_C said:

Which doesn't happen exactly every 20ms if an underpowered system is being used....

It's 20ms of game time, not real time. If the system can't keep up with real time (i.e. the timer turns yellow), the physics ticks are still 20ms of game time. The only thing that changes that ever is using physics warp. Whatever is causing issues on your underpowered system isn't variable-length physics ticks.

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...