Real Software Forums

Games using canvas.
Page 1 of 1

Author:  Carharttguy [ Thu Nov 10, 2011 3:05 am ]
Post subject:  Games using canvas.


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?

Author:  Bob Keeney [ Thu Nov 10, 2011 9:45 am ]
Post subject:  Re: Games using canvas.

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.

Author:  DaveS [ Thu Nov 10, 2011 11:31 am ]
Post subject:  Re: Games using canvas.

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)

Author:  Agent [ Sun Nov 13, 2011 9:03 pm ]
Post subject:  Re: Games using canvas.

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).

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group