I happened to think of this not too long ago, but didn't think it through very much, and as I started to realize how big games get if they use Matrices, Strings, or Lists for the maps, I figured this would be a great idea, although I haven't tried it yet, as the method I will need help getting together and working nicely.
First off I will show an example of a 5x5 Matrix, a 25 length string, and a 25 element list:
Code:
Each of those can be compressed to this string:
Code:
Now I will explain.
Every "odd" number place(i.e. the 0,1,0,2 etc...) in the above string stands for what is in the matrix/list/string, and the number following the "/" after the "odd" number place is how many there are in a row.
Also I do know this won't compress some situations nearly as much to be worth it, not compress at all, or even expand the size, depending on what you are trying to compress.
I hope this makes sense.
First off I will show an example of a 5x5 Matrix, a 25 length string, and a 25 element list:
Code:
[0,0,0,1,1]
[1,1,1,0,0]
[2,2,2,2,0]
[0,0,0,4,4]
[5,5,4,0,0]
{0,0,0,1,1,1,1,1,0,0,2,2,2,2,0,0,0,0,4,4,5,5,4,0,0}
"0001111100222200004455400"
Each of those can be compressed to this string:
Code:
"0/3/1/5/0/2/2/4/0/4/4/2/5/2/4/1/0/2/"
Now I will explain.
Every "odd" number place(i.e. the 0,1,0,2 etc...) in the above string stands for what is in the matrix/list/string, and the number following the "/" after the "odd" number place is how many there are in a row.
Also I do know this won't compress some situations nearly as much to be worth it, not compress at all, or even expand the size, depending on what you are trying to compress.
I hope this makes sense.