Author |
Message |
|
Liazon title goes here
Bandwidth Hog
Joined: 01 Nov 2005 Posts: 2007
|
Posted: 14 Dec 2005 04:48:44 pm Post subject: |
|
|
Is this a good idea? Use lists of strings to store each screen of a large map and then change lists when you go to a different region of the world? |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 14 Dec 2005 09:36:06 pm Post subject: |
|
|
Kuro wrote: Radical Pi wrote: So...
How fast would it load an 8*16 screen out of 140800 ASCII characters?
I got the big # with (rows*columns*level size*levels)
Please still keep in mind that this is my first big project.
Tell me if I'm missing your point. I probably am.
[post="64331"]<{POST_SNAPBACK}>[/post]
First off, I'm not saying that you put all the levels into 1 string. You could just use whatever variable that represents the level and use it in a function to determine a substring to display.
And what do you mean by "level size" in your equation? If you mean the length of the string it would just be (rows*columns*levels).
[post="64411"]<{POST_SNAPBACK}>[/post]
By level size I meant 10*10. That is how many 8*16 screens each level will have.
And I think I understand what you were saying, something like
Code: :"(128 X's followed by 128 thetas)->Str1
ClrHome
Prompt B
For(A,1,8
Output(A,1,sub(Str1,128B-127+8A-7,16
End
Very bad example, but it asks for where in the level you are and shows it.
Something like this I could do. In fact I think I will do it.
calcul831415 wrote: Is this a good idea? Use lists of strings to store each screen of a large map and then change lists when you go to a different region of the world?
[post="64415"]<{POST_SNAPBACK}>[/post]
How can you store strings to lists? You mean like {1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,1.....? |
|
Back to top |
|
|
Liazon title goes here
Bandwidth Hog
Joined: 01 Nov 2005 Posts: 2007
|
Posted: 14 Dec 2005 09:50:28 pm Post subject: |
|
|
must be an 89 thing only. too bad |
|
Back to top |
|
|
bukwirm
Member
Joined: 06 Dec 2005 Posts: 233
|
Posted: 14 Dec 2005 10:03:04 pm Post subject: |
|
|
89's can store strings to lists, 83's, unfortunately, can't. |
|
Back to top |
|
|
Kuro
Advanced Newbie
Joined: 19 Oct 2005 Posts: 50
|
Posted: 14 Dec 2005 10:58:05 pm Post subject: |
|
|
Radical Pi wrote: By level size I meant 10*10. That is how many 8*16 screens each level will have.
And I think I understand what you were saying, something like
Code: :"(128 X's followed by 128 thetas)->Str1
ClrHome
Prompt B
For(A,1,8
Output(A,1,sub(Str1,128B-127+8A-7,16
End
Very bad example, but it asks for where in the level you are and shows it.
Something like this I could do. In fact I think I will do it.
That's what I mean, yes.
When you say 10*10 8*16 screens, does that mean that you have Screen1 and Screen2 which is just screen1 with rows shifted up ( 17*16 column in total)? Or do you have 10 entirely different screens in one 80*16 column? (by screens I assume you mean maze sections) |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 15 Dec 2005 05:32:57 pm Post subject: |
|
|
Kuro wrote: Radical Pi wrote: By level size I meant 10*10. That is how many 8*16 screens each level will have.
And I think I understand what you were saying, something like
Code: :"(128 X's followed by 128 thetas)->Str1
ClrHome
Prompt B
For(A,1,8
Output(A,1,sub(Str1,128B-127+8A-7,16
End
Very bad example, but it asks for where in the level you are and shows it.
Something like this I could do. In fact I think I will do it.
That's what I mean, yes.
When you say 10*10 8*16 screens, does that mean that you have Screen1 and Screen2 which is just screen1 with rows shifted up ( 17*16 column in total)? Or do you have 10 entirely different screens in one 80*16 column? (by screens I assume you mean maze sections)
[post="64486"]<{POST_SNAPBACK}>[/post]
By screen I did mean maze section. Unless anyone has a better way to describe 8 rows and 16 columns of X's and spaces...I would call it something else if it had scrolling.
Each level is a 10*10 grid of these screens, so the level is actually 80*160.
And here is a better example of what I tried:
Code: "XXXXXXXXXXXXXXXXX X X X X X X XXXXXXXXXXXXXXXX X X X X X X XX X X X X X X XXXXXXXXXXXXXXXX X X X X X X XXXXXXXXXXXXXXXXXüStr1
1üU:1üS
While 1
Repeat K
getKeyüK
End
U+(K=34)-(K=25üU
S+(K=26)-(K=24üS
ClrHome
For(A,1,8
Output(A,1,sub(Str1,256U-256+128S-128+16A-15,16
End
End
This will be modified to fit my level sizes.
At my current mapmaking rate, this game won't be out for at least 5 months. |
|
Back to top |
|
|
Kuro
Advanced Newbie
Joined: 19 Oct 2005 Posts: 50
|
Posted: 15 Dec 2005 06:24:19 pm Post subject: |
|
|
Okay. Need help making maps? I might be able to if you want. |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 15 Dec 2005 06:46:32 pm Post subject: |
|
|
Yes! Are you good at making mazes? |
|
Back to top |
|
|
Kuro
Advanced Newbie
Joined: 19 Oct 2005 Posts: 50
|
Posted: 16 Dec 2005 03:43:55 pm Post subject: |
|
|
I think so. I can make the levels as challenging as you want. And if I find a way to make an editor program I will get it to you. That will make mapmaking a lot easier. |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 16 Dec 2005 04:33:21 pm Post subject: |
|
|
Kuro wrote: I think so. I can make the levels as challenging as you want. And if I find a way to make an editor program I will get it to you. That will make mapmaking a lot easier.
[post="64576"]<{POST_SNAPBACK}>[/post]
Does your computer have Microsoft Excel? I'm just using that. |
|
Back to top |
|
|
Kuro
Advanced Newbie
Joined: 19 Oct 2005 Posts: 50
|
Posted: 16 Dec 2005 10:13:08 pm Post subject: |
|
|
It does, but if I use an oncalc editor i can convert directly into a string.
By my calculations, one 80*160 level would take up 12811 [11 to create string +80*160 since each char takes up 1 byte. Since most people I know don't like having 140921bytes worth of levels for one game you might want to consider decreasing the map size a bit. 60*90 would be nice. But whatever you decide I'll work with. |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 17 Dec 2005 08:45:34 am Post subject: |
|
|
The big levels were one of the main reasons for the game. String can I think hold up to 6841 bytes.
I have no idea how to check offscreen hit detection. (You walk to the edge of the screen and try to continue, but get stopped by a wall not in your area yet.)
Your method might enable that, but at the expense of most of the level.
Are you familiar with the RPG Starter Kit? I was using its engine. There wasn't a way to do offscreen hit detection, so I eliminated the problem by making both sides of any screen connection the same character.
So which should I use? |
|
Back to top |
|
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 17 Dec 2005 01:51:26 pm Post subject: |
|
|
I hope I'm not stealing Kuro's glory, but I took his idea and created an oncalc editor.
I also added compression, condensing four characters in the original string to one. This way your original 1280 character string for each level will instead be 3200, and you can fit more levels into the game.
I also made a program to display the compressed string. It can also be easily modified to recreate the original string if your game needs it to.
I had to retype these in graphlink after making them, cause my link cable isn't working, but I ran them through VTI to check for obvious typos. Let me know if something doesn't work.
Map editor:
Code: ClrHome
1üA
1üB
{8,16üdim([A]
Fill(0,[A]
Disp "*
While 1
Repeat K
getKeyüK
End
Output(A,B,sub(" X",[A](A,B)+1,1
A+(K=34)(A<8)-(K=25)(A>1)üA
B+(K=26)(B<16)-(K=24)(B>1)üB
Output(A,B,"*
If K=21 or K=105
Then
not([A](A,B)ü[A](A,B
Output(A,B,sub(" X",[A](A,B)+1,1
End
If K=22
Then
ClrHome
Disp "Converting...
":üStr1
For(A,1,8
For(B,0,3
For(C,1,4
If [A](A,4B+C)
Then
Str1+"1üStr1
Else
Str1+"0üStr1
End
End
Str1+",üStr1
End
End
Disp "Compressing...
sub(Str1,2,160üStr1
":üStr2
For(A,1,156,5
Str2+sub("0123456789ABCDEF",(inString("0000,0001,0010,0011,0100,0101,0110,0111,1000,1001,1010,1011,1100,1101,1110,1
111,",sub(Str1,A,4))+4)/5,1üStr2
End
sub(Str2,2,32üStr2
DelVar [A]
DelVar Str1
Stop
End
End
Display:
Code: For(A,1,8
For(B,1,4
Output(A,4B-3,sub(" X X XX X X X XX XXXX X XX X X XXXX XX XXXX XXXX",inString("0123456789ABCDEF",sub(Str2,4A+B-4,1))4-3,4
End
End
(By the way Brazucs, do you happen to have an original copy of OpTI-Basic that only converts symbols? Quite a few of the optimizations for these progs would have made them not work)
For the map generator, you move with the arrow keys, and 2nd or enter switches between a wall and a blank space. Press Mode when you're finished, and the compressed level will be stored to Str2. Converting and compressing takes a while, but you only need to do it once per screen.
Hope this helps!
Spyderbyte |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 18 Dec 2005 10:05:35 am Post subject: |
|
|
HOLY FREAKING...STUFF!
String size decreased by 96 bytes! But will this enable hit detection? |
|
Back to top |
|
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 18 Dec 2005 11:18:10 am Post subject: |
|
|
Radical Pi wrote: HOLY FREAKING...STUFF!
String size decreased by 96 bytes! But will this enable hit detection?
[post="64687"]<{POST_SNAPBACK}>[/post]
It'd take some pretty tricky coding to hit detect from the compressed screen, but fortunately decompression is mighty fast. I'd suggest recreating the original string one screen at a time and working off of that.
If you want to have a pause and then display the whole map at once:
Display2
Code: ":üStr1
For(A,1,8
For(B,1,4
Str1+sub(" X X XX X X X XX XXXX X XX X X XXXX XX XXXX XXXX",inString("0123456789ABCDEF",sub(Str2,4A+B-4,1))4-3,4üStr1
End
End
sub(Str1,2,128üStr1
Output(1,1,Str1
If you'd rather display the map as its being decompressed:
Display 3
Code: ":üStr1
For(A,1,8
For(B,1,4
sub(" X X XX X X X XX XXXX X XX X X XXXX XX XXXX XXXX",inString("0123456789ABCDEF",sub(Str2,4A+B-4,1))4-3,4
Output(A,4B-3,Ans
Str1+AnsüStr1
End
End
sub(Str1,2,128üStr1
Pause
The pause at the end is only to keep the finished string from being displayed a second time, you won't need it once you have more code following.
There's only a four byte difference between the programs (once you take out the pause).
Spyderbyte |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 18 Dec 2005 11:46:31 am Post subject: |
|
|
Perfect!
When I finish all the maps, i'll convert them and put those in a program.
I'll rename DISPLAY3 into Z3 to keep the prgm menu uncluttered.
Now each level can be up to about 300 screens! 30*10 instead of 10*10!
Kuro, are you sure you still want to work on these maps? |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 18 Dec 2005 04:58:14 pm Post subject: |
|
|
An exceedingly random optimization:
Code: sub(" X X XX X X X XX XXXX X XX X X XXXX XX XXXX XXXX",inString("0123456789ABCDEF",sub(Str2,4A+B-4,1))4-3,4
to
Code: sub(" X XX X XXXX ",inString("0124936DA5B7FEC8",sub(Str2,4A-B-4,1)),4
It could probably done in compressing as well. |
|
Back to top |
|
|
Kuro
Advanced Newbie
Joined: 19 Oct 2005 Posts: 50
|
Posted: 18 Dec 2005 05:52:37 pm Post subject: |
|
|
Radical Pi wrote: Perfect!
When I finish all the maps, i'll convert them and put those in a program.
I'll rename DISPLAY3 into Z3 to keep the prgm menu uncluttered.
Now each level can be up to about 300 screens! 30*10 instead of 10*10!
Kuro, are you sure you still want to work on these maps?
[post="64690"]<{POST_SNAPBACK}>[/post]
Absolutely. Incidentally, I coded an oncalc editor also (this afternoon, in about 15 minutes), using the graphscreen to create a maze and then compiling it in Str1. However, compiling takes ~8 minutes, and drawing a decent map takes a long time as well. But it works well with the display routine, and makes for relatively simple hit detection.
Hit detection:
Code: ...
:getkey->k
A+(ans=26 and a<74 and "_"=sub(str1, 90d+a+1))-(ans=24 and a and "_"=sub(str1, 90d+a-1->A
A controls horizontal coordinate, "90d" controls how far to jump in the string (90 is the maxe horizontal value).
The same can be done for what ever variable is being used for vertical movement.
I might be able to devise another compression routine this week while I'm on vacation. Maybe make some more maps. |
|
Back to top |
|
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 18 Dec 2005 06:44:48 pm Post subject: |
|
|
DarkerLine wrote: An exceedingly random optimization:
Code: sub(" X XX X XXXX ",inString("0124936DA5B7FEC8",sub(Str2,4A-B-4,1)),4
It could probably done in compressing as well.
[post="64710"]<{POST_SNAPBACK}>[/post]
Yep, I was thinking there should be a nice arrangement like that. It can definately be done in compression too, and will actually make life easier. I had to use a pretty ugly work around of inserting commas after every fourth character to prevent inString( from finding it too early in the string.
@Radical Pi, I can rewrite the programs if you'd like, but unless you're planning to release the map editor as well, I'll just let you make the replacement in the display code.
Spyderbyte |
|
Back to top |
|
|
Radical Pi
Advanced Member
Joined: 23 Nov 2005 Posts: 455
|
Posted: 18 Dec 2005 07:01:12 pm Post subject: |
|
|
I don't know anything about compression techniques. I would feel more safe about it if you did this, Spyderbyte. I wasn't going to release a map editor for this anyway.
And Kuro: I didn't have the attention span to wait for prgmMAPDISP to finish. Would this save mazes to a Pic or string? Remember this is homescreen aimed. |
|
Back to top |
|
|
|