Author Topic: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?  (Read 9548 times)

0 Members and 2 Guests are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Ok, so calc84maniac suggested something interesting on IRC just now that involves the usage of pictures to store data instead of using lists, matrices and variables. Someone talked about this before somewhere for use on older calcs, because if for example all data are multiples of 8 that can range within 8 values, then each data would take 1 byte of RAM instead of the 9 bytes each list elements take, something that could have been handy for games that has an extremely large amount of enemy data, for example, as long as the entire pic is used in order to not waste space. Of course, by using such method of data storage, you sacrified parts of the graph screen, so it was more useful for ASCII games in most cases. Also such technique might be very slow if the data has to be accessed in that form very often so it would be best to uncompress it only when needed.

Now on the TI-84 Plus C Silver Edition we face the issue of having around 2500 bytes fewer RAM, limiting space even more for unarchived data loading. However::

1) What if 84+CSE pictures could be recalled directly from the archive like images?
2) What if the Pxl-Test() command still existed?

Basically, you could stream data directly from archive!

Not only that, but if Pxl-Test was upgraded to make the difference between each color, then you could store even more data in 1 pic! O.O

So far we still don't know if the 2 criterias above will be met, but if they do, what do you think about his idea? And do you have any example of code using such technique on the TI-84 Plus? I had some ideas although I'm going to bed soon, but basically it would still be possible to have dozens and dozens of different values using only 8 pixels, and if the resulting numbers are too low, then all you have to do after uncompressing the data is multiplying them.



And of course if you need accurate values access, you could use 27 pixels for values from 0 to 999, where the first 9 pixels are for 0-9 (0 being no pixel turned ON), the next 9 are for 00-90 and the last 9 for 000-900

What do you think?
« Last Edit: February 15, 2013, 02:46:13 am by DJ_O »

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #1 on: February 15, 2013, 02:46:02 am »
Someoneone here actually had a program that used pictures to store data on the ti 83 series iirc. It may have been finale ti, but I cant remember. I've also conidered this before since pxl test is uber fast, but ive never done anything with it.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #2 on: February 15, 2013, 02:48:11 am »
Yeah, same since it was brought up far after I stopped BASIC. However I wish I knew it back then since my RPG map data didn't fill pics completely. I could have added even more monsters maybe.

Also I edited my post with a pic showing an example of enemy data compression, but that wouldn't be handy for save data so for numbers from 0 to 999, I posted another suggestion.

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #3 on: February 15, 2013, 04:01:23 pm »
Not really sure about this, since recalling data from the graph screen might take up a considerable amount of space, and it does take up the graph screen, making things look ugly. I think making each pixel a bit would be viable, though.
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #4 on: February 15, 2013, 05:49:12 pm »
Yeah it depends of the calculator. On the 84+ series it's very common for games to not use the graph screen at all, so you can store data on the graph screen (and pictures) as you wish. If you absolutely need to use the graph screen for the game, then something you can do is store your data in a part of a picture and other stuff in the other part. If there isn't much data in the pic, just erase it with Line() or something.

And of course, there are other creative ways to sneak data into games, even using it for graphics! For example, let's say that your RPG has a dozen of enemies with 5 stats, where HP takes 8 pixels, Exp 4, Gold 4, ATK 4, DEF 4, the possible attacks 5 and the sprite ID 3. This means 32 pixels per enemy. If, for example, that RPG has 13 enemies/bosses total, then just make a nice title screen with a border and store the data INSIDE the border. Since in such case the data only fills 1/4 of the border (the top-left part of the screen), then just mirror the data on the right part then the 2nd half! :D



Then your data takes zero space (only the routines to uncompress it do), since it's just part of your 779 bytes title screen. (or 767 if you don't use the last row)
« Last Edit: February 15, 2013, 05:50:38 pm by DJ_O »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #5 on: February 15, 2013, 06:39:37 pm »
Pretty interesting idea.
* Sorunome lost >.<

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #6 on: February 16, 2013, 04:19:31 am »
Indeed. Also for the example above one thing that might be best for some data is to make it so it is guaranteed to start at 1, else it remains at 0 anyway due to 0 being multiplied by anything giving 0 :P. That way you save 1 pixel.

Another wacky data storage idea if you really don't mind strange enemy data is if your tilemaps are stored inside pics and you have a map like a forest with strange paths and no rectangular areas, then you can just use those pixels to store enemy data. :P (But then you better have your maps so that there are no risk of seeing a LV1 enemy with 40000 HP, 2 attack, giving 9000 gold and 1 experience point, followed by a LV 30 one with 2 HP, 10 attack and giving 1 gold :P).

In any case, this technique would be very handy if you're creative. But if you don't have much data to store, then it might be a waste of space if you can't manage to keep the decompressing routines code+compressed data itself smaller than how the data would be if uncompressed.
« Last Edit: February 16, 2013, 04:25:23 am by DJ_O »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #7 on: February 16, 2013, 07:39:15 am »

Great idea, I even think it ads a nice feeling to the image :)
(However, why is there an option to lose ? Do we really have the choice ? :P)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #8 on: February 16, 2013, 07:46:54 am »
Instead of using 27 pixels for a number like 999, you can use only 10 by storing it as binary. Then again, if it is 16-bit color and pxl-Test( can return the precise value, then you will only need one pixel.

I have made BASIC programs that convert pictures to lists or lists to pictures, too :D I remember I used a picture to store all of the game data for an RPG once and the save screen was kind  of cool because the user could watch their data being modified ^_^

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #9 on: February 16, 2013, 10:21:33 am »
However, you can draw only in 16 colors. If we can use pxl-Test on 16-bit color images, then nice for us. If we can use only 16 colors, then...
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #10 on: February 16, 2013, 01:12:30 pm »
Then that is still 4 bits :] and that means 12-bit numbers can fit in 3 pixels so 0~4095 :D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #11 on: February 16, 2013, 01:50:24 pm »
Also according to a TI-Planet news pictures are always 21 KB in size on the color calc, which might not make this technique as efficient if pxl-test can't detect different colors (and even if it can, it might still be inconvenient since 2 pixels takes 1 byte of RAM), but there still remains the fact that they are archived, so much less Garbage Collecting.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #12 on: February 16, 2013, 02:31:06 pm »
It would be so awesome if pxl-test() returned the pixel color

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #13 on: February 16, 2013, 02:32:27 pm »
And as a number, hopefully x.x It wouldn't be nearly as useful if you had to do something like:
Code: [Select]
If Green=pxl-Test(Y,X

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: 84+CSE BASIC using pics+Pxl-test for data storage as low RAM workaround?
« Reply #14 on: February 16, 2013, 02:33:35 pm »
I think that the new color tokens just return a number so that would be the same then as
If <greennum>=pxl-Test(Y,X

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!