Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Komag
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

Nice, I tested it with Lode Runner (the new 0.17) and it runs great! I think I found a small bug with the game, when I press * for an extra life, the number doesn't change in the game, so I pressed it again, still no change, then I pressed / to restart the level, and my number of men went UP one. Thus I think * is increasing the number of men just not showing it, so I had increased it by two, then naturally decreased one when restarting the level with /

The emulator doesn't work with my game, probably various reasons of me not setting it up correctly. I do see the splash screen image correctly for a couple seconds, then it goes away to a blank black screen.
0 Kudos
marcelo_cabral
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

"Komag" wrote:
Nice, I tested it with Lode Runner (the new 0.17) and it runs great! I think I found a small bug with the game, when I press * for an extra life, the number doesn't change in the game, so I pressed it again, still no change, then I pressed / to restart the level, and my number of men went UP one. Thus I think * is increasing the number of men just not showing it, so I had increased it by two, then naturally decreased one when restarting the level with /

The emulator doesn't work with my game, probably various reasons of me not setting it up correctly. I do see the splash screen image correctly for a couple seconds, then it goes away to a blank black screen.

Before loading the zip file, right clock and choose "Inspect" to open Chrome Developer Tools, and click on the "Console" tab. Then load your zip and check the errors that will pop up. I'm now making Prince of Persia compatible, and started a list of changes needed, for the current state of the emulator. Send me a list of the errors I can advise you what to do.
0 Kudos
marcelo_cabral
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

The current main limitations are:
- roUrlTransfer - Not supported
- roXMLElement - Usage of @ to access attributes from roXMLElements
- roXMLElement - creation of sub elements and attributes
- RAF Components - Not supported
- roUniversalControlEvent can't be compared to integer
- Integer .toStr() method is still not supported, create your own function for that.
- Tokenize() is not implemented, replace it with Split()
- Undocumented parameter rgba in DrawObject() method not supported
- Reserved words like "mod" cannot be used as variables (Roku does allow that)
- Dim statement to create multi-dimensional arrays is not supported

Also there is a bug on the interpreter that messes up with if clauses when you have a if..then in a single line nested, my advise, for now do not use if then  in a single line at all, until this is fixed.

Most of those limitations will be addressed, but that's what we have for now, another issue (visual only)  is that the alpha (transparency) is not working as in Roku, sometimes things  "leak".
0 Kudos
squirreltown
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

I've gotten one channel to show the splash screen,  and then nothing after. It's got about 20 errors like this:

index.ts:156 source/mediarsstoolkit.brs(175,35-36): Unexpected character '@'g @ index.ts:156

and one of these:

index.ts:156 source/main.brs(23,4-19): Attempting to retrieve property from non-iterable value  left: Invalid

This is just the landing page for a media player, it's pretty old.  My serious animation projects get 200-300 errors.

ETA: "- Undocumented parameter rgba in DrawObject() method not supported"
Pretty sure it's actually documented now. Shocking right? Anyway, none of my stuff will run without this.
Looks cool though.
Kinetics Screensavers
0 Kudos
marcelo_cabral
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

"squirreltown" wrote:
I've gotten one channel to show the splash screen,  and then nothing after. It's got about 20 errors like this:

index.ts:156 source/mediarsstoolkit.brs(175,35-36): Unexpected character '@'g @ index.ts:156

and one of these:

index.ts:156 source/main.brs(23,4-19): Attempting to retrieve property from non-iterable value  left: Invalid

This is just the landing page for a media player, it's pretty old.  My serious animation projects get 200-300 errors.

ETA: "- Undocumented parameter rgba in DrawObject() method not supported"
Pretty sure it's actually documented now. Shocking right? Anyway, none of my stuff will run without this.
Looks cool though.

Thanks for the feedback. Some comments about it:
The @ issue is the XMLElement limitation I mentioned above, you would need to access it using getattributes() method.
The "left invalid" means some object is invalid on the line described, it can be consequence of the issue above (or not)
BTW no media playback or SDK1 objects are supported only pure Draw2D SDK and vanilla BrightScript.
The "undocumented" is because the new SDK documentation was poorly migrated and they messed up completely the ifDraw2D documentation, I reported on the thread here already. And I will add the rgba parameter soon, I also use it on Prince of Persia for cross fading in several places
0 Kudos
Komag
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

i know I have a lot of Integer.ToStr() instances, and I also surely have a lot of IF, THEN in a single line all over the place, so maybe I'll wait for an update.

I checked the first couple errors
- One is an IF THEN on single line
- The next is complaining about text in a comment of mine, since the comment contains "If"! I have LOTS of comments all over my code, so I wonder if that will cause other problems.
0 Kudos
marcelo_cabral
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

"Komag" wrote:
i know I have a lot of Integer.ToStr() instances, and I also surely have a lot of IF, THEN in a single line all over the place, so maybe I'll wait for an update.

I checked the first couple errors
- One is an IF THEN on single line
- The next is complaining about text in a comment of mine, since the comment contains "If"! I have LOTS of comments all over my code, so I wonder if that will cause other problems.

Can you send me a private message with pieces of your code from both issues above? 
I want to reproduce here.
0 Kudos
marcelo_cabral
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)



I released the first prototype of the emulator (0.1.0 Alpha) and adapted my games (Prince of Persia and Lode Runner) to run on it. The performance is not great, as this is an interpreter running in javascript, it depends a lot on the current load of your browser and machine. The multi-room modes of PoP are really slow on the emulator.

Only Chromium based browsers are supported (more info on the link below) Please try it and give me your feedback, to run the games and the demo just click on the icons, it will download the zip and run it automatically. You can also still load your own code. This is a client-only application, no file is uploaded to the server, if you want you can get the latest release on the repository.

https://lvcabral.com/brs
0 Kudos
squirreltown
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

/brs/lib/brsEmu.min.js:33 source/Main.brs(11,25-26): 'SetPort' is not a function and cannot be called.

             
m.screen.SetPort(m.port)

I've made a stripped-down thing, with stuff commented out, and got all the way to drawobject, so I'll have to wait for that one.
Kinetics Screensavers
0 Kudos
marcelo_cabral
Roku Guru

Re: BrightScript Draw 2D Emulator (in development)

"squirreltown" wrote:
/brs/lib/brsEmu.min.js:33 source/Main.brs(11,25-26): 'SetPort' is not a function and cannot be called.

             
m.screen.SetPort(m.port)

I've made a stripped-down thing, with stuff commented out, and got all the way to drawobject, so I'll have to wait for that one.

You can use setMessagePort() what component m.screen is ? a roScreen ? The documentation only mentions setMessagePort() and I always used it, not aware of SetPort()
https://developer.roku.com/docs/references/brightscript/components/roscreen.md
https://developer.roku.com/docs/referen ... ageport.md
I published today the full support for custom fonts, it was relying on the OS fonts only, next thing I will do will be the rgba on DrawObject()
Thanks for the feedback! 
0 Kudos