Food Fight - joystick troubles, solved
-
Hard coding wont make a difference it doesnt even work right in current mame or fbneo with an analog joystick. The game mechanics need looked at to see what going on with it for sure. The analog values are reading properly anything else apart from checking what the code is doing would be guessing to be honest. And if you start messing with random values it will just re-calibrate during play it calibrates as your playing as well. Chance your key sensitivity to 1 and youll see just the eyes move if you keep the button in longer the character will eventually move that how digital analog works you decide how much time it takes to increase. If i was as simple as hard coded values someone would have fixed it by now. Truth is you would benefit from a real cab to see how it plays I get a feeling it just the high precision throw the joystick gives to let you pull this off again just a guess. Its actually a really small driver if your interested in looking into it
-
I've been testing this a lot.
With centering off, the movements stay active after you release. So if you hold left then hold up. He continues to move left as he goes up.
With centering on, the movements only go where you want them to. So if you hold left then hold up he'll stop going left then go up. This is more like it should be.
Unfortunately, setting "current" to the default value will stop his active movements but change his facing direction to be fixed which isn't right.
Maybe we need to use centering to decelerate the "current" value instead of setting it to default?
Displaying the "current" value on screen could be helpful for testing here. The ability to set/adjust the "current" value when centering could be helpful to test different values.
-
Ill tell you what use current mame for your experimenting it has all the options you need to test your theory. If you manage to get something reproducible let me know the steps to do it.
the default center is set in the driver to 0x7f all analog controls need to know where the center is so it sets it to that vale when your analog stick is at center. If you want the driver to center the joystick you would add IPF_CENTER flag to the driver normally.
There really is no need to do this with an analog joystick at all thats why this works without the patch in mame it just reads the position. This patch doesnt effect the real analog controls at all.
Now there something you need to get clear this happens in analog and digital to analog when centering . This patch doesnt effect a real analog joystick only digital it working the same way the analog is at the moment its facing a side when centered just like mame current is.
-
Tested more games with centering confirmed to work now:
Roadrunner
PaperboySo for food fight it seems:
Vertical range is from 0x0F through 0xEF
Up is high limit at 0xEF
Down is low limit at 0x0FHorizontal range is 0x0F through 0xEF
Left is high limit at 0xEF
Right is low limit at 0x0FSo hypothetically 0x7F should be center but obviously were getting right. For this I have two ideas:
- Rounding issue.
- Perhaps the value needs set for each direction, 1 place in each direction.
Idea 1 - easiest to test, try:
Current = 0x80Idea 2 - you'd have to set horz and vertical independently based on the last direction pressed.
Could you test idea 1 out? If it's just a rounding issue we would just need an option to set the default value to be compatible, on top of your current centering fix.
-
the default value is set here feel free to change it (0x7f) https://github.com/libretro/mame2003-plus-libretro/blob/0134c428b75882aa474f78dbbf2c6ecde49b97b7/src/drivers/foodf.c#L251-L260
changing this value just changes the way your character will face.
-
Changing which value do you mean?
I'm not really familiar with changing things in mame/ compiling either. But it seems like the solution is here between the center values set in foodf.c and the center value in your centering fix.
-
Maybe not relevant but I noticed in the service menu of roadrunn the center of the stick is 80 too
-
setting it to 0x80 doesnt fix the issue for foodf
-
When you say "it", which value did you change to 80? The driver or the centering fix? Which way did he face with the change? Left or left up?
-
Im a bit lost now are you using a digital or analog stick for your testing ?
The auto centering fix just sets the center to whats set in the driver the same applies to real analog stick it centers to whats set in the driver. This fix has no effect a real analog stick. The center is set to 7f in the driver
-
Sorry, I'm messing with both the driver and your fix using a digital controller.
I was seeing if manipulating the center changes anything. One things for sure this could be fixed by changing the fixed center position based on the last direction pressed. That way your centering value always tips in favor of the direction last touched.
-
thats probably ok for digital wont help analog controls it probably wants a certain range. I have messed about with it. I really think this driver would work properly and a analog controller with a bigger throw for more precise movement. Ie slight circles would let you shoot round without moving.
I dont have any type of gimbal analog devices to test it though. A u360 would be handy to test this stuff on but i dont have one.
I better explain this a little better imagine you added a 30cm shaft to a xbox360 controller you could get more fine movements on it and easily move the just the eyes doing a small circle
-
I've read that someone increased the sensativity to 125% and had some luck.
Couldn't we shorten the range from changing "FF" in the driver?
-
@mahoneyt944 this does appear to work properly in analog would need a decent precision joystick to test it properly though like the original joystick the machine had itself or make a big jig with pots at the side this would help with games like star wars and such. Its like the steering wheels you have much better control because of the diameter of the wheel you can turn a little at a time(If you had a cap on the pot like a guitar does it would be pretty rubbish).
If you look at this game and compare a gamepad thumbstick throw to the monster of a throw the cab had its really the same kind of thing. It is all guess work but im thinking you just do little circles on the cab to throw food everywhere.
. Digital has no real solution for this just more games can be made bearable with auto center.
-
So 125% did better with true anolog?
There's got to be a way to cheat this control on digital. At least there's some progress
-
ye could always to this with a thumb stick sometimes with tiny careful movements(not practical when playing the game) or setting the key delta low to me it looks like how the game works again i havent played the original. 125% doesnt make much of a difference ro be honest.
I think a gimbal like this one would make the game work properly https://www.robotshop.com/en/hitec-2-axis-joystick-gim-01.html of course this is aimed at robotics.
-
Analog is a going to be the right way to play this game, but I think a mod should be made for digital if it can't be mapped properly. Most people building home retropie arcade cabinets are going to be using sanwa or similar joysticks which makes food fight less compatible. It's a shame because it's a fun yet simple game.
I'm probably not the best candidate to write a fix because I'm not familiar with the different file locations and how they link but I'm willing to try. And have some coding experience.
What I propose is that each of the 8 way control directions, when pressed, sets a specific horizontal_value and vertical_value variable corresponding to that direction. These variables will be set/changed every time you press a direction. This means that the direction last pressed will be the values used for centering if options.default_center is turned off and the digital center fix is on.
Then when centering is active for digital controls and options.default_center is off, if press right he will stop facing right. If you press left he will stop facing left etc for all 8 direction.
The first thing I need to know is the location of the file where each button press is made so horizontal_value and vertical_value can be defined/ set for each direction.
So:
horizontal_value = 0x??
vertical_value = 0x??Will be at the end of each direction press (8 directions).
Next "current" needs to be able to be set independently so you can set horizontal and vertical positions instead of setting them both to default_value. This might look something like this, replacing "current = default_value" in your fix:
If (default_center is off) {
Current_Horizontal = horizontal_value
Current_vertical = vertical_value
}
Else {
Current_Horizontal = default_value
Current_Vertical = default_value
}Finally, an additional retroarch option will be added to "use default center value on/off".
options.default_centerThis means you can use the centering fix with or without the default center location.
If you're willing to help, I'll get all the location values
-
thats not really a good solution the default center is ok for 99% of the games. You need to do this in the driver level. So you can just put in digital input drivers instead of analog ones. The logic in this game is pretty easy as far as the input goes.
this is where mame sets the analog ports
this is where the variable is set of which axis to read
https://github.com/libretro/mame2003-plus-libretro/blob/0134c428b75882aa474f78dbbf2c6ecde49b97b7/src/drivers/foodf.c#L181-L184and finally mame reads the input port set in the code from that variable here.
now you can do this a few ways like add digital controls and read them its up to you how you want to do it you could work round the analog code as is but that would break real analog controls.
-
This post is deleted! -
This is just additional option to your current fix which doesn't apply to analog.
First you would turn on your fix for centering digital joysticks. Then you'd have the option(options.default_center) to use 0x7f as your center position as it does now or the variables set by each direction. This only applies to digital controls.
if (delta == 0 && options.digital_analog ) { If (options.default_center == 0) { Current_Horizontal = horizontal_value; Current_vertical = vertical_value; } Else { Current_Horizontal = default_value; Current_Vertical = default_value; } } else if ((delta == 0) && (in->type & IPF_CENTER) ) { if (current > default_value) delta = -100 / sensitivity; if (current < default_value) delta = 100 / sensitivity; }
The reason to do it here is for compatibility with any other game in the future that may have used the 49-way control with similar issues.
These variables will be set after every direction pressed(if your fix is turned off, they just wouldn't do anything):
Some direction press normal code thats here now. horizontal_value = 0x?? vertical_value = 0x??
HORZ VERT UP 7F 80 DOWN 7F 7E LEFT 80 7F RIGHT 7E 7F UP/LEFT 80 80 UP/RIGHT 7E 80 DOWN/LEFT 80 7E DOWN/RIGHT 7E 7E
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.