QB64.org Forum

Active Forums => Programs => Topic started by: SierraKen on December 07, 2020, 07:40:04 pm

Title: Starfield 2020 - December Version
Post by: SierraKen on December 07, 2020, 07:40:04 pm
I don't believe I made one of these this year, but I know we made them last year. So I took my glowing snow idea and turned them into glowing stars. I also figured out how to start them not directly in the center like I did last year. Plus I used different sizes of stars. Feel free to use this on anything, or add anything, etc. I was mostly just goofing off. :)

Edit: I just changed the name of this to Starfield 2020 - December Version because I found an older Starfield 2020 that I made back in June.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2. DIM starx(800), stary(800)
  3. DIM dx(800), dy(800)
  4. DIM sz(800)
  5. _TITLE "Starfield 2020 - Dec. Version - by SierraKen"
  6. speed = 1
  7.     _LIMIT 60
  8.     a$ = INKEY$
  9.     IF a$ = CHR$(27) THEN END
  10.     stars = INT(RND * 100) + 1
  11.     IF stars > 25 THEN
  12.         s = s + 1
  13.         IF s > 750 THEN s = 1
  14.         'Set starting position.
  15.         st = INT(RND * 360)
  16.         x = (SIN(st) * 30) + 500
  17.         y = (COS(st) * 30) + 400
  18.         starx(s) = x
  19.         stary(s) = y
  20.         'Set direction to move.
  21.         dx(s) = ((x - 500) / 30)
  22.         dy(s) = ((y - 400) / 30)
  23.         'Set size.
  24.         sz(s) = RND
  25.     END IF
  26.     IF yy > 640 THEN yy = 0
  27.     FOR t = 1 TO 750
  28.         stary(t) = stary(t) + dy(t)
  29.         starx(t) = starx(t) + dx(t)
  30.         cx = starx(t): cy = stary(t)
  31.         r = sz(t) + RND
  32.         c = _RGB32(255, 255, 255)
  33.         fillCircle cx, cy, r, c
  34.     NEXT t
  35.     _DISPLAY
  36.     CLS
  37.  
  38. 'from Steve Gold standard
  39. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  40.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  41.     DIM X AS INTEGER, Y AS INTEGER
  42.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  43.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  44.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  45.     WHILE X > Y
  46.         RadiusError = RadiusError + Y * 2 + 1
  47.         IF RadiusError >= 0 THEN
  48.             IF X <> Y + 1 THEN
  49.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  50.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  51.             END IF
  52.             X = X - 1
  53.             RadiusError = RadiusError - X * 2
  54.         END IF
  55.         Y = Y + 1
  56.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  57.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  58.     WEND
  59.  
Title: Re: Starfield - December Version
Post by: SierraKen on December 07, 2020, 11:52:57 pm
I just found out that back in June I did a different Starfield 2020,  I will rename this one to "Starfield - December Version".
If you are interested to see the old one, click the link below.

https://www.qb64.org/forum/index.php?topic=2709.msg119278 (https://www.qb64.org/forum/index.php?topic=2709.msg119278)
Title: Re: Starfield 2020 - December Version
Post by: bplus on December 08, 2020, 12:12:19 am
This is a nice one, it's labeled Starfield Simulation #2 [banned user] but looks like Fellippe's or Ashish procedures ie ' p5.js Functions

Code: QB64: [Select]
  1. _TITLE "Starfield Simulation"
  2.  
  3.  
  4. CreateCanvas 600, 600
  5. WINDOW (-Width, -Height)-(Width, Height)
  6.  
  7. ' Translate the Star Class into a UDT (User Defined Type)
  8. TYPE newStar
  9.     x AS SINGLE
  10.     y AS SINGLE
  11.  
  12.     z AS SINGLE
  13.     pz AS SINGLE
  14.  
  15. ' Define how many Stars
  16. DIM SHARED starCount AS INTEGER
  17. starCount = 800
  18.  
  19. ' Setup the Stars
  20. DIM SHARED Stars(starCount) AS newStar
  21.  
  22. FOR i = 1 TO starCount
  23.     Stars(i).x = p5random(-Width, Width)
  24.     Stars(i).y = p5random(-Height, Height)
  25.  
  26.     Stars(i).z = p5random(0, Width)
  27.     Stars(i).pz = Stars(i).z
  28.  
  29. Speed = 5
  30.  
  31.     _LIMIT 60
  32.  
  33.     LINE (-_WIDTH, -_HEIGHT)-(Width - 1, Height - 1), _RGBA32(0, 0, 0, 30), BF
  34.  
  35.     FOR i = 1 TO starCount
  36.         Stars(i).z = Stars(i).z - Speed
  37.  
  38.         IF Stars(i).z < 1 THEN
  39.             Stars(i).x = p5random(-Width, Width)
  40.             Stars(i).y = p5random(-Width, Height)
  41.  
  42.             Stars(i).z = Width
  43.             Stars(i).pz = Stars(i).z
  44.         END IF
  45.  
  46.         sx = map(Stars(i).x / Stars(i).z, 0, 1, 0, Width)
  47.         sy = map(Stars(i).y / Stars(i).z, 0, 1, 0, Height)
  48.         CIRCLE (sx, sy), map(Stars(i).z, 0, Width, 2, 0)
  49.  
  50.         px = map(Stars(i).x / Stars(i).pz, 0, 1, 0, Width)
  51.         py = map(Stars(i).y / Stars(i).pz, 0, 1, 0, Height)
  52.         Stars(i).pz = Stars(i).z
  53.         LINE (px, py)-(sx, sy)
  54.     NEXT
  55.  
  56.     _DISPLAY
  57. LOOP UNTIL Done
  58.  
  59. ' p5.js Functions
  60. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
  61.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
  62.  
  63. FUNCTION p5random! (mn!, mx!)
  64.     IF mn! > mx! THEN
  65.         SWAP mn!, mx!
  66.     END IF
  67.  
  68.     p5random! = RND * (mx! - mn!) + mn!
  69.  
  70. SUB CreateCanvas (x AS INTEGER, y AS INTEGER)
  71.     ' Define the screen
  72.     Width = x
  73.     Height = y
  74.  
  75.     ' Center of the screen
  76.     CenterX = x \ 2
  77.     CenterY = y \ 2
  78.  
  79.     ' Create the screen
  80.     SCREEN _NEWIMAGE(Width, Height, 32)
  81.  
  82.  
Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 08, 2020, 12:23:58 am
Woah! Thanks B+, I totally forgot about trails... hmm....

