Jump to content
IGNORED

Writing My First Lines of Code in Batari Basic - Miniature Golf


Recommended Posts

Posted (edited)

I am considering making a few changes to the game design.

Spoiler
  • Get rid of the power bar and hook/slice meter.  Instead, just use controls like in Miniature Golf (Atari, 1979).  The location of the bullseye (or the putter club head) gives you both the angle and the power.  
  • Get rid of the player graphics.  Just keep the ball and the bullseye (and putter club head).  
  • Let the player switch easily between two methods of playing the ball: toward or away.
  • BULLSEYE: the ball moves toward the bullseye.
  • PUTTER CLUB HEAD: the ball moves away from the putter club head.  
  • These two ways of playing the ball will allow the player to play the ball in any direction even when the ball is near the edges of the playfield.  
  • I may also get rid of the Mulligans.  
Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Super Chip Double-Height Playfield Test - No Lines

image.jpeg.bb08a93213bc51eab41c2388d02e3d29.jpeg

Source

Spoiler

 
 set romsize 8kSC
 set kernel_options no_blank_lines
 rem  *  Cost: loss of missile0.
 set tv ntsc

__INTRO x = 75 : y = 50
    COLUBK = $C8
    scorecolor = $1A
 const pfscore = 1
 const pfres=24
 pfscorecolor = $1A
  pfscore1=%00000000 :  if switchleftb then pfscore1 = %00010101
  pfscore2=%00000000 :  if switchrightb then pfscore2 = %10101000

 playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........XX....................X
 X.........XXXXXXXXXXX..........X
 X..............................X
 X..............................X
 X..............................X
 X..............................X
 X..............................X
 XX.............................X
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 ................................ ; extra line removes unwanted "icing" on bottom row
end

 player0:

 %0100010
 %1000001
 %0000000
 %0001000
 %0000000
 %1000001
 %0100010
end
    
__MAIN 
    COLUP0 = $1A
    m=1 : if joy0fire then m=2 
    if joy0up then y = y - m: if y<9 then y= y + m
    if joy0down then y = y + m: if y>93 then y=y-m
    if joy0left then x = x - m: if x<5 then x=x+m
    if joy0right then x = x + m: if x>150 then x=x-m
    player0x = x : player0y = y
    drawscreen
    if switchreset then goto __INTRO
    goto __MAIN


 

0008_SC_PF_Test_no_lines.bas.bin

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Playfield Choice

Spoiler

I will probably use the one above, the Super Chip Double Height Playfield with the No Lines Option. 

  • It looks nice.
  • More room for playing miniature golf inside the thinner walls.
  • Programming-wise, easy to implement. 
  • I was going to use missile0 to make the power meter, but if we're not doing that, then I guess I don't need missile0.   

 

Joystick and Game Controls

Spoiler

Next, I would like to plan out the controls.

  • I wish to make my game "couch compliant."  
  • It would be so easy to use the color/b&w switch and A/B difficulty switches as game controls, but I really would rather not do that.  
  • I also don't wish to use player two's joystick controls for player one's game.  
  • GOAL: Let all of player one's game controls be done using just player one's own joystick.  

Borrowing ideas from Under the Castle, I think the joystick button in my game can be used in place of up to four separate buttons.  

 

With the joystick in the neutral position: 

  • INPUT 1: tap the joystick button once
  • INPUT 2: double tap the joystick button
  • INPUT 3: triple tap the joystick button
  • INPUT 4: long press the joystick button
Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Mapping Out Controls

Spoiler

With joystick in neutral position:

  • SINGLE TAP - switch between the bullseye and the putter club head
  • LONG PRESS - hit the ball
  • DOUBLE TAP - take a Mulligan

With joystick not in neutral position

  • PRESS AND HOLD BUTTON - move bullseye/putter club head very slowly for fine aiming adjustments
  • RELEASE BUTTON - to move bullseye/putter club head at normal speed
Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Ball and Playfield Wall Collision Handling

Spoiler

Borrowing ideas from Combat (Atari, 1977), as @LatchKeyKid mentioned (Thank you!), I think I will do something like this.

 

Suppose the ball is moving at some angle up and to the right and a collision with a playfield wall occurs.  Given that the playfield pixels are squares and/or rectangles, there are only three possibilities:

  1. The ball has hit a horizontal wall above it.
  2. The ball has hit a vertical wall to the right of it.
  3. The ball has hit exactly in the corner where a horizontal and vertical wall meet.  

To find out which, you just need to do two simple tests.  In the first test, position the ball a few pixels to the right.  In the second test, position the ball a few pixels up.  Which tests resulted in collisions with walls?  Based on these answers, you can I think positively conclude whether the collision is of the type 1, 2 or 3, above.  

 

Test 1 is positive and Test 2 is negative: Ball hit vertical wall to the right

Test 1 is negative and Test 2 is positive: Ball hit horizontal wall above it.

Tests 1 and 2 are both positive.  Ball has hit exactly in the corner where a horizontal and vertical wall meet.  

 

