This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Graphics and "IF" statements...


Graphics and "IF" statements...

Postby brendan » Feb 8, 2002 @ 12:02am

User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby MirekCz » Feb 8, 2002 @ 12:32am

With best regards,
Mirek Czerwinski
User avatar
MirekCz
pm Member
 
Posts: 269
Joined: Sep 18, 2001 @ 6:42pm
Location: Poland,city Poznań


Postby brendan » Feb 8, 2002 @ 7:08am

User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby MirekCz » Feb 8, 2002 @ 1:19pm

With best regards,
Mirek Czerwinski
User avatar
MirekCz
pm Member
 
Posts: 269
Joined: Sep 18, 2001 @ 6:42pm
Location: Poland,city Poznań


Postby MirekCz » Feb 8, 2002 @ 1:20pm

With best regards,
Mirek Czerwinski
User avatar
MirekCz
pm Member
 
Posts: 269
Joined: Sep 18, 2001 @ 6:42pm
Location: Poland,city Poznań


Postby Digby » Feb 8, 2002 @ 7:19pm

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby MirekCz » Feb 9, 2002 @ 12:54am

sorry, but I don't understand, immediate data??? what's that? my poor english...
what I were pointing to is that source is a tile data without empty spaces (for 3d iso tiles etc) and dest is backbuffer/frontbuffer/whatever he feels it should go to... so what's wrong with it???


or do you mean using precompiled code like this:
*dest=20;
dest++;
*dest=30;
etc?
well I don't know how to code it propertly in C(so you can load images from files etc) and it takes more memory to store. (and I would guess the speedup isn't really worth it most of the time)
With best regards,
Mirek Czerwinski
User avatar
MirekCz
pm Member
 
Posts: 269
Joined: Sep 18, 2001 @ 6:42pm
Location: Poland,city Poznań


Postby Digby » Feb 9, 2002 @ 2:31am

Mirek,

You understood me correctly. I was referring to writing hard-coded values into the frame buffer rather than reading them from another buffer (sprite). This is also known as "pre-compiled sprites." I'm not a fan of using this scheme, but I thought I'd throw out the idea for discussion.
Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


mmmm.

Postby brendan » Feb 9, 2002 @ 4:13am

well currently I've got 64 background tiles, and i'm sure im going to have over 200 by the time I finish, sorry, I can't see myself hand coding 200+ tiles :)

-brendan
User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby Digby » Feb 9, 2002 @ 8:37am

I agree with you, I can't see anyone doing this either for a large number of tiles. Unless all of your tiles shared the same transparent pixels, then even what Mirek suggested is going to be a lot of work.
Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby refractor » Feb 9, 2002 @ 9:03am

Brendan,

The idea with "compiled sprites" is not to compile them yourself. You write a simple generator, give it your tiles, and it'll give you the code to plot each individual tile.

However, from my point of view, they have more disadvantages than advantages. The generated code will be large (between 1/4 and 3 instructions per *pixel*).. not fun .. say an average pixel takes 2 instructions (a MOV and a STRH)

32*32 = 1024 pixels
1024 * 4 * 2 = 8192
= 8KB/tile..

which is going to *shaft* the cache.

The afore-mentioned RLE scheme would/will probably be the one I'd go for, certainly for partially-transparent tiles.

Another scheme that would work would be to store a mask bit for each pixel in the tile, and use a bitwise AND and OR with the screen data to plot it... the only disadvantage is that you have to load what you've already written to the screen when you plot (but if you're writing in scanlines then it should be in the cache). Obviously it's not as space-efficient as the RLE method.

I always strive for a zero-overdraw method, but for some tile-based engines it simply isn't efficient (because blasting entire tiles to the screen and overdrawing is faster than scan-lining the tiles, I reckon ... it's less complicated, certainly :-D ).

Sorry, I'm waffling again,

Refractor.
User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Postby MirekCz » Feb 9, 2002 @ 9:44am

digby:nah, why do you think my code will be a lot of work? It's pretty simple. Both the loader and bitmap drawer can be written in 15-30mins.
And you get a nice speedboost (no need for if's and only ~half the amount of pixels is drawn) and save some memory too.
The RLE alpha-compression is tricky. It's hard to code and for pure tiles the algorith above is better. But for objects over the 3d-iso tilemap (and all sprites with a decent amount of fully transparent pixels) it's a huge speed gain.
My 80x86 version works often FEW TIMES FASTER then a normal if version. It often works much faster then a normal bitmap copy(without transparency) because of all the data you DON'T HAVE to copy.
If anyone is interested I can present both my 80x86 asm code and a general approach used in my code(so you can do your own RLE sprites, but as said, it's not easy to implement)
With best regards,
Mirek Czerwinski
User avatar
MirekCz
pm Member
 
Posts: 269
Joined: Sep 18, 2001 @ 6:42pm
Location: Poland,city Poznań


Postby Digby » Feb 9, 2002 @ 5:56pm

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby Digby » Feb 9, 2002 @ 6:07pm

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby refractor » Feb 9, 2002 @ 7:14pm

User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

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
You cannot post attachments in this forum