Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
2dguy
Level 7

BrightScript Game Development Questions

I'm still doing research on coding games using Brightscript, I'm in the middle of releasing an app on another platform otherwise I would have spent time researching this myself. I greatly appreciate any responses.

Q) Is it possible to set up a lower resolution for the game and have it scaled to the device? 
Q) What audio format(s) are used for sound effects and music?
Q) How may sounds will I be able to play at a time?
Q) Do we get access to hardware supported rotation, scaling?
Q) Do we get access to hardware supported alpha blending, etc?
Q In the 2D world, I'm used to drawing the scene every frame. From back to front. Tile maps, background images, then sprites, etc. Would this be a similar process using Brightscript?
Q) For brute rendering performance considerations, with a 1920x1080hd background, how many 32x32 sprites could be rendered and still have 60fps updating? I'm used to terms like "sprite batching" to increase performance. Is any of this applied when working with BrightScript?

Q) Can someone please give me a link where I can download "everything I need" to start programming in BrightScript? I can't find this information anywhere. lol.. Thx!
0 Kudos
5 Replies
Komag
Level 9

Re: BrightScript Game Development Questions

I'll take a stab:

Q) Is it possible to set up a lower resolution for the game and have it scaled to the device?
- Roku automatically does this, so you don't have to
Q) What audio format(s) are used for sound effects and music?
- SFX 44.1khz 16bit mono wav
- Music: I currently have all my songs in WMA, 64Kbps, but that can vary, can be MP3 or AAC, I don't have a good answer
Q) How may sounds will I be able to play at a time?
- Exactly 2 SFX (it used to be 1, so be grateful!), plus any single background music track. I've written a complex SFX buffering/delay and priority system to make my game sound like it's doing more than 2, plus I've sometimes combined sounds into single files for use in specific cases when those two individual sounds would have played.
Q) Do we get access to hardware supported rotation, scaling?
- Theoretically there is unofficial capability on some Roku models for rotation. Scaling I believe is always possible, but I'm not sure. I use neither of these since I'm trying to make my game compatible with the widest array of Roku models possible, and also perform decently well on older models.
Q) Do we get access to hardware supported alpha blending, etc?
- There is alpha blending, but it's expensive as I understand it. I use it sparingly.
Q In the 2D world, I'm used to drawing the scene every frame. From back to front. Tile maps, background images, then sprites, etc. Would this be a similar process using Brightscript?
- That seems similar
Q) For brute rendering performance considerations, with a 1920x1080hd background, how many 32x32 sprites could be rendered and still have 60fps updating? I'm used to terms like "sprite batching" to increase performance. Is any of this applied when working with BrightScript?
- I really don't know, and it very heavily depends on the Roku model. I'm using 720p and I use 64x64 sprites and don't target 60fps so it's quite different. I'm probably drawing around 50-100 sprites on average, with very few moving or animating (maybe 5-10). In a big test room where I draw "everything", around 400 sprites are drawing, with around 30 animating (with just 4 frames each), and it runs smoothly only on the newest strongest Roku models, but brings older ones to their super slo-mo knees. But of course that room is nothing that would be encountered during the normal game.
Q) Can someone please give me a link where I can download "everything I need" to start programming in BrightScript? I can't find this information anywhere. lol.. Thx!
- There's not really anything to download, no tools suite per se. You just decide on an editor or IDE (I use simple old NotePad++) and off you go. Others have had a good experience with IDEs that do more such as packaging up your game to test run each time or tracking different projects. I guess I should mention that I also use PurpleBug (and there's VioletBug) for testing. Other than that, I just have a whole bunch of Rokus models (12!) that I periodically test on, but I mostly develop using one Roku TV which is convenient.
0 Kudos
2dguy
Level 7

Re: BrightScript Game Development Questions

Thank you for the reply Komag, much appreciated! wow..overall it sounds like programming 2D games 20 years ago..lol. Very surprising to be honest. While the rendering possibilities on the newer models seems acceptable for low performance game needs, the audio support is very disappointing to say the least, especially for such a media prolific device. However..it's intriguing to possibly work on a such a low spec device again. I was hoping to have a plethora of tutorials, guidelines, etc, for coding games using BrighScript before I started devoting my time, but the overall information on "Roku Brightscript game development" is very lacking when searching on Google.
0 Kudos
Komag
Level 9

