Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Sep 19, 2017 6:44 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Games using canvas.
PostPosted: Thu Nov 10, 2011 3:05 am 
Offline

Joined: Wed Sep 17, 2008 2:45 pm
Posts: 220
Hello

I'm doubting about a game we're developing.
Normally, the client would be pure Flash, but I'm thinking to port it over to RB.

But: I don't know what to use to draw the sprites.
Is canvas fast enough?

It are 2D sprites that i'm using, like this one: Image

I will use an alpha channel, and there can be quite some sprites on the screen. It is a MMORPG, so there isn't much space for lag.

Anyone has a clue of what drawarea I should use?

_________________
My native language is not English.


Top
 Profile  
Reply with quote  
 Post subject: Re: Games using canvas.
PostPosted: Thu Nov 10, 2011 9:45 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
I believe you can use the Canvas to do this. Instead of doing all the drawing in the canvas.paint event, I would use a picture object as a buffer and then all of your drawing is done to the picture instead and all the canvas has to do in the paint event is to draw the picture.

If speed is a huge concern, I think you will end up coming up with an algorithm to update only those portions of the picture that need to be updated rather than drawing everything over again.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Games using canvas.
PostPosted: Thu Nov 10, 2011 11:31 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
another idea (and I've used this one in the past)

If your "scene" has a number of layers (forest background, characters foreground for example)
create multiple picture objects..... and in the CANVAS paint event.... lay them down in order...
making sure each layer has a transparent (white) area or a mask. I prefer to use white because it is easier...
and have found replacing what I WANT to show as white with (&cFEFEFE instead of &cFFFFFF)

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Games using canvas.
PostPosted: Sun Nov 13, 2011 9:03 pm 
Offline

Joined: Fri Sep 30, 2005 11:19 am
Posts: 275
Yes, you could use a Canvas, but for games with many sprites (esp. if they are using alpha masks with a larger spectrum of depth than only on and off) and smooth scrolling I've found it to be rather slow. I would suggest using OpenGL instead, and if you are unfamiliar with OpenGL use SuperSpriteSurface 2 (which itself uses OpenGL, behind the scenes).

_________________
"If you look carefully at my lips, you'll realize that I'm actually saying something else."
Brainswitch Machina - REALStudio/REALbasic
RBScriptExtender - give RBScript power to work with any class


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group