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.

AppGameKit Classic Chat / AKG Tier 1 and Serial IO

Author
Message
Dybing
12
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 7th Feb 2016 01:11 Edited at: 7th Feb 2016 01:32
There is no support for Serial IO at the moment, which is a big shame, as it'd be a great addition to AGK. In particular with the popularity of various entry-level Microcontroller Dev-Boards like Arduino, Teensy, PIC and so on. Imagine being able to write front end software using AppGameKit to send and receive data to these microcontrollers?! You could have an AppGameKit app that worked as a remote-control to a RC quad-copter. AppGameKit front-end to 'smart-home' control of everything from the temperature on the bathroom floor in the morning to automatically opening the garage door for you as you start the engine of your car.

What we'd need is Serial communication over USB and Bluetooth built into AGK. such IO interfaces are standard on all devices AppGameKit run on. Well, maybe not Bluetooth on Desktop PCs/Macs, but details.

Now, there are work-arounds. But they are cumbersome and require an extra layer of hardware and protocols. You can use HTTP to send data out of AppGameKit, and receive data as a file containing data you need. This is slow and do not allow a stream of data to be transferred.

In a project I am working on now, I am in need of polling Serial In at a frequency of up to twice per second. The HTTP approach just won't do. There is however the Joystick. Through the Joystick device, several bytes of data can be imported as a steady stream. There is no package control or buffer-stack per-se, so data need be pre-formatted and unpacked before sending it into AppGameKit as an emulated joystick device. Which, I might add is a USB device, so the underlying code to read from Serial USB is already in AppGameKit - it is just not opened up for us to read and write to using our own package structures and protocol settings (baud rate, stop bits, parity etc)

Anyway. to make my project work, I've set up an Arduino UNO R3 as a Joystick. This reads data from a DB9 RS232 FTDI to TTL converter, assigns the datapackages to 4 Joystick-Axis acting as a byte each, and 8 buttons acting as 1 byte of 8 bits. So in total 5 bytes being streamed into AGK. This works ok for the most part, but there are some idiosyncrasies with the Axis as a byte conversion.

Anyhow, the example code - first the Arduino:



To set the Arduino up as a Joystick readable by AppGameKit, you'll need to program the USB controller on the Arduino as a Joystick. Batch files for this (and reverting back to an Arduino) and a comprehensive how-to is in included with the Unojoy library download.

...and on the AppGameKit end to read it:

Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 7th Feb 2016 09:00
Well AppGameKit is intended primarily for games. Also I don't recall anyone else asking for this. Why not use Tier 2?
Dybing
12
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 7th Feb 2016 09:41
AGK - in tier 1 - is about ease of development for various platforms with an emphasis on handling graphics. You may use this to make games, many do, but AppGameKit is not a Games Creator. It is a general purpose programming environment. At any rate, serial in/out opens many possibilities for custom methods of control in both games as well as other kinds of applications.

Tier 2 is fine and well, but if I am to invest that kind of effort, I'd just ditch AppGameKit for the project altogether and use Processing instead. Does the same job though on a Java backend.
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 7th Feb 2016 10:51
AGK has to put its focus on primarily what the user base want the most. Development time is limited so something very niche like this is probably not going to be added sometime soon. Unless it can be done very quickly. Still, I think more than one person has to wish for it. And there's a lot of more requested features.

App Game Kit it developed by The Game Creators. It's pretty clear what the primary intended function is. Not saying that it can't do other things. But those things are secondary.
Dybing
12
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 7th Feb 2016 15:57
Well ok then - but through proper Serial (wired through USB and Wireless through Bluetooth) implementation in AppGameKit we could - say - communicate with Kinect or a Wii Controller. Have modifiable support for any known joystick and gamepad under the sun, with output to say device display/LEDs, rumble-motors or force-feedback. Also, the current joystick implementation is severely lacking. There isn't even D-Pad/Top-Hat or throttle lever support. With proper Serial commands we could add any other custom input/output device we'd like to add flavour to games and make the controller option entirely customizable. And do more as well.

It'd be more useful than say Facebook integration, having NFC built in or detecting a Lightsensor in my opinion. Yes, the developers need prioritize and their time is limited. But I would not call having good IO capabilities for niche. The basic groundwork for it is already there, as the current Joystick implementation do dig into the USB port and its' protocols. It is a matter of opening that up for general use, rather than having it locked down to its' current restricted use.
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 7th Feb 2016 20:17
Like I said, there has been no request for this (as far as I know). In this community it is very niche. You are very much limiting your user base if you use stuff like that. AppGameKit is all about maximizing your user base by supporting multiple platforms.

Login to post a reply

Server time is: 2024-03-28 17:53:12
Your offset time is: 2024-03-28 17:53:12