Jump to content

Physmod5 With "ball Flying Off Table Fix"


DJRobX

Recommended Posts

I love PhysMod5 but the balls disappearing bug can be a bit of a buzzkill. 

 

When I was working on a PhysMod5 mod I noticed that a small dividing wall would cause the ball to fly off the table when it shouldn't.    I created a simple  table with a little wall in the launch path that duplicates the problem quickly.   I then loaded this into the upcoming VP10 to see if the bug was fixed there. 

 

That bug is not fixed.  The ball still goes through the wall as if it didn't exist - BUT - the ball does not fly off the table.   So, I did a diff of the VP10 and VP PhysMod5 sources and noticed that the VP10 version has some code that limits the ball in the Z dimension to the glass and the bottom of the table.   I applied this change to PhysMod5 and voila - a PhysMod5 that doesn't send the ball off the table. 

 

I've attached this modified PhysMod5 along with the bug fix demo if you want to give it a try.   FYI - This version writes its registry to the key: Software\Visual Pinball\PM5\

 

 

vpinball-pm5.zip

Link to comment
Share on other sites

Okay, here's a build of VP PhysMod5 with the following;

 

1) Z-limit to prevent balls from falling off the table

2) VP 9.1.1 bug fix changes included (with the exception of the "nudge filter")

3) Workaround for Monster Bash problem.   Now the friction will be set to the playfield friction if the object is named "Playfield" (or starts with "pffrict").   CK kindly sent me his test MB table and it seems to play very well. 

 

https://www.dropbox.com/s/ryec2d6558sugq2/vpinball-pm5.0.1.zip?dl=0

 

 

You should report this to Toxie! Otherwise the bug will remain in VP10...

 

Yep I did.   I posted a VP10 sample that reproduces the issue in the "Road to VP10" topic.  If I don't see any replies, I'll PM toxie to let him know it's there.   

 

 

Which Physmod5 version did you used for the patch? The original one or the already patched one from mjr with the the new nudge settings?

 

 

I'm working off of Mukuste's original PM5.   I have not seen or used MJR's version, so I have no idea what it does or where to get it.   If someone wants me to include that please point me at the code.  I am also happy to share my changes with MJR if he wants to handle it that way.   

Link to comment
Share on other sites

I tried to read through mjr's nudge filter thread but there's sooo much stuff that I quite didn't get everything... so is that solution tied to the "freescale board" (so it's only for specific hardware)?

 

The reason I'm asking is that I already have the Virtuapin Kit V2 and I implemented my own nudge limiter to VP for PM5. I shared that with Fuzzel and it's also part of the VP10 trunk now (This was in July). 

 

Here's the PM I sent to Fuzzel about the code changes and it would be great to have these changes in this "fixed PM5" as well (unless mjr's filter has the same possibility... after reading part of the thread I'm just not sure).

 

Personally I really can't use my plunger kit without this limiter anymore :)

 

 

 

A while ago I requested for a "analogue nudge limiter" in the VP10 ideas thread. My goal was to eliminate random crazy nudges.

 

I downloaded mukuste's physmod5 from github and started experimenting (after some hours of head scratching before I got it to compile smile.png). I noticed that in average the accelerometer was returning values around 50-250 (virtuapin plunger kit). However randomly the value jumped to over 800-900 with a similar nudge. And this was causing the balls to fly all over the place.

 

I came up with a very simple solution for limiting this behaviour, And after some test I can at least say that it works perfectly for me!

 

I modified the player.cpp and added 2 keys to registry. PBWAccelMaxValueX and PBWAccelMaxValueY -> these can be between 0-1000 (I noticed that 1000 is the max joystick range in VP). And then I only added simple logic to ultranudgeX and ultranudgeY functions that eliminate values that are more than the limiter. All my code changes are listed in the quotes below. I haven't ever done anything with c++ so variables are probably in the wrong places etc. but the main thing is that those supernudges are now history for me! 

 

Quote

 

int m_tblAccelMaxX; // Max X value that is registered from accelerometer (for example value of 200 only registers hits up to 200 instead of default 1000)

