Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Transferring an app I made in Python, need some udp advice

Author
Message
Meganoodle71
1
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 19th May 2020 13:39
The python script snippet below connects to the udp data stream (socket 5606). It the retrieves and stores the package into a large string (data) . then I can unpack out the required data from the string i need.
Im trying to convert this over to AppGameKit Ive made some attempts but not getting anywhere.
When I looked at the reference guide it seems the functions are there but i believe im using it completely wrong.

Is there any way I can adapt this code into a working AppGameKit format, or am i barking up the wrong tree?

the original project (which works very well) is an extra dash for Project cars 1 & 2. It receive the telemetry data sent by the game and creates a speedo , rev counter , split times , lap times etc. I made it initially on my raspberry pi so python was Ideal.
Ther are some friends in my racing comunity would like me to do a similar app for android. I originally looked at kivy but the build process is always hit and miss, so i wanted to try something more stable.

import socket
import struct
UDP_IP_ADDRESS = "0.0.0.0"
UDP_PORT_NO = 5606
serverSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
serverSock.bind((UDP_IP_ADDRESS, UDP_PORT_NO))

while True
data, addr = serverSock.recvfrom(1367)
if data is not None:
package_type=struct.unpack('B', package[2:3])[0] & 0x3
Virtual Nomad
Moderator
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 19th May 2020 21:22
i can't help directly but are you aware of AGK for Python and its forum thread?
Meganoodle71
1
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 19th May 2020 21:33
Ive stuck at it and found my way around the network problem, the issue now is converting the data, I can retrieve real numbers with GetNetworkMessageFloat but Im having trouble with the unsigned and signed 16 bit integers, ive been hunting the internet for functions and posible ways of making my own function to convert them, im sure Im looking in the wrong places and Im hopefull theres a simple way of doing this but Im not seeing it at this time.
Many thanks .


Meganoodle71
1
Years of Service
User Offline
Joined: 1st Apr 2019
Location:
Posted: 19th May 2020 21:56
I wasnt actually aware of this , Ill look into it.
Is it multi platform like the mainstream AppGameKit? Specifically Androind?
Virtual Nomad
Moderator
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 27th May 2020 04:17
Quote: "Is it multi platform...?"

sorry, i have no idea. it would be a good question to ask in the main thread.

Login to post a reply

Server time is: 2020-09-27 21:55:53
Your offset time is: 2020-09-27 21:55:53