Similar reasoning can be used if the ball were travelling up and to the left, down and to the left or down and to the right.  

 

Finally, since all playfield walls are either horizontal or vertical, the ball will always bounce off the walls at the same angle that it hit the walls.  No math is required, I think.  

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Calculation of Square Roots

Spoiler

Like in Miniature Golf (Atari, 1979), the distance of the bullseye/putter club head to the ball will be used to set the ball's initial velocity when struck.  We will know the x and y coordinates of both the ball and the bullseye/putter club head.  We will want, I'm sure, to use the distance formula to find the distance.  Since the distance formula requires a square root calculation, and it looks like Batari Basic doesn't do square roots, then I guess I will just need to create a subroutine to do square roots.  

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Six-Digit Score - Idea A

Spoiler

Let's call the six digits, from left to right, D1 through D6.

Suppose the game is a 9-hole miniature golf course and suppose hole #1 is a par 4.

Suppose the player is a novice and has 10 strokes on hole 1.  

 

Scoreboard Digits

D1: hole number (value 1-9)

D2: blank

D3: par for hole (value 1-5)

D4: blank

D5-D6: player's 2-digit number of strokes on this hole (value 0-99)

 

By using a little flickering, I think we can get all three pieces of information on the scoreboard at the same time.

  • First write the hole number and par with blanks afterward ("1 _ 4 _ _ _")  NOTE: "0" will be used for the blanks.  
  • Then write the player's strokes with blanks in front ("_ _ _ _ 1 0")  NOTE: Now, we need the "0," so a different number will be used for the blanks.  
  • By alternating, there will be flicker, but I think the human player will see all three numbers appear on the scoreboard at once.  ("1 _ 4 _ 1 0")
Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Six-Digit Score - Idea B

Spoiler

Idea B

 

No flickering.  Animate the scoreboard.  

 

Show hole # and par for a few seconds. ("2 _ 3 _ _ _") (this is hole #2 and it's a par 3)

 

Then show the strokes (this hole) and total strokes for a few seconds. ("1 _ _ 4 _") (You have one stroke so far on this hole, 4 strokes totally in the game.)

 

Alternate indefinitely.  

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

64k Super Chip, Double-Height, No Lines Test

Comments

Spoiler

RT's guide says that 8k, 16k, 32k and 64k sizes are all available with the Super Chip kernel.  I compiled ROMS in all of those sizes and they all worked.  Here is the 64k version.  

image.jpeg.2887db1c0ca05efdea382b6010b379a0.jpeg

Spoiler

 
 set romsize 64kSC
 set kernel_options no_blank_lines
 rem  *  Cost: loss of missile0.
 set tv ntsc

__INTRO x = 75 : y = 50
    COLUBK = $C8
    scorecolor = $1A
 const pfscore = 1
 const pfres=24
 pfscorecolor = $1A
  pfscore1=%00000000 :  if switchleftb then pfscore1 = %00010101
  pfscore2=%00000000 :  if switchrightb then pfscore2 = %10101000

 playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........XX....................X
 X.........XXXXXXXXXXX..........X
 X..............................X
 X..............................X
 X..............................X
 X..............................X
 X..............................X
 XX.............................X
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 ................................ ; extra line removes unwanted "icing" on bottom row
end

 player0:

 %0100010
 %1000001
 %0000000
 %0001000
 %0000000
 %1000001
 %0100010
end
    
__MAIN 
    COLUP0 = $1A
    m=1 : if joy0fire then m=2 
    if joy0up then y = y - m: if y<9 then y= y + m
    if joy0down then y = y + m: if y>93 then y=y-m
    if joy0left then x = x - m: if x<5 then x=x+m
    if joy0right then x = x + m: if x>150 then x=x-m
    player0x = x : player0y = y
    drawscreen
    if switchreset then goto __INTRO
    goto __MAIN

0008_64k_SC_DH_NL_PF_Test.bas.bin

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Scoreboard Test

Comments

Spoiler

By making all the pixels 1's, you can turn the entire 6-digit scoreboard area into one, long, rectangular space.  It's not very big, but I guess you could draw or write anything you want in there.  As RT's guide says, "The Score Editor allows you to create custom fonts for the score across the bottom of your game. You can do more than just make your own numbers. If your game doesn't use a score, you can use the score to display a life bar, items for an adventure game, or anything you can imagine."

image.jpeg.8d6ddc77d50c8ba5f487b4b4f982d645.jpeg

0008_64k_SC_DH_NL_Scoreboard_Test.bas.bin

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Game Controls with a Menu

 

Spoiler

Here is an idea for couch compliant game controls that let you do everything with one joystick.  

 

AIMING (bullseye, normal speed is default)

  • move the joystick to move the bullseye (or putter head) to aim
  • pressing and holding the button will slow movement down for fine adjustment of the aim.  Releasing the button returns movement to normal speed.

