# Astronomer wip game

33 replies to this topic

### #1 CoolcrabOFFLINE

Coolcrab

• 19 posts
• Location:Stockholm

Posted Sun Sep 24, 2017 10:26 AM

I am trying to make a game where an astronomer is tasked to observe multiple stars for a set amount of time by pointing his telescope at them. The stars move across the screen, preferably rotate or an approximation of that. Each star has a random amount of time that one has to look at it (HP) and dissapears after it is observed long enough. Then a new target is chosen and appears on the screen. The player is scored for each star they observe and loses (their job) if they miss more than 3. (Stars that leave the room with hp>1)

I got a html version of this game here to show the general idea: http://pietrow.net/games/astronomer/and now I'm trying to make this in batari basic and I got a very basic version down with the telescope being able to point in 4 directions to the right. (Game file in attachment)

Before I painstakingly continue with making more directions, I was wondering if there was a better way to it than making room backgrounds of 'beams' pointing in different directions. I've played around with the missile command but those only can be extended in the Y direction so it seems. A line drawn at a certain angle would work much better, and probably look better too.

Next I'll try to move the star in a more circular manner and try to implement more than one. Comments welcome!

Edit: I've edited the game some more. It now has 2 telescopes. (because I couldn't draw nice beams for one. So tips on how to improve that still welcome!) and the star moves faster with a higher score. (it goes linearly so you will probably die before you get 10, so that needs tweaks.) The star also moves in a semi circular orbit now.

Next hurdle: how to draw multiple stars with separate HP and position? (They should share velocity.) And how to make a better beam?

Move beam with L and R, switch telescope with up and down.

#### Attached Files

Edited by Coolcrab, Sun Sep 24, 2017 2:07 PM.

### #2 mikaOFFLINE

mika

Chopper Commander

• 105 posts

Posted Sun Sep 24, 2017 10:48 AM

original! I like it

### #3 KeatahOFFLINE

Keatah

• 18,327 posts

Posted Sun Sep 24, 2017 11:16 AM

Could be interesting. Get some intermittent clouds wafting by where you have to predict the location of the object. Have bonus meteors. Hidden DSOs. Satellites. Bonus planets. Wind shaking the telescope.. And more! A psychedelic eclipse boss round, and 2-player Battle of the Observatories where you rack up \$\$\$ to build more telescopes. A solar flare that temporarily blinds you and knocks the electrics off-line. Multiple telescopes to pick from, wide or narrow field. Unlock the space telescope and radio telescope..

Edited by Keatah, Sun Sep 24, 2017 11:24 AM.

### #4 kdgarrisONLINE

kdgarris

Chopper Commander

• 201 posts

Posted Sun Sep 24, 2017 11:21 AM

I appreciate the cleverness of this one as well.  Making an action game based on astronomy?  Awesome!

### #5 KeatahOFFLINE

Keatah

• 18,327 posts

Posted Sun Sep 24, 2017 11:25 AM

Reminded me of Return of the Jedi where you have the swinging light sabers..

### #6 KaeruYojimboOFFLINE

KaeruYojimbo

Stargunner

• 1,330 posts
• Location:Portland, OR

Posted Sun Sep 24, 2017 11:39 AM

