Main siteMain site  ForumForum  ForumSearch  Private messageEmail contact  RegisterRegister  Log inLog in 
Topic: Application Player / Game Control
Reply to topic
Author Message
Brian



Joined: Jun 17, 2016
Posts: 11

PostPosted: Jun 20, 2016 10:06 PM    Post subject: Application Player / Game Control

I was testing out the ApplicationPlayer element with a simple Unity3D game I programmed. And I was able to execute the game; however, I was not able to control key presses through a logical input. I simply used the "RacerGame" example as a trial. I saw the note on the manual that "the application needs to be in focus to receive the keyboard key events" and this may be the issue, but I am not sure what this implies.

I tried troubleshooting in several ways before posting on this forum, but I was still not able to get it to work. Initially, I changed the properties on the ApplicationPlayer element to correspond to the key press I wanted, but that didn't work, so reloaded the original racer game design.. and changed the key press I wanted in my Unity game to "w" (forward in the racer game) and used the default settings in the racer game design. But the logical input still was not able to control the key press.

I am not sure if my mistake is on the BioEra or the Unity side of things. I am using Unity Personal Edition, but I don't think that would effect it. Are there specific game engines that work better with BioEra? I am just trying to think of all possible solutions. I know this is slightly limited information without seeing the game dynamics, but any guidance would be greatly appreciated!
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 20, 2016 10:18 PM    Post subject:

The focus is very important. BioEra can (and should in this case) work in the background. The game should be in focus, which means it should be the foreground application.

Are you able to press 'w' on your keyboard and is your game reacting to this keystroke? ApplicationPlayer simply emulates keyboard key presses/releases, so it should cause the same outcome as when you press/release a keyboard key.

The game engine doesn't matter in this case. This is a question of whether the game can receive (and react to) keystrokes.

If you have a version of your game which you could send to me, I can try it.

There are also other ways to communicate. ApplicationPlayer is convenient for third party games which can't be modified. But if you develop the game, you have more flexibility. In such case you could use other interfaces to communicate with BioEra - the most common is XmlNetServer which uses TCP socket. If something like that is possible in your game, this is always a much better way than using ApplicationPlayer.
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 20, 2016 10:42 PM    Post subject:

I just tried it with Notepad and I think I have encountered a similar problem. That is because Notepad doesn't allow to change its title, and BioEra relies on that to detect whether the application has started. I suspect this may be the case with your app too.

I will add a new option in ApplicationPlayer to handle a situation like that.

I will post here when the new BioEra version is ready.
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 20, 2016 10:56 PM    Post subject:

Actually I was able to make ApplicationPlayer working with Notepad without any change.

See this snippet:

http://proatech.com/design/appplayer_notepad.bpd

It is important, that you enter the "Search Window Title" text as it is in your app (can be just a part of your title text).
Brian



Joined: Jun 17, 2016
Posts: 11

PostPosted: Jun 20, 2016 10:57 PM    Post subject:

Yes. I am able to push 'w' and initiate an action in the game. I will send you a copy of the game later tonight.

I believe I have seen other games in Unity utilize XmlNetServer, so I will definitely look into that until the next BioEra version.
Brian



Joined: Jun 17, 2016
Posts: 11

PostPosted: Jun 20, 2016 10:59 PM    Post subject:

Okay. Wonderful. I will try it out later tonight. Thank you!

(Clinician by day, Programmer by night..)
Brian



Joined: Jun 17, 2016
Posts: 11

PostPosted: Jun 21, 2016 4:05 AM    Post subject:

I tried it and it works perfectly! Thank you!
Reply to topic