int m_tblAccelMaxY; // Max Y value that is registered from accelerometer (for example value of 200 only registers hits up to 200 instead of default 1000)

Quote

// fetch new keys from registry
int tmp;
 
hr = GetRegInt("Player", "PBWAccelMaxValueX", &tmp);
if (hr == S_OK)
m_tblAccelMaxX = tmp;
else
m_tblAccelMaxX = JOYRANGEMX;
 
hr = GetRegInt("Player", "PBWAccelMaxValueY", &tmp);
if (hr == S_OK)
m_tblAccelMaxY = tmp;
else
m_tblAccelMaxY = JOYRANGEMX;
 

Quote

void Player::UltraNudgeX(const int x, const int j )
{
int x2 = x;
 
int minVal = m_tblAccelMaxX*-1;
if (x > m_tblAccelMaxX){ x2 = m_tblAccelMaxX; }
if (x < minVal){ x2 = minVal; }
 
m_curAccel_x[j] = x2;
}
 
void Player::UltraNudgeY(const int y, const int j )
{
int y2 = y;
 
int minVal = m_tblAccelMaxY*-1;
if (y > m_tblAccelMaxY){ y2 = m_tblAccelMaxY; }
if (y < minVal){y2 = minVal; }
 
m_curAccel_y[j] = y2;
}

 

Now I can set the gain relatively high (so that I don't have to rock the cab insanely to get any nudge results) but I can still control the max nudge to keep it real (in my last tests I set the maxX value to only 150).

 

Link to comment
Share on other sites

  • Content Provider

I think some of the flipper settings were changed a bit in vp 10. Not sure though.

with mb you can set the friction for walls where as in phymod5 it was hard coded for walls and many other objects. Not sure what else was changed in your compile, but i know quite a few of the script commands have changed also _hich will cause errors in the script.

and many of the objects have changed +uite a bit

Link to comment
Share on other sites

I think some of the flipper settings were changed a bit in vp 10. Not sure though.

with mb you can set the friction for walls where as in phymod5 it was hard coded for walls and many other objects. Not sure what else was changed in your compile, but i know quite a few of the script commands have changed also _hich will cause errors in the script.

and many of the objects have changed +uite a bit

 

The only thing I took from VP10 was the Z-limits.   The rest is from VP9.9.1.   The "Monster Bash fix" is a small hack to change the "playfield" object to carry the playfield friction setting, it otherwise leaves things at the hard-coded 0.3 value (as not to break backwards compatibility). 

 

There is something wrong with the new physmod 5.1. Suddenly physics behaves strangely, flippers settings are not recognized correctly anymore, some other strange behavior.

 

I'm reverting back to "official" PM5 until this is fixed.

 

 What do you mean by "not being recognized correctly", specifically?   Trying to reproduce the problem but haven't been successful so far... 

Link to comment
Share on other sites

I tried to read through mjr's nudge filter thread but there's sooo much stuff that I quite didn't get everything... so is that solution tied to the "freescale board" (so it's only for specific hardware)?

 

The reason I'm asking is that I already have the Virtuapin Kit V2 and I implemented my own nudge limiter to VP for PM5. I shared that with Fuzzel and it's also part of the VP10 trunk now (This was in July). 

 

Here's the PM I sent to Fuzzel about the code changes and it would be great to have these changes in this "fixed PM5" as well (unless mjr's filter has the same possibility... after reading part of the thread I'm just not sure).

 

Personally I really can't use my plunger kit without this limiter anymore :)

 

Got it - I also have my own "filter" around nudging to deal with the mot-ion's board's calibration drift issues.  :)   Looking at MJR's code, it's hardware agnostic, and may solve both of our problems.   I'll work on getting that integrated first, then if we still need our "old" filters I'll add both of them (optional with registry keys).  

 

-- Rob 

Link to comment
Share on other sites

 What do you mean by "not being recognized correctly", specifically?   Trying to reproduce the problem but haven't been successful so far... 

Flipper finger physics behave strange now (sometimes the ball just stops on the flippers without bouncing back), sometimes the bouncing is too much (start the physmod of Whirlwind - if the ball is leaving the left scoop and you press and hold the left flipper it bounces back that strong that the ball rolls back into the left scoop - this goes on and on!).

 

