| Author |
Message |
|
Raylin

Expert

Joined: 05 May 2008 Posts: 567 Location: Illinois Institute of Technology
|
Posted: 02 Oct 2011 08:07:05 pm Post subject: Most efficient way to store a lot of text? |
|
|
How do you do it in pure BASIC?
Subroutines and archiving? _________________
The Labyrinthine Chronicles
Prophecy: 0% (planning)
The Journalist: 0%
Image of Imperfection: 0%
Phantom Sanctuary: 0%
Godslayer: 0% |
|
| Back to top |
|
|
tifreak8x

Guru

Joined: 16 Mar 2005 Posts: 9104 Location: Sol System
|
Posted: 02 Oct 2011 08:07:49 pm Post subject: |
|
|
Depends, what kind of text are we talking? Dialogue? Data? _________________ Projects: AOD Series: 70% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%
Look here for Assembly Resources. |
|
| Back to top |
|
|
Raylin

Expert

Joined: 05 May 2008 Posts: 567 Location: Illinois Institute of Technology
|
Posted: 02 Oct 2011 08:11:16 pm Post subject: |
|
|
Dialogue and map data.
And some UI elements. _________________
The Labyrinthine Chronicles
Prophecy: 0% (planning)
The Journalist: 0%
Image of Imperfection: 0%
Phantom Sanctuary: 0%
Godslayer: 0% |
|
| Back to top |
|
|
elfprince13

OVER NINE THOUSAND!

Joined: 23 May 2005 Posts: 10247 Location: A galaxy far far away......
|
|
| Back to top |
|
|
tifreak8x

Guru

Joined: 16 Mar 2005 Posts: 9104 Location: Sol System
|
Posted: 02 Oct 2011 08:18:07 pm Post subject: |
|
|
What kind of assembly/library do you plan on using? I could easily explain how to do this with Celtic2 (I'd have to set up a download for you to grab it from, since I don't think there's a release anywhere of the working version) though I think Celtic3 has the same libraries, just different ways to call the commands.
Anyways, you can store large blocks of dialogue into an appvar using a format similar to what is found in http://www.ticalc.org/archives/files/fileinfo/409/40966.html
Map data can just be stored to a single line per map and recalled with celtic. I could probably pull some sample code out of pokemon somewhere to show how C2 handles it. _________________ Projects: AOD Series: 70% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%
Look here for Assembly Resources. |
|
| Back to top |
|
|
Raylin

Expert

Joined: 05 May 2008 Posts: 567 Location: Illinois Institute of Technology
|
Posted: 02 Oct 2011 08:19:55 pm Post subject: |
|
|
| elfprince13 wrote: | "Most efficient" really depends on
a) The content of the data
b) What you mean by efficient in terms of time/memory tradeoffs. |
Efficient memory-wise.
Content is text only.
And this is in pure BASIC. _________________
The Labyrinthine Chronicles
Prophecy: 0% (planning)
The Journalist: 0%
Image of Imperfection: 0%
Phantom Sanctuary: 0%
Godslayer: 0% |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 02 Oct 2011 08:31:52 pm Post subject: |
|
|
You could use RLE compression to save some space, but I don't think it would be very helpful for dialogue. Without an assembly library, storing large amounts of text efficiently is going to be fairly difficult, since there are only 10 string variables. If you do end up using an assembly library like Celtic, you could create appvars that hold text and archive and unarchive them when you need to. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
Posted: 02 Oct 2011 08:36:08 pm Post subject: |
|
|
You could go the list route for it. Where you use every element of a list, with each digit of accuracy to store data. ie, you could have a list that was: {0805121215}, which would stand for the world "HELLO" ('H' being 08, 'E' 05, 'L' 12, etc), and then just decompress that list when you need to. The benefits are: you can have an arbitrary name for the data and you can archive the data. The downsides are: you have to have all the data in RAM and it is difficult to edit/find specific letters in (ie, character 212 to 218). _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
elfprince13

OVER NINE THOUSAND!