Here we go,  one with trails and a little bit smaller of a starting point circular area.
Thanks for the idea!


 
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2. DIM starx(1000), stary(1000)
  3. DIM dx(1000), dy(1000)
  4. DIM sz(1000)
  5. _TITLE "Starfield 2020 - Dec. Version - by SierraKen"
  6. speed = 1
  7.     _LIMIT 100
  8.     a$ = INKEY$
  9.     IF a$ = CHR$(27) THEN END
  10.     stars = INT(RND * 100) + 1
  11.     IF stars > 25 THEN
  12.         s = s + 1
  13.         IF s > 950 THEN s = 1
  14.         'Set starting position.
  15.         st = INT(RND * 360)
  16.         x = (SIN(st) * 20) + 500
  17.         y = (COS(st) * 20) + 400
  18.         starx(s) = x
  19.         stary(s) = y
  20.         'Set direction to move.
  21.         dx(s) = ((x - 500) / 30)
  22.         dy(s) = ((y - 400) / 30)
  23.         'Set size.
  24.         sz(s) = RND
  25.     END IF
  26.     IF yy > 640 THEN yy = 0
  27.     FOR t = 1 TO 950
  28.         stary(t) = stary(t) + dy(t)
  29.         starx(t) = starx(t) + dx(t)
  30.         cx = starx(t): cy = stary(t)
  31.         r = sz(t) + RND
  32.         c = _RGB32(255, 255, 255)
  33.         fillCircle cx, cy, r, c
  34.     NEXT t
  35.     _DISPLAY
  36.     LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, 0, 0, 20), BF
  37.  
  38.  
  39. 'from Steve Gold standard
  40. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  41.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  42.     DIM X AS INTEGER, Y AS INTEGER
  43.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  44.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  45.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  46.     WHILE X > Y
  47.         RadiusError = RadiusError + Y * 2 + 1
  48.         IF RadiusError >= 0 THEN
  49.             IF X <> Y + 1 THEN
  50.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  51.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  52.             END IF
  53.             X = X - 1
  54.             RadiusError = RadiusError - X * 2
  55.         END IF
  56.         Y = Y + 1
  57.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  58.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  59.     WEND
  60.  

