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: 
YungBlood
Streaming Star

Thanks Team GandK!!!

I just gotta give a big shout out to kbenson for helping me greatly improve the speed in my kaboom game!

I'll have sudoku running faster by the end of the weekend. I also hope to have a new game up by Monday as well! 🙂
-Kevin
YungBlood

Bringing more fun to Roku!
0 Kudos
12 REPLIES 12
kbenson
Visitor

Re: Thanks Team GandK!!!

You are very welcome!
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
renojim
Community Streaming Expert

Re: Thanks Team GandK!!!

Can you explain the technique you used to speed it up?

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
kbenson
Visitor

Re: Thanks Team GandK!!!

"renojim" wrote:
Can you explain the technique you used to speed it up?


I don't know what he actually ended up going with, but I gave him pointers on how to utilize multiple canvas objects for increased performance. His kaboom game has the added benefit of being laid out so he doesn't actually have to call show on the lower canvas objects most the time since there's little overlapping. It boiled down to "use a different canvas for the cursor, and re-draw a black cursor int the previous position.

From your previous posts, and the performance of the Video Poker channel, I suspect you are already doing this.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
TheEndless
Channel Surfer

Re: Thanks Team GandK!!!

"kbenson" wrote:
"renojim" wrote:
Can you explain the technique you used to speed it up?


I don't know what he actually ended up going with, but I gave him pointers on how to utilize multiple canvas objects for increased performance. His kaboom game has the added benefit of being laid out so he doesn't actually have to call show on the lower canvas objects most the time since there's little overlapping. It boiled down to "use a different canvas for the cursor, and re-draw a black cursor int the previous position.

From your previous posts, and the performance of the Video Poker channel, I suspect you are already doing this.

I'm curious... when I tried using multiple canvases to draw the screen, I found that only the last canvas was redrawn after the screensaver was canceled. Did you find a way around that?

EDIT: I just tested with KidPaint, and it seems the drawing gets erased when you return from the screensaver. Initially just the cursor can be seen (painted on top of the screensaver data). The background and tools redraw eventually when you move the cursor around, but anything you drew previously does not. I'm guessing it's hidden behind the background canvas at this point. Something worth considering, if you decide to use the multiple canvas technique.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
renojim
Community Streaming Expert

Re: Thanks Team GandK!!!

That's why video poker has a private screensaver. 😉 When the box awakens from the screensaver, I draw both canvases.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
TheEndless
Channel Surfer

Re: Thanks Team GandK!!!

"renojim" wrote:
That's why video poker has a private screensaver. 😉 When the box awakens from the screensaver, I draw both canvases.

How do you detect a return from screensaver? Are you writing something to tmp or the registry?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
kbenson
Visitor

Re: Thanks Team GandK!!!

What we did is just track the time between messages. If it has been more than 5 minutes (minimum time for screensaver) since the last message, we trigger a show of all visible canvas objects, in order.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
TheEndless
Channel Surfer

Re: Thanks Team GandK!!!

"kbenson" wrote:
What we did is just track the time between messages. If it has been more than 5 minutes (minimum time for screensaver) since the last message, we trigger a show of all visible canvas objects, in order.

I noticed that KidPaint did that on the second keypress after the screensaver, but I don't like the idea of requiring the user to press a button twice to properly redraw after the screensaver. It makes some sense in KidPaint, since you're actively interacting with the channel, but not really in any of my audio channels. The route I took originally was to write an update to a tmp file every second, and then poll for that in my main app, but that felt too much like a hack (not that anything else being discussed here doesn't also feel like a hack).

Also, did you see my note above about the drawing getting erased in KidPaint after the screensaver? Is that down to the timing between painting canvases, which seems to be completely unpredictable?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
YungBlood
Streaming Star

Re: Thanks Team GandK!!!

"kbenson" wrote:
"renojim" wrote:
Can you explain the technique you used to speed it up?


I don't know what he actually ended up going with, but I gave him pointers on how to utilize multiple canvas objects for increased performance. His kaboom game has the added benefit of being laid out so he doesn't actually have to call show on the lower canvas objects most the time since there's little overlapping. It boiled down to "use a different canvas for the cursor, and re-draw a black cursor int the previous position.

From your previous posts, and the performance of the Video Poker channel, I suspect you are already doing this.

Yup, I'm now using 3 canvases. First one is black screen & message on the side. Second is the board. And third is the cursor. And I'm using the timer to force a full redraw whenever the wait has been 5 minutes or longer.
YungBlood

Bringing more fun to Roku!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.