Joined: 23 May 2005 Posts: 10247 Location: A galaxy far far away......
|
Posted: 02 Oct 2011 09:44:54 pm Post subject: |
|
|
| Raylin wrote: | | Content is text only. |
That doesn't answer the question. Being able to compress something efficiently depends on data to have some structure or patternedness that can be exploited to shrink the amount of memory required for storage without losing data.
Text generated by a random number generator probably won't be very amenable to compression (unless you know the algorithm + seed, and have a lot of spare CPU cycles). 1MB of the letter A has insane redundancy and perfect order. Human language, or ascii art, or pretty much anything meaningful, will probably fall somewhere between those two. _________________ StickFigure Graphic Productions || VSHI: Vermont Sustainable Heating Initiative
 |
|
| Back to top |
|
|
Raylin

Expert

Joined: 05 May 2008 Posts: 567 Location: Illinois Institute of Technology
|
Posted: 02 Oct 2011 11:16:10 pm Post subject: |
|
|
Context is dialogue and map data plus some UI elements. _________________
The Labyrinthine Chronicles
Prophecy: 0% (planning)
The Journalist: 0%
Image of Imperfection: 0%
Phantom Sanctuary: 0%
Godslayer: 0% |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55882 Location: Earth, Sol, Milky Way
|
Posted: 03 Oct 2011 02:33:51 am Post subject: |
|
|
I just noticed that Raylin writes ridiculously short posts that are not full sentences, with one thought per line. RLE does not succeed well at compressing text. Something like LZO would be much better at text, but implementing an LZO algorithm is nontrivial if you've never done it before (I have but not in BASIC or ASM; it was C). Breaking it up into the map in appvars, the dialog in related appvars, and the UI in its own appvar would probably be good. It might also be a smart idea to combine related map and dialog areas together in appvars. _________________
 |
|
| Back to top |
|
|
Raylin

Expert

Joined: 05 May 2008 Posts: 567 Location: Illinois Institute of Technology
|
Posted: 03 Oct 2011 07:58:42 am Post subject: |
|
|
| KermMartian wrote: | I just noticed that Raylin writes ridiculously short posts that are not full sentences, with one thought per line.  |
Hush yo face.
| KermMartian wrote: | RLE does not succeed well at compressing text. Something like LZO would be much better at text, but implementing an LZO algorithm is nontrivial if you've never done it before (I have but not in BASIC or ASM; it was C). Breaking it up into the map in appvars, the dialog in related appvars, and the UI in its own appvar would probably be good. It might also be a smart idea to combine related map and dialog areas together in appvars. |
But then, the program ends up being hybrid BASIC.
Then, I cry because hybrid BASIC can't compete with Axe. _________________
The Labyrinthine Chronicles
Prophecy: 0% (planning)
The Journalist: 0%
Image of Imperfection: 0%
Phantom Sanctuary: 0%
Godslayer: 0% |
|
| Back to top |
|
|
Ashbad

I am governor Jerry Brown

Joined: 01 Dec 2010 Posts: 2423 Location: There lived a certain man in Russia long ago
|
Posted: 03 Oct 2011 08:18:35 am Post subject: |
|
|
| Raylin wrote: | | Then, I cry because hybrid BASIC can't compete with Axe. |
And then we cry because we don't care if it competes with Axe or not, as long as your output program is cool and fun. _________________ -Ashbad |
|
| Back to top |
|
|
Raylin

Expert

Joined: 05 May 2008 Posts: 567 Location: Illinois Institute of Technology
|
Posted: 03 Oct 2011 09:02:57 am Post subject: |
|
|
This is for the contest.
I will lose if I enter Hybrid BASIC with a program intended for pure BASIC.
That's the opposite of winning. _________________
The Labyrinthine Chronicles
Prophecy: 0% (planning)
The Journalist: 0%
Image of Imperfection: 0%
Phantom Sanctuary: 0%
Godslayer: 0% |
|
| Back to top |
|
|
|