Title: Re: Starfield 2020 - December Version
Post by: bplus on December 08, 2020, 12:28:51 am
Ken can you get them to move faster as the approach the edge ie go faster and faster out from center. Plus start with stars scattered over the whole field.
Title: Re: Starfield 2020 - December Version
Post by: johnno56 on December 08, 2020, 01:22:48 am
Star fields. You just gotta love 'em....
Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 08, 2020, 02:38:10 pm
Great idea B+. I just did both of those. I made a countdown in the beginning of numbers counting down to 0 until it starts, which then shows the entire screen of stars. Then I also figured out how to make the stars go faster as they got further away from the center. Last night I tried to make it speed up and slow down with the up and down arrow keys, so I figured that out too today. If you want to learn how I did the speeds, look at the sp, warp, and speed() variables. Check it out! :)

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2. DIM starx(1000), stary(1000)
  3. DIM dx(1000), dy(1000)
  4. DIM sz(1000)
  5. DIM speed(1000)
  6. _TITLE "Starfield 2020 - Dec. Version - by SierraKen - Use up and down arrow keys to control speed."
  7.  
  8.     _LIMIT 100
  9.     a$ = INKEY$
  10.     IF a$ = CHR$(27) THEN END
  11.     IF a$ = CHR$(0) + CHR$(72) THEN sp = sp + .0005: _TITLE "Warp: " + warp$
  12.     IF a$ = CHR$(0) + CHR$(80) THEN sp = sp - .0005: _TITLE "Warp: " + warp$
  13.     IF sp < 0 THEN sp = 0
  14.     IF sp > .1 THEN sp = .1
  15.     warp = (sp * 100) + 1
  16.     IF warp > 10 THEN warp = 10
  17.     warp$ = STR$(warp)
  18.     warp$ = LEFT$(warp$, 5)
  19.     stars = INT(RND * 100) + 1
  20.     IF stars > 25 THEN
  21.         start = start + 1
  22.         s = s + 1
  23.         IF s > 950 THEN s = 1
  24.         'Set starting position.
  25.         st = INT(RND * 360)
  26.         x = (SIN(st) * 20) + 500
  27.         y = (COS(st) * 20) + 400
  28.         starx(s) = x
  29.         stary(s) = y
  30.         'Set direction to move.
  31.         dx(s) = ((x - 500) / 30)
  32.         dy(s) = ((y - 400) / 30)
  33.         'Set size.
  34.         sz(s) = RND
  35.         'Set speed
  36.         speed(s) = 1
  37.     END IF
  38.     IF yy > 640 THEN yy = 0
  39.     FOR t = 1 TO 950
  40.         speed(t) = speed(t) * (1.01 + sp)
  41.         stary(t) = stary(t) + dy(t) * speed(t)
  42.         starx(t) = starx(t) + dx(t) * speed(t)
  43.         cx = starx(t): cy = stary(t)
  44.         r = sz(t) + RND
  45.         c = _RGB32(255, 255, 255)
  46.         IF start < 650 THEN
  47.             countdown = INT((650 - start) / 10)
  48.             c$ = STR$(countdown)
  49.             _PRINTSTRING (500, 400), c$
  50.             GOTO skip:
  51.         END IF
  52.         fillCircle cx, cy, r, c
  53.         skip:
  54.     NEXT t
  55.     _DISPLAY
  56.     LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, 0, 0, 20), BF
  57.  
  58.  
  59. 'from Steve Gold standard
  60. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  61.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  62.     DIM X AS INTEGER, Y AS INTEGER
  63.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  64.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  65.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  66.     WHILE X > Y
  67.         RadiusError = RadiusError + Y * 2 + 1
  68.         IF RadiusError >= 0 THEN
  69.             IF X <> Y + 1 THEN
  70.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  71.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  72.             END IF
  73.             X = X - 1
  74.             RadiusError = RadiusError - X * 2
  75.         END IF
  76.         Y = Y + 1
  77.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  78.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  79.     WEND
  80.  
Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 08, 2020, 03:44:28 pm
I just added W and S keys to it B+. I really like the new look now, thanks again.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2. DIM starx(1000), stary(1000)
  3. DIM dx(1000), dy(1000)
  4. DIM sz(1000)
  5. DIM speed(1000)
  6. _TITLE "Starfield 2020 - Dec. Version - by SierraKen - Use up and down arrow keys (or W and S keys) to control speed."
  7.  
  8.     _LIMIT 100
  9.     a$ = INKEY$
  10.     IF a$ = CHR$(27) THEN END
  11.     IF a$ = CHR$(0) + CHR$(72) OR a$ = "w" OR a$ = "W" THEN sp = sp + .0005: _TITLE "Warp: " + warp$
  12.     IF a$ = CHR$(0) + CHR$(80) OR a$ = "s" OR a$ = "S" THEN sp = sp - .0005: _TITLE "Warp: " + warp$
  13.     IF sp < 0 THEN sp = 0
  14.     IF sp > .1 THEN sp = .1
  15.     warp = (sp * 100) + 1
  16.     IF warp > 10 THEN warp = 10
  17.     warp$ = STR$(warp)
  18.     warp$ = LEFT$(warp$, 5)
  19.     stars = INT(RND * 100) + 1
  20.     IF stars > 25 THEN
  21.         start = start + 1
  22.         s = s + 1
  23.         IF s > 950 THEN s = 1
  24.         'Set starting position.
  25.         st = INT(RND * 360)
  26.         x = (SIN(st) * 20) + 500
  27.         y = (COS(st) * 20) + 400
  28.         starx(s) = x
  29.         stary(s) = y
  30.         'Set direction to move.
  31.         dx(s) = ((x - 500) / 30)
  32.         dy(s) = ((y - 400) / 30)
  33.         'Set size.
  34.         sz(s) = RND
  35.         'Set speed
  36.         speed(s) = 1
  37.     END IF
  38.     IF yy > 640 THEN yy = 0
  39.     FOR t = 1 TO 950
  40.         speed(t) = speed(t) * (1.01 + sp)
  41.         stary(t) = stary(t) + dy(t) * speed(t)
  42.         starx(t) = starx(t) + dx(t) * speed(t)
  43.         cx = starx(t): cy = stary(t)
  44.         r = sz(t) + RND
  45.         c = _RGB32(255, 255, 255)
  46.         IF start < 650 THEN
  47.             countdown = INT((650 - start) / 10)
  48.             c$ = STR$(countdown)
  49.             _PRINTSTRING (500, 400), c$
  50.             GOTO skip:
  51.         END IF
  52.         fillCircle cx, cy, r, c
  53.         skip:
  54.     NEXT t
  55.     _DISPLAY
  56.     LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, 0, 0, 20), BF
  57.  
  58.  
  59. 'from Steve Gold standard
  60. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  61.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  62.     DIM X AS INTEGER, Y AS INTEGER
  63.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  64.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  65.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  66.     WHILE X > Y
  67.         RadiusError = RadiusError + Y * 2 + 1
  68.         IF RadiusError >= 0 THEN
  69.             IF X <> Y + 1 THEN
  70.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  71.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  72.             END IF
  73.             X = X - 1
  74.             RadiusError = RadiusError - X * 2
  75.         END IF
  76.         Y = Y + 1
  77.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  78.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  79.     WEND
  80.  
Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 08, 2020, 05:00:26 pm
I was able to do away with the countdown completely by making a random location on the screen (except the very center) for every new star. There's no more circular pattern in the center and now it looks more realistic. :)

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2. DIM starx(1000), stary(1000)
  3. DIM dx(1000), dy(1000)
  4. DIM sz(1000)
  5. DIM speed(1000)
  6. _TITLE "Starfield 2020 - Dec. Version - by SierraKen - Use up and down arrow keys (or W and S keys) to control speed."
  7.  
  8.     _LIMIT 100
  9.     a$ = INKEY$
  10.     IF a$ = CHR$(27) THEN END
  11.     IF a$ = CHR$(0) + CHR$(72) OR a$ = "w" OR a$ = "W" THEN sp = sp + .0005: _TITLE "Warp: " + warp$
  12.     IF a$ = CHR$(0) + CHR$(80) OR a$ = "s" OR a$ = "S" THEN sp = sp - .0005: _TITLE "Warp: " + warp$
  13.     IF sp < 0 THEN sp = 0
  14.     IF sp > .1 THEN sp = .1
  15.     warp = (sp * 100) + 1
  16.     IF warp > 10 THEN warp = 10
  17.     warp$ = STR$(warp)
  18.     warp$ = LEFT$(warp$, 5)
  19.     stars = INT(RND * 100) + 1
  20.     IF stars > 25 THEN
  21.         s = s + 1
  22.         IF s > 950 THEN s = 1
  23.         'Set starting position.
  24.         startx = RND * 490
  25.         starty = RND * 390
  26.         st = INT(RND * 360)
  27.         x = (SIN(st) * startx) + 500
  28.         y = (COS(st) * starty) + 400
  29.         starx(s) = x
  30.         stary(s) = y
  31.         'Set direction to move.
  32.         dx(s) = ((x - 500) / 30)
  33.         dy(s) = ((y - 400) / 30)
  34.         'Set size.
  35.         sz(s) = RND
  36.         'Set speed
  37.         speed(s) = .5
  38.     END IF
  39.     IF yy > 640 THEN yy = 0
  40.     FOR t = 1 TO 950
  41.         speed(t) = speed(t) * (1.005 + sp)
  42.         stary(t) = stary(t) + dy(t) * speed(t)
  43.         starx(t) = starx(t) + dx(t) * speed(t)
  44.         cx = starx(t): cy = stary(t)
  45.         r = sz(t) + RND
  46.         c = _RGB32(255, 255, 255)
  47.         fillCircle cx, cy, r, c
  48.         'skip:
  49.     NEXT t
  50.     _DISPLAY
  51.     LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, 0, 0, 20), BF
  52.  
  53.  
  54. 'from Steve Gold standard
  55. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  56.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  57.     DIM X AS INTEGER, Y AS INTEGER
  58.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  59.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  60.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  61.     WHILE X > Y
  62.         RadiusError = RadiusError + Y * 2 + 1
  63.         IF RadiusError >= 0 THEN
  64.             IF X <> Y + 1 THEN
  65.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  66.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  67.             END IF
  68.             X = X - 1
  69.             RadiusError = RadiusError - X * 2
  70.         END IF
  71.         Y = Y + 1
  72.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  73.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  74.     WEND
  75.  