Re: BrightScript Game Development Questions

Yeah, it keeps out the riff-raff Smiley Wink
0 Kudos

Re: BrightScript Game Development Questions

I will add comments on top of Komag's answers, when I have something to add.

"Komag" wrote:
I'll take a stab:

Q) Is it possible to set up a lower resolution for the game and have it scaled to the device?
- Roku automatically does this, so you don't have to
MC: Check the roScreen documentation about the screen resolutions: https://sdkdocs.roku.com/display/sdkdoc/roScreen
Q) What audio format(s) are used for sound effects and music?
- SFX 44.1khz 16bit mono wav
- Music: I currently have all my songs in WMA, 64Kbps, but that can vary, can be MP3 or AAC, I don't have a good answerQ) How may sounds will I be able to play at a time?
- Exactly 2 SFX (it used to be 1, so be grateful!), plus any single background music track. I've written a complex SFX buffering/delay and priority system to make my game sound like it's doing more than 2, plus I've sometimes combined sounds into single files for use in specific cases when those two individual sounds would have played.

Q) Do we get access to hardware supported rotation, scaling?
- Theoretically there is unofficial capability on some Roku models for rotation. Scaling I believe is always possible, but I'm not sure. I use neither of these since I'm trying to make my game compatible with the widest array of Roku models possible, and also perform decently well on older models.
MC: Scaling is possible with roBitmap and roRegion check some functions using it at https://github.com/lvcabral/Prince-of-P ... meUtil.brs
Rotation is limited to 90 degrees steps, check https://sdkdocs.roku.com/display/sdkdoc ... tedObject(xasInteger,yasInteger,thetaasFloat,srcasObject)asBoolean

Q) Do we get access to hardware supported alpha blending, etc?
- There is alpha blending, but it's expensive as I understand it. I use it sparingly.
Q In the 2D world, I'm used to drawing the scene every frame. From back to front. Tile maps, background images, then sprites, etc. Would this be a similar process using Brightscript?
- That seems similar
MC: Yes, my Prince of Persia game was obviously a direct port of the old school 2D games, and it relies on this painting ordering to correctly show the perspective on the scenario.

Q) For brute rendering performance considerations, with a 1920x1080hd background, how many 32x32 sprites could be rendered and still have 60fps updating? I'm used to terms like "sprite batching" to increase performance. Is any of this applied when working with BrightScript?
- I really don't know, and it very heavily depends on the Roku model. I'm using 720p and I use 64x64 sprites and don't target 60fps so it's quite different. I'm probably drawing around 50-100 sprites on average, with very few moving or animating (maybe 5-10). In a big test room where I draw "everything", around 400 sprites are drawing, with around 30 animating (with just 4 frames each), and it runs smoothly only on the newest strongest Roku models, but brings older ones to their super slo-mo knees. But of course that room is nothing that would be encountered during the normal game.
MC: As Komag says, performance varies A LOT among all models, but good news, newer models are all coming with OpenGL support and fast processors.

Q) Can someone please give me a link where I can download "everything I need" to start programming in BrightScript? I can't find this information anywhere. lol.. Thx!
- There's not really anything to download, no tools suite per se. You just decide on an editor or IDE (I use simple old NotePad++) and off you go. Others have had a good experience with IDEs that do more such as packaging up your game to test run each time or tracking different projects. I guess I should mention that I also use PurpleBug (and there's VioletBug) for testing. Other than that, I just have a whole bunch of Rokus models (12!) that I periodically test on, but I mostly develop using one Roku TV which is convenient.
MC: I recommend using Visual Studio Code with this BrightScript Extension: https://marketplace.visualstudio.com/it ... ightscript
PurpleBug/VioletBug also is very useful. I don't have 12 Rokus, just own 4 of them :)
0 Kudos
2dguy
Level 7

Re: BrightScript Game Development Questions

Thank you for the replies! Smiley Happy
0 Kudos