Once upon a time, I wrote some BASIC sprite displayers utilizing hex with a unique character, G, which would tell the displayer "Hey, this row is done, reset column to starting point and drop down a row". This was done to help reduce the size of sprites in general, and it worked well, for what it was meant for. This Hex2Sprite program was made available on the 83, 83+/84+, and CSE/CE calculators.

I decided to do some checking, and apparently I only ever made a monochrome version of Sprite2Hex, most likely because I began overthinking the project for the color screen calcs, and partially that was about the time I stepped out of programming calculators, which was for numerous reasons I won't get into here.

Now that I'm going for a full on upgrade of Age of Darkness for the Evo, I realized for the battle screen I'd like to use some form of sprites. Possibly. I'm still not 100% sold on it, but I'd at least like to try and see what can be done with the idea.

I've decided how I can go about creating the sprites on calc, which would in turn make them much easier to convert since I can directly manipulate the strings instead of just playing with the graph screen. So I'll be trying to get this made some what quickly, so I can see if I like how slow/fast sprites load up for the battle screen, and if we're going to end up wanting to use them or not.

Obviously the smaller the sprite, the faster it displays, so I'll be trying to keep it down to 16x16 or less, but the program will handle up to 32x32 sprites, using the on-calc colors.

WIP of the work area that I'm thinking of using, might need to bump the one border on the top up a little higher..

The idea is it will start all white, with a string of 1,024 0's, plus 2 characters for padding, 1 on each end of the string. Makes it easier on the coding side of things to manipulate the string. Just using the blue blocks to show where the work space will be.

I'll add a tool bar of some kind to the right to choose what color you want to use, and that value will be put to the string as you select the individual spots to place 'pixels'. I think the hardest part of this project will be having the calculator automatically truncate the ends of lines with 'G', but I'm sure I can figure something out.

I think I'd also like to be able to edit sprites, but that gets even more difficult, potentially, to re-materialize the data to the string.. We'll see, though.

Edit:

Didn't really take too long to set up the area where the sprite would be created. Was a little more complicated on the moving cursor around bit, but that was relatively easy once I knuckled into it. So far it properly generates a full 1026 character string for a 32x32 sized sprite with 2 padding characters.

The next function I need to work on is the.. For lack of a better term, 'encryptor', which will shave off un-needed white space to the right of the last color of a sprite, and replace all 0's with a singular G. I have an idea on how to accomplish this, we'll see how well it functions once implemented. Removing the padding characters is a breeze, no issues there for me to worry about.

So far you can

1) select your color of choice
2) switch to sprite editing mode
3) switch back to color selection
4) place a 'pixel' of your color choice and it stores to a string
5) you can Del a pixel and it reverts it back to whitespace

Edit 2:

Screenshot here

I managed to fashion up some code that perfectly matched my manual shortening of the sprite data. The only problem it suffers now is that I haven't given it an escape from the loop, nor can it eliminate the initial padding of the stored to string with the truncated data.

If you give me a moment, I'll post up a quick video (hopefully) showing me the fact it is doing things into the above link's thread.
Sprite2Hex Update!

I have made 4 enemy sprites, A snake, a slime, a rat, and a wolf. So far, it's properly compressed all 4 bits of data by removing strings of 0's (meaning empty pixels) and replacing the sometimes long string of 0s with a single G.

I'm going to test things out a bit more, then see about updating Hex2Sprite and possibly launching it to the broader world, incase someone would like it for their own Evo BASIC projects 🙂
Kerm found me a bug, which is on me, I was expecting people to start in the top left side of the building area and build from there :p Not doing so makes the compressor break because if there isn't anything on the first line, it stops looking for sprite data. So I need to change up the logics a bit, start at the ending and go backwards to what I am doing now.

Also adding in basic directions to use the program along side the right of the sprite box, since I hadn't gotten to that yet.
Excellent, thanks for that: the instructions will be helpful for first-time users. I'm only a little sorry for breaking it, if it means it becomes a more robust program. To carry over my suggestion from Discord, I'm also a sucker for a progress bar, in this case while it's compressing the sprite.

(testing if img will display..)

So I've set up a (I think) nice-ish looking display to show what buttons do what, so users will have that without a readme to work with. Do these descriptions help at all?

I still haven't updated the compressor bit, busy and exhausting days at work, leaving me quite unfocused when I get home.

Edit: 2nd should be placing pixel, not placing sprite. I'll fix that on my side <.<;


After a couple of days of trying to fathom how to not just read data from the end of the sprite and working up to compress it, I struggled mightily to get the calculator to do the simple checks to see if we needed to snip some data and replace with G, and go through the whole sprite. This idea was pushed by Kerm, which I genuinely thought was a good idea to do.

After several repeated failures, I decided that the first thing I needed to do was set up a test program to just read the sprite data in 32 character lines, then scroll through that data with the arrow keys, 32 characters at a time. Once I had that working, I was able to set up the compressor to mostly work. For some reason that I've not diagnosed yet, it adds an extra G in there.

My tired brain cannot compute why this is, will leave it for tomorrow, but I thought I'd keep ya'll updated. Will try to fix that issue and get it combined into the main Spriting program soon.


Code:
"+00000030000030000000000000000000000003A30003A30000000000000000000000036D333D6300000000000000000000000344DDDD430000000000000000000000003DD2E2300000000000000000000000003DEEEED3000000000000000000000003DDFEEEED30000000000000000000003DDFFFFFFF6300000000000000000003DDDD3F33333000000000000000000003DDFDD3FF300000000000000000000003DFFFD63F630000000000000000000003DF333D33D3300000000000000000003DDFF333D33D300000000000000000036443F33F33F30000000000000000003A6433F46A346A3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000+"->Str4
1026->W
"++->Str7
ClrDraw
While W>32
   sub(Str4,W-32,32->Str5
   32->theta
   Text(0,0,W
   
   While theta>0
      Text(12,0,theta
      Wait .25
      If theta>1 and sub(Str5,theta,1)!="0":Then
         sub(Str7,1,1)+sub(Str5,1,theta)+"G"+sub(Str7,2,(length(Str7)-1)->Str7
      1->theta:End
      If theta=1 and sub(Str5,theta,1)="0"
      sub(Str7,1,1)+"G"+sub(Str7,2,(length(Str7)-1->Str7
      theta-1->theta
      
   End:"theta0
   W-32->W
End:"W>32


The code currently as it sits for the compressor. Working on it to make it work, then I'll try to pretty it up.

Edit: Giving it a quick glance, I have a fix in mind, but again, it's time for the sleeping, and I'll do it tomorrow. Basically I just need 1 more variable, Will set to 1 every time it enters the W loop, if it runs across the first bit of code to set the G character, it sets it to 0.

Seems simple enough..
So I've fixed most aspects of Sprite2Hex, still need to add in some kind of progress bar or value when compressing the sprite. I need to pretty up the sprite displayer and clean up the code, and I'll see about getting it bundled and released.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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 vote in polls in this forum

 

Advertisement