Title: Re: Starfield 2020 - December Version
Post by: bplus on December 08, 2020, 05:03:58 pm
Coming along nicely! :)
Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 08, 2020, 05:33:36 pm
:) I just added _FULLSCREEN mode off and on using the Space Bar. I did it because I'm going to try and make a YouTube video of it. Full Screen makes it show really awesome.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2. DIM starx(1000), stary(1000)
  3. DIM dx(1000), dy(1000)
  4. DIM sz(1000)
  5. DIM speed(1000)
  6. _TITLE "Starfield 2020 - Dec. Ver. by SierraKen - Up and down arrow keys (or W and S keys) for speed. Space Bar switches back and forth to Full Screen. Esc to quit."
  7.  
  8.     _LIMIT 100
  9.     a$ = INKEY$
  10.     IF a$ = CHR$(27) THEN END
  11.     IF a$ = CHR$(0) + CHR$(72) OR a$ = "w" OR a$ = "W" THEN sp = sp + .0005: _TITLE "Warp: " + warp$
  12.     IF a$ = CHR$(0) + CHR$(80) OR a$ = "s" OR a$ = "S" THEN sp = sp - .0005: _TITLE "Warp: " + warp$
  13.     IF a$ = " " THEN f = f + 1
  14.     IF f = 1 THEN _FULLSCREEN
  15.     IF f = 2 THEN _FULLSCREEN OFF: f = 0
  16.     IF sp < 0 THEN sp = 0
  17.     IF sp > .1 THEN sp = .1
  18.     warp = (sp * 100) + 1
  19.     IF warp > 10 THEN warp = 10
  20.     warp$ = STR$(warp)
  21.     warp$ = LEFT$(warp$, 5)
  22.     stars = INT(RND * 100) + 1
  23.     IF stars > 25 THEN
  24.         s = s + 1
  25.         IF s > 950 THEN s = 1
  26.         'Set starting position.
  27.         startx = RND * 490
  28.         starty = RND * 390
  29.         st = INT(RND * 360)
  30.         x = (SIN(st) * startx) + 500
  31.         y = (COS(st) * starty) + 400
  32.         starx(s) = x
  33.         stary(s) = y
  34.         'Set direction to move.
  35.         dx(s) = ((x - 500) / 30)
  36.         dy(s) = ((y - 400) / 30)
  37.         'Set size.
  38.         sz(s) = RND
  39.         'Set speed
  40.         speed(s) = .5
  41.     END IF
  42.     IF yy > 640 THEN yy = 0
  43.     FOR t = 1 TO 950
  44.         speed(t) = speed(t) * (1.005 + sp)
  45.         stary(t) = stary(t) + dy(t) * speed(t)
  46.         starx(t) = starx(t) + dx(t) * speed(t)
  47.         cx = starx(t): cy = stary(t)
  48.         r = sz(t) + RND
  49.         c = _RGB32(255, 255, 255)
  50.         fillCircle cx, cy, r, c
  51.         'skip:
  52.     NEXT t
  53.     _DISPLAY
  54.     LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, 0, 0, 20), BF
  55.  
  56.  
  57. 'from Steve Gold standard
  58. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  59.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  60.     DIM X AS INTEGER, Y AS INTEGER
  61.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  62.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  63.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  64.     WHILE X > Y
  65.         RadiusError = RadiusError + Y * 2 + 1
  66.         IF RadiusError >= 0 THEN
  67.             IF X <> Y + 1 THEN
  68.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  69.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  70.             END IF
  71.             X = X - 1
  72.             RadiusError = RadiusError - X * 2
  73.         END IF
  74.         Y = Y + 1
  75.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  76.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  77.     WEND
  78.  

Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 08, 2020, 06:12:59 pm
Here is the YouTube of it I just made. I speed up and then slow back down. The video is 1 minute and 10 seconds long.

Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 11, 2020, 01:49:51 pm
I found a way to make this look even better. Check it out.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(1000, 800, 32)
  2. DIM starx(1000), stary(1000)
  3. DIM dx(1000), dy(1000)
  4. DIM sz(1000)
  5. DIM speed(1000)
  6. _TITLE "Starfield 2020 - Dec. Ver. by SierraKen - Up and down arrow keys (or W and S keys) for speed. Space Bar switches back and forth to Full Screen. Esc to quit."
  7.  
  8.     _LIMIT 100
  9.     a$ = INKEY$
  10.     IF a$ = CHR$(27) THEN END
  11.     IF a$ = CHR$(0) + CHR$(72) OR a$ = "w" OR a$ = "W" THEN sp = sp + .0005: _TITLE "Warp: " + warp$
  12.     IF a$ = CHR$(0) + CHR$(80) OR a$ = "s" OR a$ = "S" THEN sp = sp - .0005: _TITLE "Warp: " + warp$
  13.     IF a$ = " " THEN f = f + 1
  14.     IF f = 1 THEN _FULLSCREEN
  15.     IF f = 2 THEN _FULLSCREEN OFF: f = 0
  16.     IF sp < 0 THEN sp = 0
  17.     IF sp > .1 THEN sp = .1
  18.     warp = (sp * 100) + 1
  19.     IF warp > 10 THEN warp = 10
  20.     warp$ = STR$(warp)
  21.     warp$ = LEFT$(warp$, 5)
  22.     stars = INT(RND * 100) + 1
  23.     IF stars > 25 THEN
  24.         s = s + 1
  25.         IF s > 950 THEN s = 1
  26.         'Set starting position.
  27.         startx = RND * 490
  28.         starty = RND * 390
  29.         st = INT(RND * 360)
  30.         x = (SIN(st) * startx) + 500
  31.         y = (COS(st) * starty) + 400
  32.         starx(s) = x
  33.         stary(s) = y
  34.         'Set direction to move.
  35.         dx(s) = ((x - 500) / 30)
  36.         dy(s) = ((y - 400) / 30)
  37.         'Set size.
  38.         sz(s) = RND
  39.         'Set speed
  40.         speed(s) = .1
  41.     END IF
  42.     IF yy > 640 THEN yy = 0
  43.     FOR t = 1 TO 950
  44.         speed(t) = speed(t) * (1.05 + sp)
  45.         stary(t) = stary(t) + dy(t) * speed(t)
  46.         starx(t) = starx(t) + dx(t) * speed(t)
  47.         cx = starx(t): cy = stary(t)
  48.         r = sz(t) + .5
  49.         c = _RGB32(255, 255, 255)
  50.         fillCircle cx, cy, r, c
  51.         'skip:
  52.     NEXT t
  53.     _DISPLAY
  54.     LINE (0, 0)-(_WIDTH, _HEIGHT), _RGB32(0, 0, 0, 20), BF
  55.  
  56.  
  57. 'from Steve Gold standard
  58. SUB fillCircle (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  59.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  60.     DIM X AS INTEGER, Y AS INTEGER
  61.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  62.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  63.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  64.     WHILE X > Y
  65.         RadiusError = RadiusError + Y * 2 + 1
  66.         IF RadiusError >= 0 THEN
  67.             IF X <> Y + 1 THEN
  68.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  69.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  70.             END IF
  71.             X = X - 1
  72.             RadiusError = RadiusError - X * 2
  73.         END IF
  74.         Y = Y + 1
  75.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  76.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  77.     WEND
  78.  
  79.  
Title: Re: Starfield 2020 - December Version
Post by: Petr on December 11, 2020, 02:08:47 pm
Hi, you made it very nice. Am I guessing this is some preparation for a program to celebrate the new year?
Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 11, 2020, 04:50:21 pm
Petr, I didn't think of any of that, except I do have an idea for this... but we'll see... :)
Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 11, 2020, 04:58:01 pm
Actually Petr, that does add on to my idea.... coming soon!
Title: Re: Starfield 2020 - December Version
Post by: NOVARSEG on December 11, 2020, 08:09:22 pm
 SierraKen

