social.solarpunk.au

social.solarpunk.au

Thinkin' about the BASIC galaxy simulator again.

I think I will go with the method that uses the most memory--a big array that holds the state of the galaxy.

The other technique I know of is to have a function that one can traverse backwards and forwards, without holding any state at all.

I like that particular method because it is very slow to compute on the Commodore 64, which simulates the time scales of space flight that I wanted to achieve.

But I won't choose that method. The big array method it is.

@vidak You can also have just an array of star locations & data, say if you want 64 stars then DIM S(64,2) where 2nd index 0 is X, 1 is Y, 2 is whatever star data. No need to store all of empty space.

@mdhughes that's a good idea!

@mdhughes

this 'works', although i am not happy with the way that the star printing section tabulates the information...

10  dim g(63,1)
20  print "clearing star positions..."
30  for i = 0 to 63
40      for j = 0 to 1
50          let g(i,j) = 0
60      next j
70  next i
80  print "generating star positions..."
90  for s = 0 to 63
100     x = int(rnd(1)*255)
110     y = int(rnd(1)*255)
120     let g(s,0) = x
130     let g(s,1) = y
140 next s
150 print "printing star positions..."
160 for s = 0 to 63
170     print "x = ";g(s,0);". y = ";g(s,1)
180 next s
10 DIM G(63,1)
20 PRINT "CLEARING STAR POSITIONS..."
30 FOR I = 0 TO 63
40 FOR J = 0 TO 1
50 LET G(I,J) = 0
60 NEXT J
70 NEXT I
80 PRINT "GENERATING STAR POSITIONS..."
90 FOR S = 0 TO 63
100 X = INT(RND(1)*255)
110 Y = INT(RND(1)*255)
120 LET G(S,0) = X
130 LET G(S,1) = Y
140 NEXT S
150 PRINT "PRINTING STAR POSITIONS..."
160 FOR S = 0 TO 63
170 PRINT "X = ";G(S,0);". Y = ";G(S,1)
180 NEXT S

@vidak Yeah, now you get to have fun learning how to do graphics. Text-mode should be easy enough, and almost portable, but you'd only see a little subset at a time.

Hi-res graphics on C64 is unspeakably awful.

@mdhughes thinking of just doing text-mode, yeah--that way the game can almost be portable on anything

replies
0
announces
0
likes
1