mirror / dolphin-emu

ARCHIVED Moved to *dolphin-emu/dolphin*
https://github.com/dolphin-emu/dolphin
14 stars 14 forks source link

gyro emulation #19

Open john-peterson opened 11 years ago

john-peterson commented 11 years ago

gyro emulation

files

file/dolphin and image/dolphin contain

the gyro log output

            IR              wm acc              n acc               gyro            
41:46:028  0.00 -0.00  |  0.03  0.00  1.00 |  0.00  0.00  1.00 |  0.00 -0.00 -0.00 ***

emulated input

gyroscope and accelerometer input

https://github.com/john-peterson/dolphin-emu/blob/input/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp

in the input settings

Settings

Axis mouse input

Relative mouse input (called "Axis" in the mouse input configuration) should be used because that allow mouse movement input regardless of where the system cursor is compared to absolute input (called "Cursor" in the input configuration) who's input won't change when the cursor is at the screen edge

Range

Range, Gyro Range and Acc Range multiply the output by 0.01 x to 10 x (by setting its range 1 to 1000). The fast modifier activates the gyro fast mode for all three rotation directions, the fast and slow mode is explained here

gyro settle

https://github.com/john-peterson/dolphin-emu/blob/input/Source/Core/InputCommon/Src/ControllerEmu.h#L491

gyro settle determine after how many frames the gyro will return to zero after the wiimote stop moving (the wiimote is constant but not necessarily nonzero)

a high setting, for example 9999, will keep the gyro in constant motion if input is nonzero

Mouse and keyboard

Gyro Sensitivity: 200 works with a standard sensitivity mouse

IR sensitivity: 20 to move the vertical accelerometer position relatively slowly.

Gamepad

Gyro Range: 0.1 provide smooth aiming and a smooth cursor, the range modifier is set at 1000 (10x)

If the Gyro Range is 0.2 the Range modifier should be 500 (5x) to reach 1.0 with max input

Zelda SS

Moves

Swing sword left/right: yaw left/right

Swing sword up/down: pitch up/down

Stab attack: thrust forward + show IR

Spin attack left/right: yaw left/right + nunchuk thrust in any direction

Land/water spin attack up/down: pitch up/down + nunchuk thrust in any direction (or wiimote thrust forward/backward + nunchuk thrust in any direction)