Really cool concept. You could make diagonals with the missile in assembly (it's how the vines in Pitfall are done), but there isn't a way to do that with batari basic as far as I know.

### #7 CoolcrabOFFLINE

Coolcrab

• Topic Starter
• 19 posts
• Location:Stockholm

Posted Sun Sep 24, 2017 11:40 AM

Reminded me of Return of the Jedi where you have the swinging light sabers..

Oh I didn't think of that game. Any clue on how they programmed this? Is it a sprite or a background? And did they just draw each position?

Really cool concept. You could make diagonals with the missile in assembly (it's how the vines in Pitfall are done), but there isn't a way to do that with batari basic as far as I know.

I haven't looked into assembly at all, are there tutorial sites on that?

This guy also did it in the same way I did, i.e. with backgrounds. http://sebastianmiha...m/main.php?t=47So perhaps this is the only way

Could be interesting. Get some intermittent clouds wafting by where you have to predict the location of the object. Have bonus meteors. Hidden DSOs. Satellites. Bonus planets. Wind shaking the telescope.. And more! A psychedelic eclipse boss round, and 2-player Battle of the Observatories where you rack up \$\$\$ to build more telescopes. A solar flare that temporarily blinds you and knocks the electrics off-line. Multiple telescopes to pick from, wide or narrow field. Unlock the space telescope and radio telescope..

The clouds are a good idea! It would probably be cool if the stars were 'immune' while in a cloud. Multiplayer would also be awesome, but I will focus on 1p first. I'm sure that I'll have to remake the whole thing a few times anyhow.

Edited by Coolcrab, Sun Sep 24, 2017 11:58 AM.

### #8 KeatahOFFLINE

Keatah

• 18,327 posts

Posted Sun Sep 24, 2017 12:28 PM

Oh I didn't think of that game. Any clue on how they programmed this? Is it a sprite or a background? And did they just draw each position?

You'll want to ask an expert VCS programmer, and that is definitely most absolutely not me.

### #9 CoolcrabOFFLINE

Coolcrab

• Topic Starter
• 19 posts
• Location:Stockholm

Posted Sun Sep 24, 2017 2:07 PM

### #10 SpiceWareOFFLINE

SpiceWare

• 11,487 posts
• Medieval Mayhem
• Location:Planet Houston

Posted Sun Sep 24, 2017 2:24 PM

Oh I didn't think of that game. Any clue on how they programmed this? Is it a sprite or a background? And did they just draw each position?

### #11 KeatahOFFLINE

Keatah

• 18,327 posts

Posted Sun Sep 24, 2017 2:41 PM

Versions should have a date in them so they can be referenced for comparisons.

### #12 mikaOFFLINE

mika

Chopper Commander

• 105 posts

Posted Sun Sep 24, 2017 3:37 PM

Versions should have a date in them so they can be referenced for comparisons.

I would also suggest adding a name, for those of us checking the newest build with Stella - it's hard to navigate within a folder full of default.bas.bins!

### #13 Random TerrainOFFLINE

Random Terrain

Visual batari Basic User

• 28,179 posts
• Controlled Randomness
Replay Value
Nonlinear
• Location:North Carolina (USA)

Posted Sun Sep 24, 2017 7:23 PM

I would also suggest adding a name, for those of us checking the newest build with Stella - it's hard to navigate within a folder full of default.bas.bins!

atariage.com/forums/topic/181075-posting-tips-for-new-bb-users/

### #14 KaeruYojimboOFFLINE

KaeruYojimbo

Stargunner

• 1,330 posts
• Location:Portland, OR

Posted Mon Sep 25, 2017 9:17 AM

It might be possible to use the pfvline to draw lines with the playfield blocks if you can come up with a good way to programmatically determine where the vertical sections should begin and end to create diagonal lines.

### #15 CoolcrabOFFLINE

Coolcrab

• Topic Starter
• 19 posts
• Location:Stockholm

Posted Thu Sep 28, 2017 3:01 PM

It might be possible to use the pfvline to draw lines with the playfield blocks if you can come up with a good way to programmatically determine where the vertical sections should begin and end to create diagonal lines.

I tried the function but I couldn't find a good way of implementing it. However, I decided to just draw every option by hand.

But for some reason it does not accept my code. Could it be that it is too long? It compiles but gives a black screen that doesn't respond to anything. Code below

```main1

y=0
player1x=80:player1y=85
player0x=0:player0y=10
c =10
l=0
score = 10

main
COLUBK=\$0E
COLUP1=\$28

if y=0 then playfield:
.............................
.............................
.............................
.............................
.............................
.............................
.............................
.............................
XXXXXXXXXXXXXXX..............
.............................
.............................
end
if y=5 then playfield:
.............................
.............................
.............................
.............................
.............................
.............................
.............................
XXXXXXXX.....................
........XXXXXXX..............
.............................
.............................
end
if y=10 then playfield:
.............................
.............................
.............................
.............................
.............................
.............................
XXXX.........................
....XXXXXXX..................
...........XXXX..............
.............................
.............................
end

if y=15 then playfield:
.............................
.............................
.............................
.............................
.............................
XXX..........................
...XXXXX.....................
........XXXX.................
............XXX..............
.............................
.............................
end
if y=20 then playfield:
.............................
.............................
.............................
.............................
.............................
XXX..........................
...XXXXX.....................
........XXXX.................
............XXX..............
.............................
.............................
end
if y=25 then playfield:
.............................
.............................
.............................
.............................
XX...........................
..XXXX.......................
.....XXXX....................
.........XXXX................
.............XX..............
.............................
.............................
end
if y=30 then playfield:
.............................
.............................
.............................
XX...........................
..XXX........................
.....XXX.....................
........XX...................
..........XXX................
.............XX..............
.............................
.............................
end
if y=35 then playfield:
.............................
.............................
XX...........................
..XX.........................
....XX.......................
......XXX....................
.........XX..................
...........XX................
.............XX..............
.............................
.............................
end
if y=40 then playfield:
.............................
XX...........................
..XX.........................
....XX.......................
......XX.....................
........XX...................
..........XX.................
............XX...............
..............X..............
.............................
.............................
end
if y=45 then playfield:
X............................
.XX..........................
...XX........................
.....XX......................
.......XX....................
.........X...................
..........XX.................
............XX...............
..............X..............
.............................
.............................
end
if y=50 then playfield:
.X...........................
..XX.........................
....XX.......................
......X......................
.......XX....................
.........X...................
..........XX.................
............XX...............
..............X..............
.............................
.............................
end
if y=55 then playfield:
..X..........................
...XX........................
.....X.......................
......XX.....................
........X....................
.........XX..................
...........X.................
............XX...............
..............X..............
.............................
.............................
end
if y=60 then playfield:
...X.........................
....XX.......................
......X......................
.......X.....................
........XX...................
..........X..................
...........X.................
............XX...............
..............X..............
.............................
.............................
end
if y=65 then playfield:
....X........................
.....X.......................
......XX.....................
........X....................
.........X...................
..........X..................
...........XX................
.............X...............
..............X..............
.............................
.............................
end
if y=70 then playfield:
.....X.......................
......X......................
.......X.....................
........X....................
.........XX..................
...........X.................
............X................
.............X...............
..............X..............
.............................
.............................
.............................
end
if y=75 then playfield:
.......X.....................
........X....................
.........X...................
..........X..................
...........X.................
............X................
.............X...............
..............X..............
.............................
.............................
end
if y=80 then playfield:
.......X.....................
........X....................
.........X...................
..........X..................
..........X..................
...........X.................
............X................
.............X...............
..............X..............
.............................
.............................
end
if y=85 then playfield:
........X....................
.........X...................
.........X...................
..........X..................
...........X.................
............X................
............X................
.............X...............
..............X..............
.............................
.............................
end
if y=90 then playfield:
.........X...................
..........X..................
..........X..................
...........X.................
...........X.................
............X................
.............X...............
.............X...............
..............X..............
.............................
.............................
end
if y=100 then playfield:
..........X..................
..........X..................
...........X.................
...........X.................
............X................
............X................
.............X...............
.............X...............
..............X..............
.............................
.............................
end
if y=110 then playfield:
...........X.................
...........X.................
............X................
............X................
............X................
.............X...............
.............X...............
..............X..............
..............X..............
.............................
.............................
end
if y=120 then playfield:
............X................
............X................
............X................
.............X...............
.............X...............
.............X...............
.............X...............
..............X..............
..............X..............
.............................
.............................
end
if y=130 then playfield:
.............X...............
.............X...............
.............X...............
.............X...............
.............X...............
..............X..............
..............X..............
..............X..............
..............X..............
.............................
.............................
end
if y=140 then playfield:
..............X..............
..............X..............
..............X..............
..............X..............
..............X..............
..............X..............
..............X..............
..............X..............
..............X..............
.............................
.............................
end
if y=150 then playfield:
...............X.............
...............X.............
...............X.............
...............X.............
...............X.............
..............X..............
..............X..............
..............X..............
..............X..............
.............................
.............................
end
if y=160 then playfield:
................X............
................X............
................X............
...............X.............
...............X.............
...............X.............
...............X.............
..............X..............
..............X..............
.............................
.............................
end
if y=170 then playfield:
.................X...........
.................X...........
................X............
................X............
................X............
...............X.............
...............X.............
..............X..............
..............X..............
.............................
.............................
end
if y=180 then playfield:
..................X..........
..................X..........
.................X...........
.................X...........
................X............
................X............
...............X.............
...............X.............
..............X..............
.............................
.............................
end
if y=190 then playfield:
...................X.........
..................X..........
..................X..........
.................X...........
.................X...........
................X............
...............X.............
...............X.............
..............X..............
.............................
.............................
end
if y=200 then playfield:
....................X........
...................X.........
...................X.........
..................X..........
.................X...........
................X............
................X............
...............X.............
..............X..............
.............................
.............................
end
if y=210 then playfield:
.....................X.......
....................X........
...................X.........
..................X..........
..................X..........
.................X...........
................X............
...............X.............
..............X..............
.............................
.............................
end
if y=220 then playfield:
.....................X.......
....................X........
...................X.........
..................X..........
.................X...........
................X............
...............X.............
..............X..............
.............................
.............................
end
if y=230 then playfield:
.......................X.....
......................X......
.....................X.......
....................X........
..................XX.........
.................X...........
................X............
...............X.............
..............X..............
.............................
.............................
.............................
end
if y=240 then playfield:
........................X....
.......................X.....
.....................XX......
....................X........
...................X.........
..................X..........
................XX...........
...............X.............
..............X..............
.............................
.............................
end
if y=250 then playfield:
.........................X...
.......................XX....
......................X......
.....................X.......
...................XX........
..................X..........
.................X...........
...............XX............
..............X..............
.............................
.............................
end
if y=260 then playfield:
..........................X..
........................XX...
.......................X.....
.....................XX......
....................X........
..................XX.........
.................X...........
...............XX............
..............X..............
.............................
.............................
end
if y=270 then playfield:
...........................X.
.........................XX..
.......................XX....
......................X......
....................XX.......
...................X.........
.................XX..........
...............XX............
..............X..............
.............................
.............................
end
if y=280 then playfield:
............................X
..........................XX.
........................XX...
......................XX.....
....................XX.......
...................X.........
.................XX..........
...............XX............
..............X..............
.............................
.............................
end
if y=290 then playfield:
.............................
...........................XX
.........................XX..
.......................XX....
.....................XX......
...................XX........
.................XX..........
...............XX............
..............X..............
.............................
.............................
end
if y=300 then playfield:
.............................
.............................
...........................XX
.........................XX..
.......................XX....
....................XXX......
..................XX.........
................XX...........
..............XX.............
.............................
.............................
end
if y=310 then playfield:
.............................
.............................
.............................
...........................XX
........................XXX..
.....................XXX.....
...................XX........
................XXX..........
..............XX.............
.............................
.............................
end
if y=320 then playfield:
.............................
.............................
.............................
.............................
...........................XX
.......................XXXX..
....................XXXX.....
................XXXX.........
..............XX.............
.............................
.............................
end
if y=330 then playfield:
.............................
.............................
.............................
.............................
.............................
..........................XXX
.....................XXXXX...
.................XXXX........
..............XXX............
.............................
.............................
end
if y=340 then playfield:
.............................
.............................
.............................
.............................
.............................
..........................XXX
.....................XXXXX...
.................XXXX........
..............XXX............
.............................
.............................
end
if y=350 then playfield:
.............................
.............................
.............................
.............................
.............................
.............................
.........................XXXX
..................XXXXXXX....
..............XXXX...........
.............................
.............................
end
if y=360 then playfield:
.............................
.............................
.............................
.............................
.............................
.............................
.............................
.....................XXXXXXXX
..............XXXXXXX........
.............................
.............................
end
if y=370 then playfield:
.............................
.............................
.............................
.............................
.............................
.............................
.............................
.............................
..............XXXXXXXXXXXXXXX
.............................
.............................
end

player0:
%00000000
%00000000
%00011000
%00111100
%00111100
%00011000
%00000000
%00000000
end

if y=0 then player1:
%01111110
%00111100
%00011000
%00011000
%00111100
%00000000
%00000000
%00000000
end
if y=10 then player1:
%01111110
%00111100
%00011100
%00001000
%00000101
%00000010
%00000100
%00000000
end

if y=20 then player1:
%01111110
%00111100
%00011001
%00001111
%00000001
%00000000
%00000000
%00000000
end

if joy0right then y=y+1
if joy0left then y=y-1

if c>10 then player0x=player0x+1: c=0
c=c+1

if collision(player0,playfield) then l=l+1
if l>100 then score=score+1: player0x=5:player0y=70: l=0

drawscreen

goto main
```

### #16 Random TerrainOFFLINE

Random Terrain

Visual batari Basic User

• 28,179 posts
• Controlled Randomness
Replay Value
Nonlinear
• Location:North Carolina (USA)

Posted Thu Sep 28, 2017 6:56 PM

I don't see this in your code:

randomterrain.com/atari-2600-memories-batari-basic-commands.html#colupf

### #17 KeatahOFFLINE

Keatah

• 18,327 posts

Posted Thu Sep 28, 2017 7:34 PM

It's fun to scroll post #15 up and down at hi-speed. Swish-Swoom-Swish-Swoom! Anyone want to do a game about windshield wipers?

### #18 CoolcrabOFFLINE

Coolcrab

• Topic Starter
• 19 posts
• Location:Stockholm

Posted Fri Sep 29, 2017 1:22 AM

Put it in the main right under the other colors but it doesn't seem to fix it.

```main
COLUBK=\$0E
COLUP1=\$28
COLUPF = \$26
```

The code worked when I had less rooms, could that be it? Also their size is 29x11, to get more symmetry, does it possibly not like that?

### #19 Random TerrainOFFLINE

Random Terrain

Visual batari Basic User

• 28,179 posts
• Controlled Randomness
Replay Value
Nonlinear
• Location:North Carolina (USA)

Posted Fri Sep 29, 2017 3:23 AM

Variables can hold a value ranging from 0 to 255:

randomterrain.com/atari-2600-memories-batari-basic-commands.html#bq_what_is_a_variable

It won't compile because of the code that is trying to go beyond 255.

It works with the offending lines REMed out, but you only have 449 bytes of ROM space left after doing that, so you'll run out of space once you fix your variable problem. You'll probably need to use a different technique. As far as I know, the two line commands make straight lines, not diagonals, so you'd probably have to use pfpixel.

### #20 kdgarrisONLINE

kdgarris

Chopper Commander

• 201 posts

Posted Fri Sep 29, 2017 8:30 AM

If I were doing this, I would make an integer-based line-drawing function that reads start and end coordinates from a data table, and plots them with pfpixel as RT suggested.  If I have time, I'll try to make an example program that does this.

### #21 CoolcrabOFFLINE

Coolcrab

• Topic Starter
• 19 posts
• Location:Stockholm

Posted Fri Sep 29, 2017 4:06 PM

Variables can hold a value ranging from 0 to 255:

randomterrain.com/atari-2600-memories-batari-basic-commands.html#bq_what_is_a_variable

It won't compile because of the code that is trying to go beyond 255.

It works with the offending lines REMed out, but you only have 449 bytes of ROM space left after doing that, so you'll run out of space once you fix your variable problem. You'll probably need to use a different technique. As far as I know, the two line commands make straight lines, not diagonals, so you'd probably have to use pfpixel.

Yes this works thanks! But now when I try to run it it gives black static unless I remove like a quarter of the rooms. I'm guessing that that is the space issue. It looks a lot better in transition though. So It's a pity that this does not work. You can't make an 8k game with batari basic?

I've looked into pfpixel and the other two line commands, but I can't think of a way to draw the lines without programming in all pixels manually. And that would probably take up more space? Is space defined as the amount of characters used? I guess you'd have less lines per room, as a lot of the pixels can be seen as a 1x2 hline or vline. So might be worth a try. Do you think it will be worth the effort or still be too long?

If I were doing this, I would make an integer-based line-drawing function that reads start and end coordinates from a data table, and plots them with pfpixel as RT suggested.  If I have time, I'll try to make an example program that does this.

This would be great. If you do not have time, could you tell me how you would tackle such a problem. I don't know how to atomize the process and keep the lines symmetrical.

Edited by Coolcrab, Fri Sep 29, 2017 4:06 PM.

### #22 bogaxOFFLINE

bogax

Dragonstomper

• 710 posts

Posted Fri Sep 29, 2017 4:53 PM

This would be great. If you do not have time, could you tell me how you would tackle such a problem. I don't know how to atomize the process and keep the lines symmetrical.

You could adapt this to draw lines (Bresenhams algorithm is for drawing lines)

I don't know if it would be fast enough

I'd do the pixel setting and clearing in bB for speed

### #23 CoolcrabOFFLINE

Coolcrab

• Topic Starter
• 19 posts
• Location:Stockholm

Posted Sat Sep 30, 2017 9:11 AM

You could adapt this to draw lines (Bresenhams algorithm is for drawing lines)

I don't know if it would be fast enough

I'd do the pixel setting and clearing in bB for speed

Yes thank you, this is also what I found on stack overflow. I'm trying to implement the code to draw squares but i'm messing up and not sure how to fix it. Instead of an object I make a variable xpos, ypos that 'walks' to the chosen coordinate and whenever it is not touching the playfield it turns the pfpixel to on. Then when it reaches the desired position it stops altogether. This is fast and perfect..

Now I am trying to couple this to a paddle, but it seems not to accept the paddle keyword. (And I tried to copy the readpaddle example) It's getting there though Thanks all for the help!

If you replace  if p <> paddle then x = paddle : goto center by  if joy0fire then x = x + 1 : y = 2 : goto enter for example then the code works in plotting the lines.

``` set kernel_options no_blank_lines readpaddle
drawscreen

dim ea = a
dim dy = b
dim dx = c
dim x1 = temp1
dim x0 = temp2
dim y1 = temp3
dim y0 = temp4
dim delay = h
dim rand16 = z
dim xpos = k
dim ypos = l
x = 0
y = 3
t = 0

player0:
%11000000
%11000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
end

player1:
%11110000
%11110000
%11110000
%11110000
%00000000
%00000000
%00000000
%00000000
end

xpos = 14  : ypos = 9
pfpixel xpos ypos on

goto enter

loop

COLUP0 = \$1C
COLUP1 = \$B4
COLUPF = \$62
drawscreen

if xpos <>  x && ypos <> y then pfpixel xpos ypos on: gosub move

goto loop

enter
xpos=14 :  ypos=9
pfpixel xpos ypos on
x0 = xpos : y0 = ypos
x1 = x  :  y1 = y

gosub setup_move
goto pf

move
temp1 = ea

if f{0} then skip
ypos = ypos + yinc[f]
ea = ea - dx
if temp1 < ea then ea = ea + dy : xpos = xpos + xinc[f]
return
skip
xpos = xpos + xinc[f]
ea = ea - dy
if temp1 < ea then ea = ea + dx : ypos = ypos + yinc[f]
return

setup_move
if x0 < x1 then f{2} = 1 : dx = x1 - x0 else f{2} = 0 : dx = x0 - x1
if y0 < y1 then f{1} = 1 : dy = y1 - y0 else f{1} = 0 : dy = y0 - y1

if dx > dy then f{0} = 1 : ea = dx else f{0} = 0 : ea = dy
var36 = f
return

data yinc
\$FF, \$FF, \$01, \$01, \$FF, \$FF,\$01, \$01
end

data xinc
\$FF, \$FF, \$FF, \$FF, \$01, \$01, \$01, \$01
end

pf
playfield:
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
end

goto loop

```

Edited by Coolcrab, Sat Sep 30, 2017 9:13 AM.

### #24 KaeruYojimboOFFLINE

KaeruYojimbo

Stargunner

• 1,330 posts
• Location:Portland, OR

Posted Sat Sep 30, 2017 9:24 AM

You have "goto center" but the label is "enter"

### #25 CoolcrabOFFLINE

Coolcrab

• Topic Starter
• 19 posts
• Location:Stockholm

Posted Sat Sep 30, 2017 10:02 AM

You have "goto center" but the label is "enter"

Wow good call I missed that, but it still does not seem to react properly. I also hooked paddle to score to see how it behaves, but it stays at 64. (score = paddle) (And I changed the stella settings to use a paddle instead of a joystick in the settings.)

Once that is done I think its just a matter of normalizing the paddle output and bam.

#### 0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users