Handmade Hero»Forums»Code
Daniel Bartholomae
2 posts
Deadzone for controller is not square, but cross?
Hi there,

I just finished day 17 and was wondering about the dead zone for the stick. The way Casey drew it, the deadzone is a square, but the way I think the code works, it is a cross:
When the stick is out of the Y deadzone, it might still be in the X deadzone, so if I fully push the stick to maximum Y and X approximately 0, then wiggeling the stick a little bit won't do anything to X, as it is in the X deadzone.

Has this already been discussed in a later episode?

Best,
Daniel
Mārtiņš Možeiko
2242 posts / 1 project
Deadzone for controller is not square, but cross?
This totally makes sense to me. It is not discussed later episodes.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Deadzone for controller is not square, but cross?
It depends on what you mean by "deadzone". It is a square if you mean "region where the stick does not do anything". It is a cross if you mean "region where at least one of the axes of the stick does not do anything".

We haven't dealt with this yet, it's definitely something we'll do later, but having reflected on it, I am now very certain that the way we did the handling is correct, and that a "radial" deadzone would not be better for this game. But, that said, we are going to show some testing of this, and some visualization, and we will make the final decision based on what that reveals!

- Casey
Daniel Bartholomae
2 posts
Deadzone for controller is not square, but cross?
Hi Casey,

thanks for your quick reply. I was just wondering because from my experience for most games if I e.g. push the stick forward and then move a little to the left or to the right, this affects the movement of my character - which would not happen with an implementation like the one we currently have.

Furthermore I just found a source that says the dead zone should be a circle:
https://msdn.microsoft.com/en-us/...17001%28v=vs.85%29.aspx#dead_zone

The implementation example in this article uses a circle.

Best,
Daniel
Mārtiņš Možeiko
2242 posts / 1 project
Deadzone for controller is not square, but cross?
That article only shows example how to implement circle dead zone. It doesn't say what kind of dead zone is actually used in hardware.
Oliver Marsh
177 posts / 1 project
A budding game developer and programmer
Deadzone for controller is not square, but cross?
Edited by Oliver Marsh on
What I understood was that, if the hardware processed the movement as a square and we process it as a circle, we will include noise into our character movement when we are not moving since we are not ignoring all the deadzone area, whereas if the hardware processed it as a square and we process it as a circle, we will be throwing out valid movement data.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Deadzone for controller is not square, but cross?
So, again, we'll cover this later in the series, so I won't go into too much detail here, but the two ideas are:

1) Regardless of what the hardware does, since this is a four-way movement kind of game, you want to bias the movement of the character to be along the four directions regardless, so the "cross pattern" is actually desirable even if it is not the more accurate of the two, and

2) Based on looking into the hardware (which I did subsequent to the original stream), I have a suspicion that we will find that the shape of the hardware noise profile actually is rectangular. Now, you could argue that Guassian-wise you're still better off with a circular deadzone "on average", but I am a "worst case" kind of guy so I still feel like that argues for a rectangular deadzone, and if you want to fix problems that that will cause, the better way is to do a dynamic fix and not to pretend the deadzone is circular.

But, for #2, I would like to wait and see what our investigations indicate when we dig into this for real. I will have more to say about it once we actually collect the data!

- Casey