Skyward charge: pitch accelerometer back (gyro range must be lowered enough that it doesn't trigger a swing)

Fatal blow: lock on enemy + wiimote thrust forward + nunchuk thrust forward Shield: nunchuk thrust in any direction

Roll: dash and nunchuk thrust in any direction

Leap on vine: Nunchuk stick left/right + tilt fast left/right

Balance on the tightrope: Strong yaw input (slow 0.5+ or fast 0.1+)

Key binding

Have the Gyro Range low by default, for example 0.1, to control the cursor and view, and assign a 10 x (range 1000) Gyro Range modifier to a gamepad trigger (or keyboard button or analog stick button) and hold it to perform fast moves; slash sword, leap on vines, swing on rope, shake rope etc.

On the gamepad, bind roll and yaw to the same axis, roll and yaw is used independently in rare occasions only (the boss key for example) so it doesn't hurt, and lets you control the bird or the beetle that use roll.

Use the | OR option with the modifier keys and moves that require multiple input. For example assigning A|B to yaw left and B to Nunchuk thrust makes A yaw left and B do the spin attack.

"Hide IR" should be enabled (and Thrust forward and B should be bound to IR→ Show) because IR restrict horizojntal cursor movement and doesn't have rotation use besides resetting the gyro rotation matrix forward direction

FAQ

Q: Why's the aiming or cursor sensitive A: Lower the sensitivity setting

Q: Why's the aiming or cursor jumpy A: Disable Tilt accelerometer input with "Acc. Range"

Q: The cursor is locked along the horizontal axis A: It's because the cursor can't go to the edge of the screen if IR is visible, turning off IR solve that. Without IR data, 45° yaw move the cursor from one edge of the screen to the other, if additional yaw is applied to cursor move along the screen border

Q: The cursor drift vertically to the center (doesn't affect aiming mode) A: Too little accelerometer pitch is applied because the IR pointer position is not at the end of the screen, possibly because of too low IR sensitivity, the IR implied pitch code is here, as the IR is pointing at the end of the screen (mouse input -1 or 1) the pitch is pi/4 rad (45°).

Q: Why is the item selection cursor difficult to control? A: Bind "Thumb R" or B to "Gyro Range 1" that's set to 1000 (10× multiplier) so that adequate gyro range is applied when selecting item. Because the item selection cursor work the same way as the map cursor so that good IR position data control it. Without IR data a 360° degree pitch rotate the cursor past the whole item circle. In the example gamepad configuration and bound to

Q: Why's the Bird, the Beetle and Swimming hard to control? Sometimes the unit moves sideways on its own. A: Showing IR (that you may have set to the stab attack key) makes these controls easier, just showing IR for for a moment (at the center of the screen position) will reset the gyro rotation matrix so that the unit swim or fly straight again. To gain altitude with the Bird repeatedly dive and immediately call the Bird.

Q: Why is it hard to rotate the sword to enable the Skyview Temple Eye Switch? A: A perfect circle can be created without IR data but IR data is important to reset the gyro rotation matrix forward direction

Q: How do I reset the sword neutral position (gyro rotation matrix)? A: Show IR for a moment

Q: How do I pull the Goddess Sword out of the stone in the Goddess Statue? A. Tilt 90° (full tilt input at 100 acc. range) downward and thrust backward

Red Steel 2

Moves

Swing sword left/right: yaw left/right Swing sword up/down: pitch up/down

john-peterson commented 11 years ago

Other branch changes

Besides the M+ support the "input" branch differences are

magius1998 commented 11 years ago

:P I've got a problem with the newest build and settings. It looks like the motion plus actually works, but when i play Zelda : SS with the newest build i can't press Z button on nunchuk, which is required at the beginning to look at the guy and talk with him, so i can;t continue playing. On configuration it actually glows red when i press assigned by me button to the nunchuk Z (L-CTRL), but it doesn't work in game. Also, I had many problems with running the newest build of motion plus. Almost on every version of dolphin 3.5 emulator i had white screen when i tried to launch a game, and after few seconds a thing popped up saying : dolphin stopped working... (without motion plus it doesn't happen). On older build everything works fine except that the game freezes in place after around 10 minutes of playing (not counting long cutscenes/movies), and if you load a saved state in the old build of motion plus, the next cutscene/movie you enter will freeze the game... so do not use save states (save if you know that the saving block is near, but the game freezes without :P)

john-peterson commented 11 years ago

Nunchuk buttons

i can't press Z button on nunchuk

This is fixed

Crash

Almost on every version of dolphin 3.5 emulator i had white screen when i tried to launch a game, and after few seconds a thing popped up saying : dolphin stopped working... (without motion plus it doesn't happen)

Copy the dialog text because that reduce ambiguity about whether it's a crash message

copy the problem details

copy the call stack

because

State

if you load a saved state in the old build of motion plus, the next cutscene/movie you enter will freeze the game

Does this occur in the current build of this branch?

magius1998 commented 11 years ago

Saving State thing doesn't occur in the newest build of motion plus... but even with the newest one, Z button on nunchuk doesn't work at least for me... about the text, gonna post it sometime tommorow

john-peterson commented 11 years ago

Nunchuk buttons

but even with the newest one, Z button on nunchuk doesn't work at least for me

It's fixed in input_64_2013-06-2315-00-55.039077900+0200.zip

magius1998 commented 11 years ago

oh nice.. i didnt try it out.. gonna check other problems too

magius1998 commented 11 years ago

chcked it for 2 hours of intense playing of Zelda SS, Works nice, No White screens, Nunchuk Z working and no freezing after 10 minutes of playing, or after loading a save state.. everything works nice, good and there are actually no problems.. i configured it so good, then i use my mouse as a sword in TLoZ SS without any problems and it goes purely as i point it :D Thanks for letting us all play this fantastic game on dolphin :D The only problem is the build of dolphin... before i could run Zelda SS without any problems on 30 fps all the time.. never slowing down.. and now i run it at 30 fos only sometimes, and mostly on 25 fps which is a big slow down of the music and audio too :P Hope they repair it, and you will make a new compatibility version of motion plus then :D good luck on your hard work !

magius1998 commented 11 years ago

found another prob : after 3 hours of intense playing, the game freezed, and now freezes after just 5 minutes of playing. You can just make a savestate, but you know.. it's annoying anyway.

john-peterson commented 11 years ago

Hang

Call stack

When a process is hanged

Profile

Determine the hang location from a profile analysis

select

Data written to C:\file\source\c\test\test\Test130626.vsp.

Do this after the call stack is copied because

Symbols

If symbols aren't loaded automatically for Dolphin.exe because Dolphin.pdb isn't in the same path

load the symbols manually

magius1998 commented 11 years ago

:P it doesn't just freeze.. .even a communicate comes up that dolphin stopped working.. not only the emulated game but everything... i also discovered that the problem occurs if you play one and the same save state for 30 min. then it freezes... and every other try to play form the save state (not the same but all others) makes game freeze after 5 minutes then... Problem can be solved by starting a game by saving on a bird statue and loading form then without save states.. then game doesn't freeze, and you can use a save state to play for the next 30 minutes again :D Anyway i used a save state once so i wont have problems with it as i dont like save states... you know.. its like cheating...

john-peterson commented 11 years ago

Crash

it doesn't just freeze.. .even a communicate comes up that dolphin stopped working

If the "Dolphin has stopped working" dialog is shown

magius1998 commented 11 years ago

ok... fixed the problem ( i don't know how.. it was just periodical... kinda looks like it was). But now... ive got some questions : 1. Dolphin team made some optimalization workout which makes games again running smooth on 30fps. Will you make a version of motion plus for the new version ? 2. Why don't you suggest dolphin team to add the motion plus you are making to dolphin ? It would make it much easier to play game which requires it... :D Awaiting your answer and have a good day :)

john-peterson commented 11 years ago

Rebase with master

Dolphin team made some optimalization workout which makes games again running smooth on 30fps. Will you make a version of motion plus for the new version

Which commit are you refering to?

The base of input@john-peterson can be seen at https://github.com/john-peterson/dolphin-emu/commits/input

There are currently merge conflicts described in https://github.com/mirror/dolphin-emu/pull/3#issuecomment-19504792

Merge status

Why don't you suggest dolphin team to add the motion plus you are making to dolphin ? It would make it much easier to play game which requires it

It's suggested that these patches are merged

One reason that the patches aren't merged is that these persons haven't approved the input branch changes

magius1998 commented 11 years ago

Do you think that Dolphin Team will ever make their own Motion Plus "expansion" for dolphin, or they will merge your version of it with their builds of dolphin ?

Djolanderr commented 10 years ago

It might be a stupid question, but how do you install this?

Dizzee commented 10 years ago

Hey the dropbox link isn't working :(

Djolanderr commented 10 years ago

Well, you maybe should wait some time, because it's temporarly disabled... :-/

john-peterson commented 10 years ago

More information for error 509

Hey the dropbox link isn't working :(

I've asked for more information about error 509 at https://github.com/mirror/dropbox/issues/4

raullink commented 10 years ago

Hi JPeterson. Did you uploaded your Builds on another profile or still temporarily disabled on dropbox?

john-peterson commented 10 years ago

Did you uploaded your Builds on another profile

no

or still temporarily disabled on dropbox?

it's dropbox fault described at https://blog.dropbox.com/2014/05/web-vulnerability-affecting-shared-links/

i fixed the url now

raullink commented 10 years ago

Ok! Thank you!

john-peterson commented 10 years ago

there's no gyro position

After working with the gyro control mapping in a variety of ways, I started wondering if it was possible to map a gamepad axis to the gyro position as opposed to gyro motion.

So for example, using a joystick, the default position would always have the wiimote pointed in the default position at the screen.

Then a fully upward joystick would point the wiimote vertically at the ceiling and returning the joystick to default position would return the wiimote as well.

This way the gyro motion of the wiimote would behave similar to the IR behavior. When the joystick returns to the neutral position, so too would the Wiimote.

I'm guessing this would be difficult, since the gyro and accelerometer report movement values instead of position values, but with your detailed knowledge of this subject, would it be possible?

there's no gyro position, the gyro values goes to 0 when the wiimote is still

the accelerometer give an orientation value even when it's still

gyro settle

I guess as a bare minimum would it be possible to force the gyro to the neutral position after a set time or a button press? I thought the Gyro Settle variable would do this, but it appears to simply alter how often it receives input instead of resetting the gyro position as well.

gyro settle control how fast (high value = slow settle) the gyro values goes back to 0 when input is unchanged

john-peterson commented 10 years ago

zelda

I suspected as much in regards to gyro position tracking. But since the accelorometer does report orientation, would it be possible in Skyward Sword to use changes to the accelerometer orientation to perform actions in the game?

i dunno

So if you report a netural orientation from the accelerometer , and then quickly report a vertical orientation would that cause a vertical upward sword swing?

i dunno

I'm guessing not since the game requires the MotionPlus (gyro), but it appears the game uses metrics outside of the gyro to understand the orientation of the Wiimote, like IR position. I suspect that accelorometer value reporting could be used to perform actions as well?

u can find the answer because u can control them (gyro, acc and ir) independently and see what happens

john-peterson commented 10 years ago

code

I did do some testing on my end, and found that with your build of Dolphin, only the Tilt controls (Pitch, Yaw, Roll) will cause sword movement. IR and Swing have no effect on Sword movement.

However, I'm not sure if you utilize the accelerometer orientation in your control configuration.

Based on your FAQ, it appears you map relative accelerometer movement to the swing controls, and relative gyro movement to the tilt controls.

To test this I guess you would have to replace the gyro mapping in tilt controls to accelerometer position mapping.

If you can tell me which source files you used to do the tilt to gyro mapping, I can try to remap the tilt to the accelerometer position.

acc data is read in Wiimote::GetAccelData in https://github.com/john-peterson/dolphin-emu/blob/input/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp, gyro data is read in Wiimote::GetExtData in the same file, swing and tilt input is read from GetState

swing affect the accelerometer and not the gyro, tilt affect the accelerometer and the gyro

if u wanna change how acc data is affected by tilt input u would do that in Wiimote::GetAccelData

After testing some more WiiMote behavior I think I have the remapping strategy figured out.

Joystick Up -> Wiimote Pointed Up Joystick Down -> Wiimote Pointed Down Joystick Left -> Wiimote Rolled 90 Left Joystick Right -> Wiimote Rolled 90 Right Rapid Joystick Movement -> Fast mode Tilt in that direction (Pitch and Yaw only)

Since there is no way to accurately detect orientation changes when only Yaw is used, we could rely solely on rapid movement left or right to cause the tilt behavior. This should eliminate the need to toggle 'Fast' mode manually.

The next step for me is to figure out where the control translation happens.

So if I wanted to see how 10% or 50% movement of a gamepad axis gets passed into its mapped WiiMote axis, where would that be?

Is it encoded into the 'u8* const data' parameter of those functions you mentioned?

i'm swamped right now, i'll let someone else answer