MENU

  • With the joystick in the neutral position, press-and-release (AKA "tap") the button.  A menu will appear, nice and big, right in the center of the screen.  
    • The golf playfield will disappear and a special menu playfield will appear in it's place.  (Or, perhaps the menu will be drawn on top of the golf playfield.)  
  • The menu will have the following options: 
    • change aim style to either the bullseye or putter head (represented by either a bullseye or a putter head sprite)
    • hit the ball (represented by a sprite of a player swinging his or her golf club)
    • take a Mulligan (represented by a "-1")
    • cancel/exit (represented by an "X") 
  • initially, the "X" (cancel) is selected by default.
  • The player moves the joystick up/down to select his or her choice.
  • Perhaps the selected sprite will be made bigger than the others so you can tell which one you have selected.  
  • Press the button to activate your choice.

Example: You are playing mini golf.  You move the joystick to aim using the bullseye.  You press and hold the button to aim more precisely and release the button to move the bullseye faster.  When you are ready to swing, you let go of the joystick and press the button.  A large menu appears in the middle of the screen.  You move the joystick up to select the sprite of a golfer swinging his or her club and press the button.  The menu disappears and the golf screen re-appears.  The ball is hit and moves briskly to its new resting location and one stroke is added to your score on the scoreboard.  

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Tap Recognition

Spoiler

In the main loop

  • if all joystick directions are false and the button is true, then set flag and set counter and goto __CHECK_FOR_TAP routine

 

__CHECK_FOR_TAP 

  • Has the counter reached zero?
    • Yes
      • No tap.  Reset flag and return.
    • No
      • Is the button still down?
        • Yes - decrement counter and return. 
        • No - It's a tap.  Open the menu.  

 

In words: The player lets the joystick return to neutral and taps the button.  The program sees the "tap" happening in slow motion.  The program first detects that the joystick is in the center and the button went down.  The program sets a flag (so it remembers to keep watching) and sets a counter (like a timer to limit the amount of time allowed for a "tap").  Each time through the main loop, the flag will remind the program to check the status of the button.  Is it still down or was it released before the time expired?  If the button is released before time expires (say, in half a second) then it's a "tap" and the program will do whatever action is indicated by a tap such as opening the menu.  

Edited by Living Room Arcade
Link to comment
Share on other sites

Posted (edited)

Hold Button for Slow Aim

image.jpeg.33f5b7e448738ce58d5255e0f806a651.jpeg

Source

Spoiler

 
 set romsize 64kSC
 set kernel_options no_blank_lines
 ; cost loss of missile0
 set tv ntsc

__INTRO x = 75 : y = 50 
    COLUBK = $C8
    scorecolor = $1A
 const pfscore = 1
 const pfres=24
 pfscorecolor = $1A
  pfscore1=%00000000 :  if switchleftb then pfscore1 = %00010101
  pfscore2=%00000000 :  if switchrightb then pfscore2 = %10101000

 playfield:
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........X.....................X
 X........XX....................X
 X.........XXXXXXXXXXXXXXX......X
 X..............................X
 X..............................X
 X..............................X
 XX.............................X
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 ................................ ; extra line removes unwanted "icing" on bottom row
end

 player0:

 %0100010
 %1000001
 %0000000
 %0001000
 %0000000
 %1000001
 %0100010
end
    
 m=1 
 c=0 

__MAIN 
    COLUP0 = $1A
 
  c=c+1 

  d=1 :  if joy0fire then d=4 ; while button is down, only move aim once every d frames


 if c<d then goto __SKIP_AIM
  
    if joy0left then x = x - m: if x<5 then x=x+m
    if joy0right then x = x + m: if x>150 then x=x-m
    if joy0up then y = y - m: if y<9 then y= y + m
    if joy0down then y = y + m: if y>93 then y=y-m
 c=0

 

__SKIP_AIM
     player0x = x : player0y = y
    drawscreen
    if switchreset then goto __INTRO
    goto __MAIN

 

0008_64k_SC_DH_NL_Slow_Aim_Test.bas.bin

Edited by Living Room Arcade
Link to comment
Share on other sites

  • 2 weeks later...

To Do List

 

Spoiler
  • Implement The Parts of a Program
  • Implement Bit Addressing to save RAM
    • Use DIM to make bit locations human-readable (to me)
  • Sample the Atari console switches and the joystick/button positions at the beginning of the main loop each time
  • Develop the necessary routines to read data statements and draw playfields
    • Convert the description of the playfield of the first hole of golf into data statements
    • Then create temporary playfields for holes 2-9 also using data statements
  • Decide upon the control scheme to be used for the joystick and button.
    • Will there be special button presses (double taps and/or long presses)? 
      Spoiler

      image.jpeg.26566f4df67f244c38b0cd484bbb9d96.jpeg

      The double-press (or double tap) is used in Desert Falcon. 

      If so, write the routines.
    • Will there be special menus?  If so, write the routines.  
      • If there will be menus, store the descriptions in data statements that can be read like the playfields.  
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...