Roku development V: Artifacts

by Niels Brouwers 4. September 2014 19:54

Almost there, but just not yet! Here's why it is important to be able to test your Apps/Games on real hardware: you only know what it will look like if you have seen it! One of the reasons that I kept postponing the Android release was because I only had 1 (cheap) Android tablet and, althought, it looked good on that device I was hesitant to conclude that it would look and play good on all Android devices.

On the Roku, as I mentioned in an earlier post, we had to lower the graphics resolution and then upscale that to match the resolutions that the Roku supports. After fixing the functional issues, I started playing The Carter Jones Adventures and a lot (really a LOT) of artifacts were suddenly very visible on my television! I had not seen these before on the smaller devices where I had to apply the lower resolution graphics  (maybe due to a smaller screen / different rounding  / whatever ..), but it looks really ugly and so I need to fix the graphics. This means lots of 'manual labor' and hoping nothing else breaks in the process.

So, currently I am working my way through all this and I hope to finish it in a couple of days. If only the little device would have enough memory for the high-res graphics....

Roku development IV: resolution

by Niels Brouwers 22. August 2014 20:35

Right now, the Carter Jones Adventures is running great on my little Roku device! It is actually running at 60FPS and that is exactly how it is intended!

However, I did have to switch to lower resolution mode to make this happen. As it turns out, the Roku is not extremely powerful when it comes to graphics, and also the memory is pretty optimized for the specific purposes that the device was built for.

You see, the Carter Jones Adventures contains two sets of graphics. One high resolution library and one low resolution library, all the handmade drawings are drawn at high resolution and that is what you will see on for example an ipad 2. For the lower power devices there is a low resolution library that is half the resolution of the original graphics.

Now, there are lots of different resolutions and the way we cope with that is really simple: the levels are all tile-based so when we encounter a resolution where 20 tiles will fit on the screen, we draw 20. If there is just room for 16, we will draw 16. So devices with a bigger screen will usually see more of the level in advance.

Also, there are devices that don't allow us enough memory to load all the graphics, the usual effect when trying to load the high resolution graphics is that the application will crash before even starting. My solution in these situations is to load the low resolution graphics (=less memory required) and upscale them (to 200% usually) to make them fill the screen. The Ipad 1 is in this category, and so is (unfortunately) the Roku.

 As I mentioned, the game is now fully playable on the Roku which is really cool! What is left is some minor tweaking (mapping the right keys to the user actions), removing some unused controls (touch controls are still configurable, sound is still adjustable in the UI but Roku does not allow code to change volume etc) and a lot of game testing!

Tags:

Roku development III: untouchable!

by Niels Brouwers 15. August 2014 06:06

Here we are with part 3 of the ongoing process with the Roku port! First a small note: each of these posts describe a step in the process of bringing the Carter Jones Adventures to the Roku device, however please keep in mind that I can not spend more than about an hour a day on this project because I have a family and day-time job to take care of as well. Thus, each post represents about an hour of real work.

So, after getting things up and running, the first thing to do was map some keys to the Roku remote control so I could navigate to the gameplay part and see how that looks/performs. Doing that was pretty straightforward: just adding in some

s3eKeyboardGetState() 

calls to pick up on the keypress events and we had a game running on the big-screen. Check my Twitter (also on the right of this page for a neat picture of my TV with the Roku just visible on the bottom right). Nice, I could play the first level, albeit with some hick-ups and weird initialization things going on!

Next step was developing some logic for handling the navigation in the user interface. Carter Jones was built for touch-devices and my TV certainly is no touch device. So, I started on the title-screen, introducing something of a 'focus-concept', where I highlight the selected user interface element and when OK is pressed a 'tap' is registered on that element and the corresponding logic is executed.

I could have made some nice generic framework code to handle this, but because the number of user interface elements in the entire game is relatively small I decided to program this out for each screen separately. This will be a bit more manual labor but it is a proven solution and it does the job (I always tend to embrace the KISS principle here, even if it means a little more 'work' for me). 