Your starfield is impressive. The stars go faster as they travel.  I still don't know how to do multiple star paths at the same time.


Title: Re: Starfield 2020 - December Version
Post by: SierraKen on December 11, 2020, 09:28:58 pm
NOVARSEG, thanks! In order to make many graphics on the screen move at once,  you need an array using DIM statements. If you look closely at my code, you can see that there's a starting position for every star and the (s) counts them up to 950 stars. That puts in memory 950 stars with starx(s) and stary(s). Make sure somewhere in the beginning of your code you add a DIM statement to make memory available first. For example, I use DIM starx(1000), stary(1000) then to move them, you also need a direction for each graphic you are moving and with that you can also make an array for each graphic to use that certain variable in the array. Then to make them move, I added a FOR/NEXT loop that goes to 950 for all the stars. This makes them all go at once. Mine is a bit complicating for beginners so if you wish, you could try 10 drops of snow moving at once at the same speed or whatever you wish to do. B+ taught me most of this last year and I've been programming with BASIC off and on since the 1980's LOL.
Title: Re: Starfield 2020 - December Version
Post by: madscijr on November 23, 2021, 12:06:26 pm
Here is a question - on my old Mac Classic there was a starfield simulation screensaver where if you pressed the cursor keys up/down/right/left, the stars started moving accordingly, like you were "steering" the spaceship. How would you get that effect, like steering in the old Atari Star Raiders?
Title: Re: Starfield 2020 - December Version
Post by: OldMoses on November 23, 2021, 07:23:07 pm
Here is a question - on my old Mac Classic there was a starfield simulation screensaver where if you pressed the cursor keys up/down/right/left, the stars started moving accordingly, like you were "steering" the spaceship. How would you get that effect, like steering in the old Atari Star Raiders?

