Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sprite saving styles...
#1
When I look at sprite files in notpad saved through BSAVE. I see a bunch of wird characters, but they reduce the file size. What are they doing?
Reply
#2
well, sprites/images aren't stored as text and use the full range of 8bit characters. Some of them look weird or not at all in windoze notepad.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#3
Sprites are completely meaningless when read in text form. You don't need to worry about whatever wierd ascii characters BSAVE spits out - there's no easy way to edit them without using qbasic.
img]http://b.domaindlx.com/cygh/mycophob3.gif[/img]
Reply
#4
bsave doesnt compress, and except for a 7-byte header, it doesnt waste space. you see, you can only plot 256 different colors anyway. and there happens to be 256 different characters in a string. So BSAVE says "hmm... why not just store the image in one massive string of characters, with each characters ASCII value being the color of the pixel it represents". And God said "Let there be a BSAVE dump", and He was pleased.

When you compress something, you're actually representing repeated patterns as one character. the decompressor reads the patterns, and turns it back into an image. think of it like this. this is a long post. but let's say you turn every instance of "and" with "xx", every instance of "you" with "xy", and every instance of "bsave" with "xz". the post gets a little bit smaller. This is how real image compression works.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#5
Sorry, I've been doing so much, my responses have been a bit slow...

So, is there any method to saving the sprite in the way that most sprite editors save them? Or do I have to save them number by number?
Reply
#6
Most QB sprite editors just use BSAVE to make a binary copy of your array in a file.

Code:
DEF SEG=Array%(0)
BSAVE "filename", VARPTR(Array%(0)), size%

Being size% the size of your array in bytes. With integer arrays from 0 to UBOUND, it is 2*(UBOUND+1).
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#7
Well, i think there is a missunderstanding of the concept data here. Data is just values, it makes sence only if interpreted in the right way. What you see is just a bunch of values. It just so happens that notepad or whatever displays those values as ascii characters since it is a texteditor. A byte could simply be a one byte integer, or a ascii charachter or simply something else. It's all a matter of how you interpret it. There is no memory or file type for integer or string. Anyway, the bsave format is a header followed by the pixels as they are in memory. Each one byte represents a pixel in 8 bit. There's no more to it then that.
oship me and i will give you lots of guurrls and beeea
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)