UE2 - UT2kX Custom Input Devices

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Elite6

Da Dude
Apr 21, 2001
45
0
0
www.DragonballU.com
Hai guys!

since I'm on a roll with uscript I figured I'd go all the way and actually finish this project! I'm working on a 4 walled CAVE and am using CaveUT to create an immersive UT2004 experience. I just implemented my own StereoView mod which works like a charm and all that's left now is headtracking and custom input.

When standing in a CAVE you don't want to screw around with a keyboard and mouse. We want to use the Wii Mote. Now there are plenty of Wii Mote mapping tools around there that will do the job just fine, but I'm not interested in any of those. I want to hook up the Wii Mote keys directly into UT2004.

When I check out User.ini I see something like this

Code:
A=StrafeLeft
D=StrafeRight
S=MoveBackward
W=MoveForward
LeftMouse=Fire
MiddleMouse=MoveForward
RightMouse=AltFire
MouseWheelDown=NextWeapon
MouseWheelUp=PrevWeapon
MouseX=Count bXAxis | Axis aMouseX Speed=2.0
MouseY=Count bYAxis | Axis aMouseY Speed=2.0

I'm wondering where these keypresses are defined so I can add my own to it. I'd like to add the 13 digital buttons of the Wii Mote + nunchuk as well as the 6 analog measurements of the accelerometers.

I'm afraid these are defined in closed code somewhere since I haven't been able to find them yet.

If this isn't possible I'm guessing my only other option would be writing a program that passes on my wiimote input through a TCP connection to my mutator that would somehow make my player move... Is this possible?

What's your thought on this? And have there been people that have added new devices to UT2004 without keyboard mapping?

Thx!

Rene
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
You would need access to UT2004's native code to implement the input directly in the game. TcpLink or UdpLink to communicate with an external application sounds like the only way to do it without that.
 

Elite6

Da Dude
Apr 21, 2001
45
0
0
www.DragonballU.com
thanks!

and I'm guessing I can use the exact same commands as specified in the User.ini file to make my player move? I supposed if I used tick(dt) I'll achieve the exact same effect since I'm assuming that the game uses thesame loop to handle the input commands.

Just wondering, how does one execute a string command in code? :confused:

And I guess I could define my own WiiMote.ini to make commands mappable. Oh sounds like fun!

Thx
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Console commands can be executed via the ConsoleCommand() function. It is declared in the Actor class, but should be called on the local PlayerController instance to execute the console commands in the context of that player.
There is some native magic behind the "axis" input command, though. It only has an effect when called by holding down a key/button or moving the mouse/joystick. You could probably try adding the movement delta value directly to the controller's corresponding axis variable in Tick.
 

Elite6

Da Dude
Apr 21, 2001
45
0
0
www.DragonballU.com
my bad... typing "Fire" in my console doesn't make the gun fire -_-

These keybound commands are executed elsewise. So using ConsoleCommand() wouldn't work either. I got everything set up! I just need to know how to execute those commands!
 

Elite6

Da Dude
Apr 21, 2001
45
0
0
www.DragonballU.com
okay, after harrasing some people on #unrealscript I found out a lot more! Apparently
ConsoleCommand() does work but only on some exec functions.

confirmed to work from console command:
BehindView(bool)
Suicide()

confirmed not to work from console command:
Fire()
AltFire()
Jump()

would anybody know what the difference between the functions would be? They're all in PlayerController.uc. They're all exec functions. I see that some of them are replicated and some not, but I can't imagine that being the problem. Is there something I must do to be able to have all exec functions available? In the console I noticed that all exec functions are recognized, but some just don't seem to do anything.
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Fire, AltFire and Jump are defined in the Aliases list of your User.ini's [Engine.Input] section. The "button" and "axis" commands used there only work when bound to a key.
 

Elite6

Da Dude
Apr 21, 2001
45
0
0
www.DragonballU.com
I'm guessing all exec functions bound to an Alias only work when those are bound to a key. since NextWeapon is an alias for NextWeapon and it's not callable from ConsoleCommand.

:S

yeah crap, it's true. I just Aliased "Suicide" to "Suicide" and it's not working from console command anymore :(.

I'm gonna try clearing my alias list next to see if my commands then work.
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Some of those commands are alias'd for a reason. For example, Fire is combined with Button bFire so weapons can figure out they are currently being fired. If bFire wasn't included, weapons wouldn't know when to stop. Similarly, Jump and Duck are also used to swim/fly up and down.
 

Elite6

Da Dude
Apr 21, 2001
45
0
0
www.DragonballU.com
yeah, but they're blocking my commands from being processed. I just cleared my alias list in User.ini and all my buttons are working now. Maybe if I figured out how Alias is used in PlayerController I could do thesame in my mutator. That way I can import the aliases from User.ini and possible bypass the block.