python to control player rotation?

Discussions about UT99
museeeii
Novice
Posts: 13
Joined: Tue Feb 07, 2017 12:42 am

python to control player rotation?

Post by museeeii »

Is it possible to use python to send data to change in-game player orientation (pitch, yaw and roll)? If so, is there an example of such thing?
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: python to control player rotation?

Post by Barbie »

Python is just another scripting language; if such would work with Python, it would also work with Perl, VBS or any other scripting language - Python has no special relationship to Unreal.

And manipulating Unreal's objects while it is running is possible by hooking system calls for example, but you need access to the computer where Unreal is running. But better ask a hacker for this. ^^
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
schwap
Novice
Posts: 20
Joined: Thu Aug 25, 2016 1:06 am

Re: python to control player rotation?

Post by schwap »

It is possible to do this if you spawn a UDP / TCP receiver class to interpret the rotation calls.
User avatar
SilverSound
Adept
Posts: 341
Joined: Fri Nov 06, 2015 10:12 am
Personal rank: Curious
Location: St. Cloud, Florida

Re: python to control player rotation?

Post by SilverSound »

Why would you need such a thing in the first place? I'm just curious.
"Woah what?! I wish I was recording that...."
User avatar
papercoffee
Godlike
Posts: 10443
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: python to control player rotation?

Post by papercoffee »

SilverSound wrote:Why would you need such a thing in the first place? I'm just curious.
This

It sounds highly suspicious.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: python to control player rotation?

Post by JackGriffin »

I wouldn't jump too hard on OP for asking. There's a ton of things to be done with UEngine and a virtual reality headset (for example). UT's simplicity would allow a pretty easy connection to a VR rig.

I'm curious too Silver but probably for different reasons.
So long, and thanks for all the fish
museeeii
Novice
Posts: 13
Joined: Tue Feb 07, 2017 12:42 am

Re: python to control player rotation?

Post by museeeii »

I am just trying to send rotation data from my android to control player orientation.

@schwap do you know where do I found more info about UDP / TCP integration?
@Barbie I thought in making python save a file containing the info I need in game, then, in game, I read the file contents every tick. But problems may occur when concurrent operations of write/read take place. Yes, I have control over client machine =D
museeeii
Novice
Posts: 13
Joined: Tue Feb 07, 2017 12:42 am

Re: python to control player rotation?

Post by museeeii »

BTW, I am already passing data through web sockets over local address: 192.168.1.14:8000
Is there a way to Unreal capture the data direct from that address?
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: python to control player rotation?

Post by sektor2111 »

You can stop multiple posting withing 24 hours and do use EDIT button instead.
schwap
Novice
Posts: 20
Joined: Thu Aug 25, 2016 1:06 am

Re: python to control player rotation?

Post by schwap »

museeeii wrote: @schwap do you know where do I found more info about UDP / TCP integration?



The thing you're trying to do has been done already
(external program to modify rotation) - and theres a neat example on BeyondUnreal by Matthieu29.
It is actually made for UT2003.. but I guess it'll work on UT99 just fine. (might need a few changes, didn't check)

-> https://wiki.beyondunreal.com/Legacy:UDP_Server_Sample <-

For more informations have a look at these classes:


If you get it done, a video where you control the pawns rotation with your smartphone would be neat. :agree1:
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: python to control player rotation?

Post by Barbie »

If the intention is using another device than keyboard and mouse for player control: why not using the existing interface? The VR controller could simply simulate mouse and keyboard events...
museeeii wrote:I thought in making python save a file containing the info I need in game, then, in game, I read the file contents every tick.
Transferring data though a file as interface is limited by mass storage speed and UScript's inability reading data from a file (except a corresponding INI file).
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
museeeii
Novice
Posts: 13
Joined: Tue Feb 07, 2017 12:42 am

Re: python to control player rotation?

Post by museeeii »

Thank you very much for your reply guys!
I am very excited because I just have done the script that rotates the player to a specified orientation, and its working! uhuu
If you get it done, a video where you control the pawns rotation with your smartphone would be neat.
Sure I will post a video here to share with you guys. And the source code will be in my GitHub as well the Mutator for download.

@schwap thanks for the links. I will start read it after now. I will try to understand those uc files and try to implement it
If the intention is using another device than keyboard and mouse for player control: why not using the existing interface? The VR controller could simply simulate mouse and keyboard events...
My real intention is to make a VR Cyberith treadmill-like platform for UT99, one you can walk, run, jump, turn, shot and so on.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: python to control player rotation?

Post by JackGriffin »

And now I'm REALLY interested....
So long, and thanks for all the fish
User avatar
SilverSound
Adept
Posts: 341
Joined: Fri Nov 06, 2015 10:12 am
Personal rank: Curious
Location: St. Cloud, Florida

Re: python to control player rotation?

Post by SilverSound »

JackGriffin wrote:And now I'm REALLY interested....
That's amazing to think about isn't it? Just think about what it would look like to do BT with that sort of set up.
"Woah what?! I wish I was recording that...."
museeeii
Novice
Posts: 13
Joined: Tue Feb 07, 2017 12:42 am

Re: python to control player rotation?

Post by museeeii »

I finally did it folks!
Much thanks for @schwap to point me to a great UDP resource

Yes, the player is now controlled by my Android phone (only orientation so far) and the result was a great ... CRAP...
oh man, it is so frustrating :cry:

Just to get you know, I got two problems now:
The player rotation gets really laggy since the data is transfered through UDP socket. But I dont really know if it's because UDP. But the result of rotation in game happens only after a second or two;

The second problem is the camera being shaking, even if the phone is completely in rest over the table. Looks like the player got Parkinson's :loool:
I am using the magnetometer (Compass) to capture Android orientation and it is always oscilating from a range up to 10 degrees. I know I can try to smooth these oscilations but...
Post Reply