Code: Select all
5 addr=40960
6 print"testmap start:";addr
7 print"(g)generate or (p)plot?": input c$
8 if c$="p" then goto 250
10 dim sx(255),sy(255)
20 print"how large map?"
30 input a
40 print"map will be";a;"x";a;"squares."
45 print"seed"
48 input sd
50 print"max line width?"
55 input w
60 print"number of lines";:input nl
65 bpl=int(a/8)+3
70 print "max";bpl;"bytes per line"
75 poke addr,bpl: addr=addr+1
78 poke addr,w: addr=addr+1
80 print "bleed width (0=none)?"
90 input bw
95 poke addr,bw: addr=addr+1
96 poke addr,nl: addr=addr+1
100 for t=1tow
110 print"generating";t;"wide lines"
115 for u=1tonl
120 sx(t)=int(a*rnd(a*sd))
125 poke addr,sx(t): addr=addr+1
130 sy(t)=int(a*rnd(a*sd))
135 poke addr,sx(t): addr=addr+1
140 print"start";sx(t);",";sy(t)
145 bf=1: lin=0
150 for v=1toa
155 lr=(int(rnd(v*t*sd)+0.5)*bf)
158 lin=lin+lr
160 bf=bf*2
165 if int((v)/8)<>int((v-1)/8) then poke addr,lin: addr=addr+1: lin=0: bf=1
180 next v
185 if int((v)/8)=int((v-1)/8) then poke addr,lin: addr=addr+1
190 print "addr";addr
196 next u
200 next t
210 poke addr,255
250 print "data generated"
300 print "plot start (x,y)?"
310 input xps,yps
315 w=peek(40961): bw=peek(40962): nl=peek(40963)
320 for t=4096 to 4096+506
330 poke t, 48: poke 33792+t,0
340 next t
350 se=peek(40960)
360 a=40964
370 sx=peek(a):sy=peek(a+1):a=a+2
375 pk=0
380 if(sx>xps)and(sx<(xps+22))and(sy>yps)and(sy<(yps+20))then pk=4096+(sx-xps)+((sy-yps)*22):pOpk,(pE(pk)+1)
385 if pk<>0 then for v=-bw to bw: pOpk+v,(pE(pk+v)+1):next v
390 for t=1 to (se-2)
400 dc=peek(a+t-1):bf=1
410 for u=0to7
415 sx=sx+1
420 if (int(dc/2)*2)<>dc then dc=dc-1: sx=sx-2
430 dc=dc/2
440 sy=sy+1
441 pk=0
442 if(sx>xps)and(sx<(xps+22))and(sy>yps)and(sy<(yps+20))then pk=4096+(sx-xps)+((sy-yps)*22):pOpk,(pE(pk)+1)
443 if pk<>0 then for v=-bw to bw: pOpk+v,(pE(pk+v)+1):next v
444 rem print u;t;sx;sy
445 next u,t
446 a=a+se-2
450 nl=nl-1: if nl>0 then goto 370
There are a number of ways to "bleed" the lines and/or to connect the line points. You can even have line functions that are loosely guided on the bit pattern. Anyway, the meaning is to get reproducible result that defines a map that can be scrolled around. For example a 100x100 map defined from 100 lines could be stored in 1500 bytes of memory (more or less).
The idea is then to use this "map" as a heightmap and draw the landscape from its basis. For example use height=0 as sea, 1-3 as different types of land and 4+ as mountains. Maybe 9+ is snow (or something). You get the idea.
Other features on the map would have to be defined in tables aswell. Roads, houses, caves and alike.