Author Topic: Strings>lists [BASIC variables]  (Read 3883 times)

0 Members and 1 Guest are viewing this topic.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Strings>lists [BASIC variables]
« on: September 30, 2007, 12:55:00 pm »
Why is it that strings are so much smaller than Lists or matrices with the same number of elements, does anyone know? strings are like 10 times more efficent! What gives?

Insanity

  • Guest
Strings>lists [BASIC variables]
« Reply #1 on: September 30, 2007, 12:58:00 pm »
Because lists' elements are either real numbers which use about 12 bytes each or complex numbers that use 18 bytes each (I think).
Strings only use one byte per character (unless the caracter is a two-byte token).

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Strings>lists [BASIC variables]
« Reply #2 on: September 30, 2007, 01:02:00 pm »
which is why some people prefer to use strings for tilemaps. It's much faster to render than matrices or lists when using text based sprites art but it's slower for graphical sprite art (you need to use xLIB to get 0.01 second rendering)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline magicdanw

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Strings>lists [BASIC variables]
« Reply #3 on: September 30, 2007, 01:41:00 pm »
I saw an interesting solution to this problem of fast graphical sprites, over at unitedti.  I forget who posted it, but the idea was to create an Omnicalc font that includes the sprites you want to display, and install the font before running the game.  That way, the sprites can be displayed like normal characters.

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
Strings>lists [BASIC variables]
« Reply #4 on: September 30, 2007, 02:15:00 pm »
QuoteBegin-magicdanw+1 Oct, 2007, 0:41-->
QUOTE (magicdanw @ 1 Oct, 2007, 0:41)
I saw an interesting solution to this problem of fast graphical sprites, over at unitedti.  I forget who posted it, but the idea was to create an Omnicalc font that includes the sprites you want to display, and install the font before running the game.  That way, the sprites can be displayed like normal characters.  

 I was going to do that for my dead Super Mario ASCII...
One of these days I'll get a sig I'm really proud of.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Strings>lists [BASIC variables]
« Reply #5 on: September 30, 2007, 02:25:00 pm »
yeah Omnicalc font is a good idea, but the problem is that they take lot of RAM and Omnicalc make BASIC programs slow down to 75% of their normal speed just when installed. I find dual layered ASCII (using two fonts at once for tiles) to be more efficient nowadays, on top of that it's pure BASIC
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Strings>lists [BASIC variables]
« Reply #6 on: September 30, 2007, 02:52:00 pm »
ok,that makes sense. Why would strings cause a slow down when used with sprites instead of text though?

Harrierfalcon

  • Guest
Strings>lists [BASIC variables]
« Reply #7 on: September 30, 2007, 02:58:00 pm »
Because either you have to hard-code each sprite, or use some other string-to-sprite method.

If it's text, you can just output the string directly to screen.

[self-centered]

A good example is http://www.ticalc.org/archives/files/fileinfo/401/40108.html: It uses strings, not matrices, for each map. You'll notice the maps load faster than most tilemapped pure Basic game.

[/self-centered]

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Strings>lists [BASIC variables]
« Reply #8 on: September 30, 2007, 03:01:00 pm »
Using strings with a graphical map editor is slow because there's no assembly program to do it instantly (xLIB only deal with matrices). And when using Metroid Pi style you can display an entire horizontal line of sprites at once, so it takes one second to render with dual layer ASCII sprites. With simple ASCII like in Tifreak8x RPG starter kit (which you should really check btw) it take less than a second so on a SE calc you can even have scrolling map
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Strings>lists [BASIC variables]
« Reply #9 on: September 30, 2007, 03:11:00 pm »
Ahh its a shame xlib doesnt support strings :(sad.gif. ANy idea what kind of speed you'd get on an 83+ BE? I dont have an se. I'm also unsure of what u mean by "dual layer" Do you mean it continusly alternates between 2 differnt sprites in order to create a diffrent looking sprite?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Strings>lists [BASIC variables]
« Reply #10 on: September 30, 2007, 03:21:00 pm »
on BE it's almost instant with xlib and matrices, 2-30 seconds with xLIB and strings (have to draw each sprites one by one and deal with several If:Then:Else:End), 1 second with pure BASIC and dual layer, 5 or 6 seconds with pure BASIC and matrices

DUal layer means you display a map (it only works fine with strings), store it to let says Pic0, then display the map using another string (generally all walk onable areas are white and those you cannot walk on are a different wall tile) and then you recall Pic0 and store it again. It can create nice results sometimes.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Strings>lists [BASIC variables]
« Reply #11 on: September 30, 2007, 03:32:00 pm »
so it allows you to create unique non text looking tiles using ascii text?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Strings>lists [BASIC variables]
« Reply #12 on: September 30, 2007, 04:08:00 pm »
yep, there's lot of combination possible. Vuurrobin is currrently working on a map editor allowing combination of various ASCII chars so it's easier to use
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Harrierfalcon

  • Guest
Strings>lists [BASIC variables]
« Reply #13 on: September 30, 2007, 04:22:00 pm »
QuoteBegin-art_of_camelot+30 Sep, 2007, 21:32-->
QUOTE (art_of_camelot @ 30 Sep, 2007, 21:32)
so it allows you to create unique non text looking tiles using ascii text?  

 Sounds like you didn't look at Metroid Pi :(sad.gif.

No, it's alright.  Just click on that link--everything (that isn't moving) you see in the animated screenshot is Dual-layer ASCII.  

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Strings>lists [BASIC variables]
« Reply #14 on: September 30, 2007, 04:31:00 pm »
Hmm actually wasn't Samus dual layer ASCII too? I remember you could see her gun and had 2 directional sprite.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)