I did a fullscreen star field that you can steer. It's not a proper position transformation but "looks" fairly convincing. I'm not sure how it would compare to any particular game action, having not played many.

Code: QB64: [Select]
  1. _TITLE "OldMoses' 3D StarField V.3 (h to toggle help menu)"
  2.  
  3. TYPE star '                                                     define the star data type
  4.     x AS INTEGER '                                              star x coordinate
  5.     y AS INTEGER '                                              star y coordinate
  6.     z AS INTEGER '                                              star z coordinate
  7.     r AS INTEGER '                                              red component
  8.     g AS INTEGER '                                              green component
  9.     b AS INTEGER '                                              blue component
  10.     xa AS INTEGER '                                             apparent x position on screen
  11.     ya AS INTEGER '                                             apparent y position on screen
  12.  
  13. DIM SHARED scrw AS INTEGER '                                    screen width
  14. DIM SHARED scw2 AS INTEGER '                                    1/2 screen width
  15. DIM SHARED scrh AS INTEGER '                                    screen height
  16. DIM SHARED sch2 AS INTEGER '                                    1/2 screen height
  17. DIM SHARED starcount AS INTEGER: starcount = 4000 '             set number of stars to begin with
  18. DIM SHARED p(starcount) AS star '                               dimension the star data array
  19. DIM speed AS INTEGER: speed = 8 '                               warp factor
  20. DIM vwport AS INTEGER: vwport = 1200 '                          set the viewport setback from viewer's eye
  21. DIM xch AS _BYTE '                                              x turn state
  22. DIM ych AS _BYTE '                                              y turn state
  23. DIM hlptog AS _BYTE: hlptog = 0 '                               help menu display toggle
  24. DIM dattog AS _BYTE: dattog = -1 '                              data bar display toggle
  25. DIM tartog AS _BYTE: tartog = 0 '                               target crosshair
  26. DIM lartog AS _BYTE: lartog = 0 '                               large star toggle
  27. DIM bsrad AS _BYTE: bsrad = 1 '                                 star swell radius
  28.  
  29. scrw = _DESKTOPWIDTH: scrh = _DESKTOPHEIGHT - 40
  30. a& = _NEWIMAGE(scrw, scrh, 32)
  31. scw2 = scrw / 2
  32. sch2 = scrh / 2
  33.  
  34. PopVoid '                                                       OldMoses said "Let there be light" and the universe was, is and ever shall be
  35. WINDOW (-scw2, sch2)-(scw2, -sch2) '                            create viewport window, Cap'n Kirk spends his days staring at this
  36. _PRINTMODE _KEEPBACKGROUND '                                    stars show through help menu
  37.  
  38. DO '                                                            draw the stars
  39.     IF _KEYDOWN(104) THEN hlptog = NOT hlptog: _DELAY .1 '      toggle help menu
  40.     IF _KEYDOWN(100) THEN dattog = NOT dattog: _DELAY .1 '      toggle data bar
  41.     IF _KEYDOWN(116) THEN tartog = NOT tartog: _DELAY .1 '      toggle target reticle
  42.     IF _KEYDOWN(108) THEN lartog = NOT lartog: _DELAY .1 '      toggle large stars on/off
  43.     IF _KEYDOWN(43) THEN speed = speed + 1: _DELAY .1 '         increase speed
  44.     IF _KEYDOWN(45) THEN speed = speed - 1: _DELAY .1 '         decrease speed
  45.     IF _KEYDOWN(19200) THEN xch = 1: _DELAY .001 '               turn left
  46.     IF _KEYDOWN(19712) THEN xch = -1: _DELAY .001 '              turn right
  47.     IF _KEYDOWN(18432) THEN ych = -1: _DELAY .001 '              turn up
  48.     IF _KEYDOWN(20480) THEN ych = 1: _DELAY .001 '               turn down
  49.     IF _KEYDOWN(122) THEN vwport = vwport * 2: _DELAY .1 '      zoom x 2
  50.     IF _KEYDOWN(120) THEN vwport = 1200: _DELAY .1 '            zoom normal
  51.     IF _KEYDOWN(97) THEN '                                      add stars
  52.         starcount = starcount + 1 '
  53.         AddStar starcount '
  54.     END IF
  55.     IF _KEYDOWN(115) THEN
  56.         starcount = starcount - 1 '                             subtract stars
  57.         REDIM _PRESERVE p(starcount) AS star '
  58.     END IF
  59.     CLS
  60.     vp12 = vwport / 1200
  61.     pitch = -(SIN(ych * 0.005236) / 2) * (ych <> 0)
  62.     yaw = -(SIN(xch * 0.005236) / 2) * (xch <> 0)
  63.  
  64.     FOR x% = 1 TO starcount '                                    iterate through all stars
  65.  
  66.         IF xch <> 0 OR ych <> 0 THEN '                          not actually a proper transformation
  67.             p(x%).x = p(x%).x + p(x%).z * yaw '                    slew stars for left/right turns
  68.             p(x%).y = p(x%).y + p(x%).z * pitch '                  slew stars for up/down pitch
  69.         END IF
  70.  
  71.         IF p(x%).z > 0 THEN 'ignore those behind, change to a dot product test if a facing vector is later added
  72.             p(x%).xa = p(x%).x / p(x%).z * vwport '                get relative screen position from absolute position for x & y
  73.             p(x%).ya = p(x%).y / p(x%).z * vwport
  74.  
  75.             IF ABS(p(x%).xa) < scw2 AND ABS(p(x%).ya) < sch2 THEN 'place the star if within the viewport
  76.                 dst& = (_HYPOT(_HYPOT(ABS(p(x%).x), ABS(p(x%).y)), ABS(p(x%).z))) / vp12 'distance to star / zoom
  77.                 IF lartog THEN '                                Larger near field stars
  78.                     SELECT CASE dst&
  79.                         CASE 0 TO 1875 'fade to circle 16
  80.                             FCirc p(x%).xa, p(x%).ya, bsrad + 5, _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 1875, 0, 0, 255)) 'proximity star plot
  81.                             FCirc p(x%).xa, p(x%).ya, bsrad + 3, _RGBA32(p(x%).r, p(x%).g, p(x%).b, 255) 'proximity star plot
  82.                         CASE 1876 TO 3750 'fade to circle 8
  83.                             FCirc p(x%).xa, p(x%).ya, bsrad + 3, _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 3750, 1876, 0, 255)) 'proximity star plot
  84.                             FCirc p(x%).xa, p(x%).ya, bsrad + 1, _RGBA32(p(x%).r, p(x%).g, p(x%).b, 255) 'proximity star plot
  85.                         CASE 3751 TO 7500 'fade to circle 4
  86.                             FCirc p(x%).xa, p(x%).ya, bsrad + 1, _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 7500, 3751, 0, 255)) 'proximity star plot
  87.                             FCirc p(x%).xa, p(x%).ya, bsrad, _RGBA32(p(x%).r, p(x%).g, p(x%).b, 255)
  88.                         CASE 7501 TO 14999 'fade to circle 2
  89.                             FCirc p(x%).xa, p(x%).ya, bsrad, _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 14999, 7501, 0, 255)) 'near star plot
  90.                             PSET (p(x%).xa, p(x%).ya), _RGBA32(p(x%).r, p(x%).g, p(x%).b, 255)
  91.                         CASE IS > 15000 'point fade in
  92.                             PSET (p(x%).xa, p(x%).ya), _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 30000, 15000, 0, 255)) 'far star plot
  93.                     END SELECT
  94.                 ELSE
  95.                     SELECT CASE dst&
  96.                         CASE 0 TO 3999 '                        Smaller near field, using map algorithm
  97.                             FCirc p(x%).xa, p(x%).ya, bsrad + 1, _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 3999, 0, 0, 255)) 'proximity star plot
  98.                             FCirc p(x%).xa, p(x%).ya, bsrad, _RGBA32(p(x%).r, p(x%).g, p(x%).b, 255)
  99.                         CASE 4000 TO 14999
  100.                             FCirc p(x%).xa, p(x%).ya, bsrad, _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 14999, 4000, 0, 255)) 'near star plot
  101.                             PSET (p(x%).xa, p(x%).ya), _RGBA32(p(x%).r, p(x%).g, p(x%).b, 255)
  102.                         CASE IS > 15000
  103.                             PSET (p(x%).xa, p(x%).ya), _RGBA32(p(x%).r, p(x%).g, p(x%).b, map!(dst&, 30000, 15000, 0, 255)) 'far star plot
  104.                     END SELECT
  105.                 END IF '                                        end: large star toggle test
  106.             END IF '                                            end: stars within viewport test
  107.         END IF '                                                end: stars in front of viewer test
  108.  
  109.         IF speed <> 0 THEN
  110.             p(x%).z = p(x%).z - speed '                           move the star relative to the viewer
  111.             IF ABS(p(x%).z) > 30000 THEN '                       recycle stars that leave the limits
  112.                 ReplaceStar x%, p(x%).z - (30000 * -SGN(speed))
  113.             END IF
  114.         END IF
  115.  
  116.     NEXT x%
  117.     xch = 0: ych = 0
  118.     IF hlptog THEN HelpScreen
  119.     IF dattog THEN Footer speed, vp12
  120.     IF tartog THEN XHair
  121.     _DISPLAY '                                                  eliminate screen flicker
  122.     _LIMIT 1000 '                                                smooth out the action
  123.  
  124.  
  125.  
  126. SUB PopVoid '                                                   Do an initial population of stars
  127.  
  128.     FOR x% = 1 TO starcount '                                    place a 'starcount' # of stars randomly in a 3D space
  129.         RANDOMIZE TIMER
  130.         p(x%).x = INT(RND * 60000) - 30000
  131.         p(x%).y = INT(RND * 60000) - 30000
  132.         p(x%).z = INT(RND * 60000) - 30000
  133.  
  134.         t% = INT(RND * 110) - 55 '                              star spectrum/color
  135.         ch = INT(RND * 6)
  136.         IF ch < 5 THEN
  137.             p(x%).r = 200 + t%: p(x%).b = 200 - t%
  138.         ELSE
  139.             p(x%).r = 200 - t%: p(x%).b = 200 + t%
  140.         END IF
  141.         g% = INT(RND * 6)
  142.         IF g% = 0 THEN
  143.             g1% = INT(RND * 7) + 1
  144.             p(x%).g = 200 + gi% ^ 2
  145.         ELSE
  146.             p(x%).g = 200
  147.         END IF
  148.     NEXT x%
  149.  
  150. END SUB 'PopVoid
  151.  
  152.  
  153. SUB ReplaceStar (var AS INTEGER, insert AS INTEGER) '           This replaces any star that goes beyond z limits
  154.  
  155.     p(var).x = INT(RND * 60000) - 30000 '                       New x,y,z but keep old color for simplicity sake
  156.     p(var).y = INT(RND * 60000) - 30000
  157.     p(var).z = p(var).z + insert
  158.  
  159. END SUB 'ReplaceStar
  160.  
  161.  
  162. SUB FCirc (CX AS INTEGER, CY AS INTEGER, RR AS INTEGER, C AS _UNSIGNED LONG)
  163.     'Steve's circle fill
  164.     DIM R AS INTEGER, RError AS INTEGER
  165.     DIM X AS INTEGER, Y AS INTEGER
  166.  
  167.     R = ABS(RR)
  168.     RError = -R
  169.     X = R
  170.     Y = 0
  171.     IF R = 0 THEN PSET (CX, CY), C: EXIT SUB
  172.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  173.     WHILE X > Y
  174.         RError = RError + Y * 2 + 1
  175.         IF RError >= 0 THEN
  176.             IF X <> Y + 1 THEN
  177.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  178.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  179.             END IF
  180.             X = X - 1
  181.             RError = RError - X * 2
  182.         END IF
  183.         Y = Y + 1
  184.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  185.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  186.     WEND
  187. END SUB 'FCirc
  188.  
  189.  
  190. SUB AddStar (x AS INTEGER)
  191.  
  192.     REDIM _PRESERVE p(x) AS star
  193.     p(x).x = INT(RND * 60000) - 30000
  194.     p(x).y = INT(RND * 60000) - 30000
  195.     IF speed > 0 THEN
  196.         p(x).z = 30000
  197.     ELSE
  198.         p(x).z = -30000
  199.     END IF
  200.     t% = INT(RND * 110) - 55
  201.     ch = INT(RND * 6)
  202.     IF ch < 5 THEN
  203.         p(x).r = 200 + t%: p(x).b = 200 - t%
  204.     ELSE
  205.         p(x).r = 200 - t%: p(x).b = 200 + t%
  206.     END IF
  207.     g% = INT(RND * 6)
  208.     IF g% = 0 THEN
  209.         g1% = INT(RND * 7) + 1
  210.         p(x).g = 200 + gi% ^ 2
  211.     ELSE
  212.         p(x).g = 200
  213.     END IF
  214.  
  215. END SUB 'AddStar
  216.  
  217. SUB HelpScreen
  218.  
  219.     mi = (sch2) - (15 * 16 / 2) '                           change ...(x * 16 / 2) to x= number of items in menu
  220.     _PRINTSTRING (scw2 - 150, mi), "<+> increase speed", 0
  221.     _PRINTSTRING (scw2 - 150, mi + 16), "<-> decrease speed", 0
  222.     _PRINTSTRING (scw2 - 150, mi + 32), "<left arrow> turn left", 0
  223.     _PRINTSTRING (scw2 - 150, mi + 48), "<right arrow> turn right", 0
  224.     _PRINTSTRING (scw2 - 150, mi + 64), "<up arrow> pitch up", 0
  225.     _PRINTSTRING (scw2 - 150, mi + 80), "<down arrow> pitch down", 0
  226.     _PRINTSTRING (scw2 - 150, mi + 96), "<z> zoom x 2", 0
  227.     _PRINTSTRING (scw2 - 150, mi + 112), "<x> zoom original", 0
  228.     _PRINTSTRING (scw2 - 150, mi + 128), "<a> add stars", 0
  229.     _PRINTSTRING (scw2 - 150, mi + 144), "<s> subtract stars", 0
  230.     _PRINTSTRING (scw2 - 150, mi + 160), "<h> toggle this list on/off", 0
  231.     _PRINTSTRING (scw2 - 150, mi + 176), "<d> toggle data bar", 0
  232.     _PRINTSTRING (scw2 - 150, mi + 192), "<t> toggle crosshairs", 0
  233.     _PRINTSTRING (scw2 - 150, mi + 208), "<l> toggle large stars on/off", 0
  234.     _PRINTSTRING (scw2 - 150, mi + 224), "<ESC> quit", 0
  235.  
  236. END SUB 'HelpScreen
  237.  
  238. SUB Footer (var AS INTEGER, var2 AS INTEGER)
  239.  
  240.     _PRINTSTRING (5, scrh - 60), "Warp " + STR$(var), 0 '     speed indicator
  241.     IF var > 10 THEN _PRINTSTRING (90, scrh - 60), "Ach! muh poor bairns..."
  242.     _PRINTSTRING (scw2 - 50, scrh - 60), "Stars = " + STR$(starcount), 0
  243.     _PRINTSTRING (scrw - 100, scrh - 60), "Mag. x" + STR$(var2), 0 '   magnification factor
  244.  
  245. END SUB 'Footer
  246.  
  247. SUB XHair
  248.  
  249.     LINE (-50, -50)-(-10, -10), &H7FFF0000
  250.     LINE (50, -50)-(10, -10), &H7FFF0000
  251.     LINE (50, 50)-(10, 10), &H7FFF0000
  252.     LINE (-50, 50)-(-10, 10), &H7FFF0000
  253.  
  254. END SUB 'XHair
  255.  
  256. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
  257.  
  258.     'called from: various
  259.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
  260.  
  261.  
  262.  
Title: Re: Starfield 2020 - December Version
Post by: bplus on November 23, 2021, 08:16:03 pm
Yeah I gave it a try here: https://www.qb64.org/forum/index.php?topic=4401.msg138417#msg138417

Not sure about the effects being accurate either, but you sure can see turning!
Title: Re: Starfield 2020 - December Version
Post by: johnno56 on November 23, 2021, 10:52:12 pm
Pretty cool starfield.... One minor point... In 'full screen' mode you would be guessing as how fast you were travelling...
Title: Re: Starfield 2020 - December Version
Post by: madscijr on November 30, 2021, 09:14:36 am
I did a fullscreen star field that you can steer. It's not a proper position transformation but "looks" fairly convincing. I'm not sure how it would compare to any particular game action, having not played many.

Thanks @OldMoses, that was exactly what I was looking for. Nice program!