Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: V1mes on August 30, 2012, 01:34:37 pm

Title: Bitmaps or sprites?
Post by: V1mes on August 30, 2012, 01:34:37 pm
Question: which is faster - bitmaps or a 8x8 sprite array of similar size?
I know this question has been asked before but that was before ver 1.1.2 wasn't it?
Title: Re: Bitmaps or sprites?
Post by: Deep Toaster on August 30, 2012, 01:39:47 pm
I'm guessing it's bitmaps, otherwise the bitmap routine would just use sprites.
Title: Re: Bitmaps or sprites?
Post by: V1mes on August 30, 2012, 01:42:16 pm
 ;D
That's an excellent point...

Slightly off topic, is there a tool where you can edit bitmaps like in tileIt! ?
Title: Re: Bitmaps or sprites?
Post by: Deep Toaster on August 30, 2012, 01:46:02 pm
The best tool for drawing stuff is probably the graph screen, using the drawing commands.

That's what I've always used. To convert part of it to a bitmap I would usually just write a quick TI-BASIC program on the fly—I never bothered to save it because it's pretty easy to make again when I needed it. I'll come up with something for ya in a bit :)
Title: Re: Bitmaps or sprites?
Post by: V1mes on August 30, 2012, 01:47:18 pm
*bows

EDIT: I think I'll write an anim tool then. I was considering a fighting game, hence the large sprites, and these games are pretty anim intense
Title: Re: Bitmaps or sprites?
Post by: Hayleia on August 30, 2012, 02:04:48 pm
You can also draw them with the software you want on your PC, then save them in png and convert them into hex code using SourceCoder on Cemetech ;)
Title: Re: Bitmaps or sprites?
Post by: Runer112 on August 30, 2012, 02:10:35 pm
I think the speed results may not be what you expected. In the following table, DrwXX is a custom routine that draws the image as a series of 8x8 sprites using Pt-On(), and BmpXX draws the image using Bitmap(). The numbers under each of these columns is cycles taken (fewer is faster).


X       Y       Drw16   Bmp16   Drw24   Bmp24   Drw32   Bmp32   Drw64   Bmp64
0       0       3647    12881   9574    24981   14986   41013   75653   144460
1       1       6599    13799   13797   26814   20944   44068   89311   153035
7       7       11414   21017   18544   41256   29823   68137   89382   215672


As you can see, bitmap drawing is actually much slower than drawing a series of 8x8 sprites, because the routine has to keep track of more values, it uses a variable drawing mode, and other things. However Deep Thought raises a good point that there's no reason this should be slower than cobbling together a bunch of smaller sprites. I've made a note to attempt to vastly improve this routine.
Title: Re: Bitmaps or sprites?
Post by: Deep Toaster on August 30, 2012, 02:11:15 pm
USAGE: {<x1>,<y1>,<x2>,<y2>:prgmBITMAP

Quote from: TI-BASIC
Ans→L1
"[
For(A,L1(2),L1(4))
Ans→Str1
For(B,L1(1),L1(3),8)
For(C,0,1)
0
For(D,0,3)
2Ans
If B+4C+D≤L1(3
Ans+pxl-Test(A,B+4C+D
End
Str1+sub("0123456789ABCDEF",Ans+1,1→Str1
End
End
Ans+"][
End
sub(Ans,1,length(Ans)-1
Title: Re: Bitmaps or sprites?
Post by: V1mes on August 31, 2012, 12:53:47 pm
Excellent!
Though can it be done in axe, especially without the sub( command...?

I await the bitmap update  ;D
Title: Re: Bitmaps or sprites?
Post by: merthsoft on August 31, 2012, 12:56:04 pm
You can also draw them with the software you want on your PC, then save them in png and convert them into hex code using SourceCoder on Cemetech ;)
For what it's worth, TokenIDE will do this as well if you want an offline solution.
Title: Re: Bitmaps or sprites?
Post by: Hayleia on August 31, 2012, 01:04:37 pm
You can also draw them with the software you want on your PC, then save them in png and convert them into hex code using SourceCoder on Cemetech ;)
For what it's worth, TokenIDE will do this as well if you want an offline solution.
It depends ;)
For big bitmaps in greyscale, I find it better to draw with Paint.NET (for example) and convert them with SourceCoder.
But yes, I use TokenIDE's sprite editor for little sprites or for bigger sprites when they are black and white. It is really useful because I can include the hex code directly to the source :D
Title: Re: Bitmaps or sprites?
Post by: merthsoft on September 04, 2012, 04:27:59 pm
Ah, yes, good point. On top of all the other things I should add to it, I should add greyscale sprite editing.