Skip to main content
GameDev.net gamedev.net
🔒 Locked

request for comments on Rendering sprites on Symbian

Started by fardin Feb 23, 2005 at 2:21 AM 8 replies 1.7k views
Original Post
fardin
fardin
Hey guys, Just wanna pick some brains here... I've got a framework for doing rendering on S60 symbian phones. The way I am rendering sprites is loading in bitmaps and a correspondign mask for transparencies, use I'm using the BitBltMasked function. It works fine, but performance gets pretty abysmal once I have more sprites in the viewport. I do clipping to render my background as well as the sprites. My question is anyone has any suggestion about how to improve performance in that case ? 1. Write my own blitter ? 2. Use a different file format ? PNG ? TGA ? I'm tempted to write my own blitter, just want to to know if any of you guys have taken that route, how much success you've had, and how to get the most bang for the buck ? Thanks in advance for the replies.
serg3d
serg3d
The only ways to get acceptable performance is to write your own blitter or use some 3rd party library. No Symbian API (with exeption OpenGL ES in 8.0) would help.
Zabbas
Zabbas
And if You wanna really good preformance (because You're building comercial engine) You should think about implementing some things in assembler
Skizz
Skizz
If speed is really what you're after, you're best off creating an image format that doesn't have transparent pixels:
x,y offset ; distance to move drawing point to top most line; first line  x skip     ; number of destination pixels to skip  count      ; number of pixels to copy  pixel data ; the source image data  ; repeat above for whole scan line; subsequent lines  y skip     ; number of lines to skip    x skip     ; number of destination pixels to skip    count      ; number of pixels to copy    pixel data ; the source image data    ; repeat above for whole scan line  ; repeat until image complete

Since you're not doing per pixel transparency testing, the code is much more efficient.

If you want to speed up the clipping, draw everything to an offscreen (back) buffer which has a guard band big enough to cover most graphics:
################################################################################################################################################...........................########...........................########...........................####; and so on####...........................########...........................########...........................################################################################################################################################################

where '#' is the guard band pixels and '.' are the pixels which need to be blitted to the screen. If you make the guard band 40 pixels horizontally you can speed up the back buffer addressing since each line will be 256 pixels wide. Top and bottom can be less to save memory. Doing this reduces the number of images that need clipping, and since clipping is costly, you're reducing the overhead.

And write it assembler (although ARM Risc can be a pain!)

Skizz
OklyDokly
OklyDokly
I got a significant speed improvement when I converted my bitmap routine to assembler, I really would recommend it. There is a tutorial somewhere on the Symbian site which takes you through how to do this, it's about making an asteroids game for the Communicator I think.
Squirm
Squirm
You might want to look into GAPI draw - I do a lot of stuff with Symbian and the speed of GAPI amazed me.
fardin
fardin
I ditched Symbian's bltbitDraw and wrote something that does direct per pixel assignment from image to bback buffer, and my goodness.... what a tremendous jump in performance. And that's the very first level of optimisation. Also, I am using magenta to specify transparency, which means I have an if check for each pixel. Think I'll eventually write the something close to the file format suggested by skizz and port everything to assembly.

Squirm, the stuff I wrote is pretty much everything from scratch (one of the few things missing at the moment being a GUI/Font system, which is why I am not tempted to use an external party like GAPI. I even hooked in Simkin to be used as config files for the time being.
fardin
fardin
Is it this link, Okly ?

http://www.symbian.com/developer/techlib/apps/asteroids.html

I did n't see anything being mentioned about writing assembly for Symbian here.
The Alchemist
The Alchemist
try this then
http://www.newlc.com/article.php3?id_article=683&var_recherche=assembler
the asteroid one iirc uses external asm kinda nasty imho :pp
"Everything works out in the end, if it doesn't then it is not the end"
OklyDokly
OklyDokly
Sorry fardin, had a bit of a memory lapse the other day. It's not an asteroids game, but a shoot-em-up.

It tells you how to do it here:

http://www.symbian.com/developer/techlib/apps/9210game.html

If you're new to assembly, I recommend purchasing a book on the ARM architecture as well, to help you out.

I would recommend the technique mentioned in this article, over internal ASM code, since it is much easier to write readable assembly code this way, and involves less typing.

If you're wondering what to call your ASM routines, use:

abld armi listing

at the command lines, and refer to the listing files to view the ASM subroutine name, for the corresponding C function (make sure it isn't ignored by the compiler with a #ifdef __WINS__). It can also help, if you want to optimize some of your C methods.


Hope this helps and feel free to PM me if you get stuck on anything.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.