It seems you did not only use the code of PM5 and add things from VP991 - there must be something different you added influencing the physics!

Link to comment
Share on other sites

Flipper finger physics behave strange now (sometimes the ball just stops on the flippers without bouncing back), sometimes the bouncing is too much (start the physmod of Whirlwind - if the ball is leaving the left scoop and you press and hold the left flipper it bounces back that strong that the ball rolls back into the left scoop - this goes on and on!).

 

It seems you did not only use the code of PM5 and add things from VP991 - there must be something different you added influencing the physics!

 

Thanks - I will try Whirlwind and see if I can reproduce with that. 

 

Do you have analog nudging in your cab by chance?  It might be something in the VP9.9.1 stuff I incorrectly merged.    As we're finding out the 9.9.1 seems to incorporate MJR's code, but I did not fully port that portion since there are differences in the way VP9.9.x and VP PhysMod5 handle nudging.   Once I see the issue I will figure it out.  :) 

Link to comment
Share on other sites

I tried the PhysMod5 whirlwind and it seems completely normal on my system.   Remember that this version of VP writes its registry to a different key.    If you have a dead zone set in your nudge configuration you'll want to set it again in this version.   Overly sensitive nudging can cause weird physics behavior like you described.

 

If that doesn't work can you try the VP version from the first post and see if it has the same wrong behavior?   That version is before I merged in the 9.9.1 fixes but still uses the different registry key.   We can try and narrow it down that way.   

 

Are others seeing physics problems as well?   

Link to comment
Share on other sites

Could you post a quick vid showing this? I am running DJ's mod and have not been able to replicate it either.

 

Flipper finger physics behave strange now (sometimes the ball just stops on the flippers without bouncing back), sometimes the bouncing is too much (start the physmod of Whirlwind - if the ball is leaving the left scoop and you press and hold the left flipper it bounces back that strong that the ball rolls back into the left scoop - this goes on and on!).

 

It seems you did not only use the code of PM5 and add things from VP991 - there must be something different you added influencing the physics!

Link to comment
Share on other sites

The reason I'm asking is that I already have the Virtuapin Kit V2 and I implemented my own nudge limiter to VP for PM5. I shared that with Fuzzel and it's also part of the VP10 trunk now (This was in July). 

 

I've implemented your nudge filter, my nudge filter, and MJR's nudge filter.   Interestingly, none of them appear to be mutually exclusive. 

 

Yours is a high-limit.

Mine is an offset filter (periodically recalculates the centers).

MJR's seems to smooth out the overall responsiveness.  His filter detects, but does explicitly does not attempt to correct, center drift:

 

 

        // More than 500 ms in motion with same sign - we must be

        // experiencing a gravitational acceleration due to a tilt

        // of the playfield rather than a transient acceleration

        // from a nudge.  Don't attempt to correct these - clear

        // the sum and do no further processing.

 
I verified that MJR's accelerometer code is there too.  That got ported over with the 9.9.1 stuff correctly. 
 
The current build I'm testing is here if you want to give it a try:
 
 
One thing to keep in mind that MJR's code changes JOYRANGEMX to 2048 to improve precision.   So you may need to double the PBWAccelMaxValueX value that you were using previously. 
Link to comment
Share on other sites

Cool. Thanks. I will give it a try later today.

 

Quite interesting that all 3 solutions are looking to fix different things in the nudging / calibration :)

 

My "high-limit" filter needs new registry keys to be enabled (I can share my script for adding those keys later once I'm on my home computer). How about these other filters? How are those enabled or are they enabled by default with this new version?

Link to comment
Share on other sites

Yep.  Remember that this version writes to the Visual Pinball\PM5 key. 

 

Currently they are all enabled.    Yours has no effect if not set in the registry, and mine won't impact anything if your analog nudging is even close to being calibrated properly (it has to be REALLY out of whack for a sustained period of time, which is only likely to happen if you have a Mot-Ion board :) ).

 

The next step will be add the enable/disable toggles and settings to the UI.  Then you'll be able to change your max limits without going into regedit.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...