# Debounce Logic for the tilt switch

I’m curious if debounce logic has ever been shared. I notice a difference between B/W, Stern, and JJP when compared to Spooky and Heighway. I brought this up recently with Fawzma (Rob Zombie programmer) on his facebook page, and he said:

Game is going and the tilt bob triggers.. tilt warning appears and a 3 second timer starts. If the title swings around and hits, you won't get a tilt while that timer is running. When that timer runs out and the tilt triggers again, you get a 2nd warning, and another 3/5 second grace period. 3rd hit is a tilt/drain.
In AMH, the code (open source) is a bit different I think, depending on cycle timer::

int cabSwitch(unsigned char switchGet) { //Read a dedicated switch. If switch is on and debounce is off, returns a 1, else 0
if (cabStatus[switchGet] == cabRampDBTime[switchGet] and cabDebounce[switchGet] == 0) { //Has switch been on for its minimum time, and has debounce reset?
if (cabStatus[switchGet] == cabRampDBTime[switchGet] and cabDebounce[switchGet] == 0) { //Has switch been on for its minimum time, and has debounce reset?
cabDebounce[switchGet] = cabDBTime[switchGet]; //Set switch timer to its standard debounce from the table
return 1; //Return value of switch bit. The only way 1 will be returned is if Debounce has reset.
}
else {
return 0; //If timer not yet reset, return a 0.
}

unsigned short cabDBTime[ ]’ = {200, 200, 200, 200, 200, 200, 200, 200, //unused, Door, User0, RFlip, LFlip, Menu, Enter, Coin

18000, 2500, 7500, 200, 200, 5000, 7500, 200,}; //Tilt, ghostOpto, doorOpto, unused, Start, ghostOpto, doorOpto, unused

This explains pretty well what I’ve seen - is that the way the others do it? Other pins FEEL different so my guess is no, and that it might have something to do with the rate of the switch registering, but not sure.

1 Like

That sounds insane btw. 6 straight seconds of slide save on every ball
Debounce is traditionally implemented to disregard all of the additional closures of a switch that the software would register on a single switch closure (theres a lot of on/off going on even when you press a switch once). I’ve always assumed that for the tilt switch there is a bit of extra dampening, perhaps in the range of 100ms for a wpc95, but 3000ms sounds way off base.

You do see differences in the same manufacturer though. BSD and DWHO appear to have the same generous debounce code versus other wpc games - which might make sense as afaik, they have the same designer and programmer.

You’d think, but that dang bob will keep moving for a long time! What happens in RZ is that you make one big move (not even a slide) and you get a warning, then 3 seconds later you get a warning, then 3/5 second later its TILT! The programmer also suggested that some other pins had more beefiness in the cab construction to dampen the bob, but I’m not sure what I think about that.

That’s more of the approach in AMH - a straight 18,000 cycles - opposed to 200 for most switches. I still wonder if there was more in some other games. I had forgotten about BSD/DW, but I’m still willing to bet it’s different.

The Heighway approach is similar to that of the RZ algorithm you posted, except with shorter timers. I think this is close to the Bally/WMS approach too, aside from WHO and DRAC.

The difference with WHO and DRAC is that their backoff timer restarts on every closure, so you keep getting a fresh 2-3 sec grace period with every activation. I don’t know of any other games that have this.

The AMH code doesn’t make any sense to me. It seems to be mixing debounce and backoff into a single timer.

1 Like

Is the on the second danger only? I always thought when making a big, continuous move you were committing to a double danger, but the game would not tilt due to the debounce. The other thing I love about BSD is that the double danger during outlane loss kills your bonus even if you don’t tilt.

I never understood why people liked this bug. (And you’re not the only one, so I’m really not trying to pick on you.)

If you don’t get awarded your bonus, that result is indistinguishable from a tilt. This is why we have tilt warnings and tilts and they’re different things.

1 Like

imo, people like it because it adds an additional landmine/scenario of risk/reward to a ball with a significant bonus. How you behave to not danger is much different to how you behave to not tilt, including when the punishment only occurs when you danger while draining.

Additionally, imo, there is an element of suspense during the drain animations where you are shown weather or not you will get your bonus - its not clearly binary what will happen when the ball hits the trough.

3 Likes

Added a “like” for your detailed and reasonable explanation. Not because I’m swayed.

1 Like

Cayle’s reply captures my reasons better than I would have written. I would add a couple things. 1. It discourages rage dangers (they are the rage tilt’s annoying little brother). 2. Really satisfying to win an LTD because your opponent make this mistake and lost their bats. I would hate to win a tournament that way, but LTD’s with baseketball style psych outs makes my day.

Don’t forget about the desperation mist magnet shakes. I have my tilt set so that a magnet save is giving 2 dangers and sometimes flipping the flipper to early will result in a tilt. I love watching the “please don’t tilt!” pause after a big move during a competition. The suspense and crowd reaction is always fun to watch.

Along the same lines, has anyone else noticed that the switch matrix on Spike games seems to be more responsive than SAM? On GOT, it’s common to get credit for two rollovers in the top lanes with a quick lane change, much like you can do on Drac. Don’t see that much on SAM games. A pleasant surprise. Is it just me, or has anyone else noticed this?

That’s insane.

That was the conclusion I was coming to, too.

At JJP, I thought the backoff/cooldown was 1s, but it’s actually more like half a second. My comments would indicate that this is a bug. Should probably make it a bit longer than 1/2 second.

I just wanted to say that I think this might be my favorite thread since we launched.

5 Likes

Does anyone know if any modern manufacturer has trialled (and then presumably rejected) the idea of using digital tilt bobs? Ie, a motion sensing device, similar to as seem on mobile phones etc?

Strikes me that this kind of digital tilt would be much easier to set up and adjust (eg automatically rebalance in software), and as a result give a fairer judgement. Can’t imagine it would be expensive either?

Stern has filed a patent for this kind of thing, from what I’ve read. (Link added below)

These sensors no doubt cost very little for phone makers and big electronics companies that buy them in huge quantities. The price for “just” a few thousand might not be nearly as attractive.

I agree that it’s very promising, and I can’t imagine it won’t happen at some point down the road.