So for now, the title screen is ready. The following screens are still on the to-do list: levelselect, credits, options1, options2, gamescreen, game-over, level finished. I think I can probably delete the option screens because I can't adjust the sound from my code and there is no touch-screen, so that leaves little to configure!

Tags:

Roku development II: unlock your device!

by Niels Brouwers 12. August 2014 22:46

Ok, so I got the Roku and after playing around with it for a while I decided to see if I could download the Carter Jones Adventures on the little device. I fired up Visual Studio, then did a fresh build and hit publish. The marmalade deployment tool popped up and after configuring the deployment for Roku the package was successfully built.

I then started reading on how to get the zip file to the device (of course I could have done that already...) . To start with, you need a Roku developer account which you can request / configure through the Roku website. Through the same website, you can enable your device for development, which I also did.

Once your device is configured for development, you can telnet to it (for debugging, you can open telnet on port 8085). Also, enabling your Roku for develpoment, opens up a neat little webservice that enables you to download your application to it. I figured I was all set and ready now, so I downloaded the executable to the Roku, that worked fine. Then on the device (on my TV using the Roku remote), I went to 'My Channels' and selected the app I just downloaded.

The result was an endless 'Loading' in the top left bottom of the screen.....huh?

So I tried the 'Hello World' example, same thing....weird! Then I checked the debug information in the telnet, it said this:

------ Running ------
Starting.
BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.

Current Function:
001: Sub Main()
002:     print "Starting."
003:     ndk = CreateObject("roNDK")
004:     retval = ndk.start("pkg:/app",["--debug"])
005:     print "Returned - " ; retval
006: End Sub
'Dot' Operator attempted with invalid BrightScript Component or interface refere
nce. (runtime error &hec) in ...AAU2vt0i/pkg:/source/main.brs(4)
004:     retval = ndk.start("pkg:/app",["--debug"])
Backtrace:
Function main() As Void
   file/line: /tmp/plugin/KBAAAAU2vt0i/pkg:/source/main.brs(4)

Local Variables:
global   &h0020 rotINTERFACE:ifGlobal
m        &h0010 bsc:roAssociativeArray, refcnt=2
ndk      &h0080 Invalid val:invalid
retval   &h0000 <uninitialized> val:Uninitialized
BrightScript Debugger>

------ end ------

The above message is pretty non-descriptive, but as I learned, it means that the Roku device is not yet enabled for development by the Roku team. So, just beware, if your device is not white-listed by Roku for development, you can 't actually use it to deploy / side load your application!

After figuring that out, a quick email exchange with Roku whitelisted my device, and I was ready to go!

 

Roku development I: unboxing

by Niels Brouwers 8. August 2014 20:40

The great people at MadeWithMarmalade sometimes collaborate with platform vendors who wish to increase the amount of Apps / Developer adoption of their platforms, this results in the so called developer offers. The Carter Jones Adventures was initially released under such an offer (for the BB10 platform).

It is pretty safe to say that without these kinds of incentives, my endeavours in the games/app development would never have been made public like The Carter Jones Adventures is now. I am just the kind of person that needs some external pressure to get things finished and pushed out to the public.

So, now there is a new developer offer and it involves the Roku - a pretty unknown device in the Netherlands but in the US it apparantly is, it is often compared to the Apple TV or Google Chomecast line of products. In short, it is a small device that plugs in your TV through HDMI and makes your TV smart by adding media streaming capabilities (netflix, hulu, etc.) and....games!

I will be porting the Carter Jones Adventures to this little box, using the crossplatform MadeWithMarmalade SDK. To get started, I received my Roku 3 last week.

 

 

The connector was flat, so that required a converter but that was quickly solved. Once I hooked it up, I noticed that this device is rather snappy - unlike, for example, the Sony Bravia smart televisions that we use at our office, this device responds instantly to a button press. Setting up for consumer usage is pretty easy and I was quickly adding channels and checking out the features. Impressive little device, so far.

 

In my next post, I will get a bit more in-depth describing how to set the thing up for development and some issues that I ran into with that.