Jump to content
IGNORED

Writing More of My First Lines of Code in Batari Basic - Night Driver Arcade


Recommended Posts

Paddle + 6 Stationary White Road Markers - Demo

 

Spoiler

image.thumb.jpeg.5084418d8ac8870f368f535c0b114081.jpeg

Note: Phosphor effect was turned on to take this screenshot. Turn off phosphor when you run the demo.

 

Improvements

  • The playfield pixels are gone.  The white road markers are now made with sprites using flicker.  
  • The paddle moves the road, not the car.  

0003_demo.bas

0003_demo.bas.bin

  • Like 1
Link to comment
Share on other sites

The 3D Effects

 

Spoiler

The 3D effect in the game generally has three parts.

 

As the pairs of white road markers "fall," they...

  • become larger
  • spread farther apart
  • speed up

 

We will want to look closely at some video and screenshots from the arcade version to try to estimate the ratios for each of the three 3D effects.  

 

3D Effect #1: WRM's become larger as they come "closer."  

Spoiler

This 3D effect is discussed here.  

 

3D Effect #3: WRM's move faster as they come "closer."

Spoiler

To begin, consider Night Driver with all 3D effects removed.  

 

To summarize:

  • The road would look like 2 parallel lines.
  • All WRM's would be the same size and be moving at the same speed.  

 

Now, let us add back the 3D effect that WRM's will move faster as they come "closer."  

 

Spoiler
  • First, let us go back to the arcade version of Night Driver.  Suppose we have some video of the gameplay and we take a screen capture and we open that image in a paint program.  
  • Next, in the image, we identify the 7 pairs of WRM's.  
  • Notice that the pairs of WRM's are closer together toward the top of the screen and farther apart toward the bottom.
  • Next, we count the paint pixels between the horizon and the first pair of WRM's; and between each pair of WRM's; and between the 7th pair of WRM's and the bottom of the screen.  Totally, a list of 8 numbers.  
  • Let's call these numbers D0 through D8.  Notice that D0 is the smallest and D8 is the biggest.  
  • Next take this list of 8 numbers and enter them into a spreadsheet program and let it find a curve that matches the data.  For simplicity, we will probably approximate this curve as four or five linear regions.  
  • RESULT #1: That is, we end up with an equation in which we can input a value of y and get back a value in the range of D0-D8.  Let's call this value y-3D.  
  • The key IMO is to realize that the elapsed time for each pair of WRM's is going to be the same regardless of how close together or far apart they appear to be.  Because that's just the 3D effect.  On a "real" road, all of the pairs of WRM's are going to be spaced equally far apart, I'm sure.  They only appear to be spaced closer or farther because of the 3D effect.  It's kind of an illusion that the distances are different.  An illusion of perspective.  The distances are actually the same.  And that's why - and IMO this is the key - the time elapsed for each pair of WRM's is going to be the same.  

So now, let us go back to our Atari 2600 version of Night Driver.

  • And the 3D effect for increasing speed as WRM's move "closer" is enabled.    
  • So how do we do that?  We do it like this.
  • In our previous work, we found that SPEED OF CAR times C-target equals K-DIST, where K-DIST is a constant and SPEED OF CAR and C-target are variables.  
  • Thus, if we know K-DIST, then for any given value of SPEED OF CAR, we can solve for C-target. 
  • RESULT #2: C-target = K-DIST / SPEED OF CAR
  • C-target is 1/7 of the number of drawing cycles (1 drawing cycle = 3.5 frames) it would take for a pair of WRM's to fall from the horizon to the bottom of the screen if 3D effects were turned off.  
  • Now let us combine Result #1 and Result #2, above to get the 3D effect.
    • For any pair of WRM's, plug the y value into the formula of RESULT #1 to find y-3D.  
    • Next, divide y-3D by C-target (RESULT #2) and store it in a type 8.8 Fixed Point Variable.  This is the number of pixels (integer + fractional amount) that the WRM's should be moved down on the next drawscreen call.  Call this number y-down-3D.  (NOTE: I think we can use throw-away variables such as TEMP6 and TEMP7.  No need to keep this 8.8 value stored in RAM.)  
    • Add y-down-3D to the y-value of the WRM stored in RAM and you will have the new y value of the WRM for the next drawscreen call.  
    • Repeat every cycle until the WRM falls off the bottom of the screen.  

 

 

Link to comment
Share on other sites

Sprite "Gear Box" Calculations

 

Spoiler

Note: In RT's bB Guide, this topic is called Fixed Point Variables.  

 

How can we precisely and smoothly control the speeds of sprites through a range of values that are below unity (one pixel per frame) at unity and above unity?  The Gear Box calculations can do just that.  

 

Introducing Sprite "Gear Box" Calculations

 

TYPE 1 - "Small Gears": speeds less than one pixel per frame but greater than zero

Ex.  The speed of a sprite is 0.25 pixels per frame.  That means the sprite moves one pixel every four frames.  Like this: Wait.  Wait.  Wait.  Move one pixel.  Repeat.  

 

TYPE 2 - "Big Gears": speeds equal to or greater than one pixel per frame

Ex.  The speed of a sprite is 2 pixels per frame.  That means move like this: Move 2 pixels.  Move 2 pixels.  Move 2 pixels.  etc.

 

General procedure for Gear Box computations

  • Start with a variable equal to zero.  Each frame, add the speed rate to it.  When it is equal to or greater than 1, move the sprite the integer number of pixels and store any leftover "residue" in the variable for next time.  Repeat.  

TYPE 1 "Small Gears" - Calculation Example

 

Ex.  The speed of a sprite is 0.135 pixels per frame.  

  • Frame 1: 0+0.135=0.135.  Not greater than or equal to 1.  Wait.
  • Frame 2: 0.135+0.135=0.270.  Not greater than or equal to 1.  Wait again.
  • Frame 3: 0.270 + 0.135=0.405.  Still not greater than or equal to 1.  Wait again.
  • Frame 4.  0.405+0.135=0.540.  Wait again.
  • Frame 5.  0.540+0.135=0.675.  Wait again.
  • Frame 6.  0.675+0.135=0.810.  Wait again.
  • Frame 7.  0.810+0.135=0.945.  Wait one last time.
  • Frame 8.  0.945+0.135=1.080.  Move the sprite one pixel.  Pass the residue 0.080 on to the next frame.
  • Frame 9.  0.080+0.135=0.215.  Wait.
  • etc.

In other words, at the very slow speed of 0.135 pixels per frame, the sprite would remain motionless for 7 frames in a row.  Then, on the 8th frame, the sprite would move 1 pixel.  There would be a tiny residual of 0.08 leftover which would carry over to frame 9.  If continued for many frames, the average speed of the sprite would get very close to 0.135 pixels per frame.  

 

TYPE 2 "Big Gears" - Calculation Example

 

Ex. The sprite speed is 1.35 pixels per frame.

  • Frame 1: 0.00+1.35=1.35.  Move the sprite 1 pixel.  Store the residual 0.35 in a variable.
  • Frame 2: 0.35+1.35=1.70.  Move the sprite 1 pixel.  Store the residual 0.70 in a variable.
  • Frame 3: 0.70+1.35=2.05.  Move the sprite 2 pixels.  Store the residual 0.05 in a variable.
  • Frame 4: 0.05+1.35=1.40.  Move the sprite 1 pixel.  Store the residual 0.40 in a variable.
  • Frame 5: 0.40+1.35=1.75.  Move the sprite 1 pixel.  Store the residual 0.75 in a variable.
  • Frame 6: 0.75+1.35=2.10.  Move the sprite 2 pixels.  Store the residual 0.10 in a variable.  

The sprite sometimes moves 1 pixel and sometimes moves 2 pixels according to the residue left over from previous frames.  If continued for many frames, the average speed of the sprite would get very close to 1.35 pixels per frame.  

 

Thus, the Gear Box calculations are able to precisely and smoothly control the speeds of sprites through a range of values that are below unity (one pixel per frame), at unity and above unity.  

Link to comment
Share on other sites

More Flicker Tests 

 

10 White Road Markers + P0 Car + Paddle - Test

 

Spoiler

image.thumb.jpeg.54579f0ec8d3783bd9c49b9c3c6809a5.jpeg

Note: Phosphor effect was turned on to take this screenshot. Turn off phosphor when you run the demo.

 

10 white road markers drawn in a rotation using 3.5 sprites

- the ball, missile1 and P1 every frame

- P0 every other frame

The P0 sprite is drawing the car 50% of the time and draws wrm's the other 50% of the time.  

0003_10_wrm_car_demo.bas

0003_10_wrm_car_demo.bas.bin

The wrm's don't look bad IMO.  The car flickers too much IMO.  

 

10 White Road Markers + White PF Car + Paddle - Test

 

Spoiler

image.thumb.jpeg.68f238491b428014d52e35ef36ebb63f.jpeg

Note: Phosphor effect was turned on to take this screenshot. Turn off phosphor when you run the demo.

 

10 white road markers drawn in a rotation using 4 sprites

- the ball, missile1, P0 and P1 every frame

- The playfield pixels are used to draw the hood of the car.  

The PF had to be white because the ball takes on the same color as the PF.  

0003_10_wrm_pfcar_demo.bas

0003_10_wrm_pfcar_demo.bas.bin

 

 

@glurk  You might be interested in the second test.  I made the car out of PF pixels.  

  • Like 1
Link to comment
Share on other sites

No Car and More White Road Markers?  

 

Spoiler

In the following video, the orange car overlay is barely visible at the bottom of the screen, except during crashes.  

Watch the video from about 3:45 to 4:00

 

And I think the game looks fine.  It makes me think about some new ideas.

 

Idea #1 No Car

  • Use all four sprites (ball, missile1, P1 and P0) to draw white road markers.  With four sprites, I think we could have 12 wrm's.

Idea #2 Player's Car Appears Only When Stopped or at Slow Speeds

  • Imagine the game begins and the car is stopped and we see the car.  There are 8 wrm's.
  • The player hits the gas and the car accelerates.  
  • When the car reaches a threshold speed, the car disappears and the number of wrm's is increased to 12.  (Why?  Because the P0 sprite was initially used to draw the car.  Then after the car disappeared, P0 can be used to draw more wrm's.)  
  • How Would the Car Disappear?
    • Idea #1: Simply move the car's y coordinates down until it is off the screen and not visible.  
    • Idea #2: Use flicker, let the car flicker more and more until it disappears.
    • Idea #3: Use color changes, go from orange to black until the car disappears. 
    • or some combination of the above 
  • If the car crashes, it comes to a complete stop and the car reappears and the number of wrm's is reduced to 8 again. 
  • This idea is meant to be a best-of-both-worlds kind of solution.  I think people want to see the car.  So they could see the car initially.  But when we get into 4th gear and get down to racing, it would be more advantageous to have 12 wrm's instead of just 8 or 10.  The longer road can "snake around" more and show more detail and improve the 3D effect and generally, I think, improve the racing aspect of the game.  

4 Gears

Also, in the video, if you look at the reflection of the player in the glass, you can see the player's hands.  Look and listen closely, after a collision, he takes his right hand off the wheel and shifts the car up through gears 1-4.  Once in 4th gear, he puts his right hand back on the wheel again and keeps it there.  

 

This video makes me imagine using @ComputerSpaceFan's suggestion and using joystick #2 as the gear shifter.  That is, steer using the paddle and shift with joystick #2.

 

I'm just thinking about several ideas.  Haven't decided on anything yet.  

 

CX30+ Paddles Rock!

 

Spoiler

Yesterday, I got my CX30+ paddles and I immediately began playing Night Driver with them.  Wow!

 

image.jpeg.42294c4065ef236ea172a131669c2fe4.jpeg Night Driver is awesome with Atari paddles!  

This is the first time in 40+ years that I played Atari 2600 Night Driver with real Atari paddles.  

It's just an amazing game and I had forgotten how good this game is when you play it with Atari paddles! 

The steering is super smooth!  

 

So, now that I have my CX30+ paddles, image.jpeg.d97b7603b39e292635cadfe5ba31a77d.jpeg from now on, I will be using them instead of my Hyperkin Ranger   image.jpeg.df62a4559194790885adabeff482b479.jpeg for game testing as this project develops.  (The Ranger controllers are well made IMO, but the paddle knob is only about half the diameter of the Atari paddle knob.)  

Link to comment
Share on other sites

CTRLPF and BALLHEIGHT - DEMO

 

Spoiler

 

image.thumb.jpeg.81ab5cc255d2dc003deef01ccfa814c9.jpeg

Note: Phosphor effect was turned on to take this screenshot. Turn off phosphor when you run the demo.

 

What does this demonstration show?

 

That using CTRLPF and BALLHEIGHT, we can use the ball sprite to make white road markers that are 8 pixels wide by 20 pixels high, the largest size that I imagine that we would need in this game.  

0003_10_wrm_car_big_balls_demo.bas

0003_10_wrm_car_big_balls_demo.bas.bin

 

NUSIZ1 and MISSILE1HEIGHT - DEMO

 

Spoiler

image.thumb.jpeg.6562e79d8467fb389aa1f1f6fbab9c2a.jpeg

Note: Phosphor effect was turned on to take this screenshot. Turn off phosphor when you run the demo.

 

What does this demonstration show?

 

That using NUSIZ1 and MISSILE1HEIGHT, we can use the missile1 sprite to make white road markers that are 8 pixels wide by 20 pixels high, the largest size that I imagine that we would need in this game.  

0003_10_wrm_car_big_missiles_demo.bas

0003_10_wrm_car_big_missiles_demo.bas.bin

  • Like 1
Link to comment
Share on other sites

White Road Markers - 3D Effect - Small to Big Transitions

 

Spoiler

White Road Marker - Subroutine

 

Situation: WRM's will vary from 1 pixel wide at the horizon to 8 pixels wide at the bottom of the screen.

 

Problem: The ball and M1 can only make sprites with widths of 1, 2, 4 and 8 pixels using CTRLPF and NUSIZ1, respectively.  P0 and P1, however, can make sprites of any width from 1-8 pixels wide.

 

NEWEST VERSIONS ON TOP

 

VERSION D

 

Spoiler

There are 14 WRM's on the screen.  Let us number them from 1-14 starting from the top and working our way down.  1 is top left, 2 is top right, 3 is 2nd pair left, 4 is 2nd pair right, etc.  Let Group A be those WRM's with a width in pixels of 1, 2, 4 or 8.  Let Group B be those WRM's with a width in pixels of 3, 5, 6 or 7.  Let there be 14 bits for Group A.  Let's call it the Group A register.  And another 14 bits for Group B.  Let's call it the Group B register.  A 0 means that the WRM is not in that group.  A 1 means that it is in the group.

 

Start from the top of the screen and working down, do some calculations and, taking into account the position of the paddle controller, determine which of the 14 WRM's will be on the screen.  For those that are on the screen, determine next which WRM's will be in Group A and set their bits to 1 in the Group A register.  Also, find out which WRM's will be in group B and set their bits to 1 in the Group B register.  

 

Next, add up how many WRM's are in Group A and how many are in Group B.  Compare.  Are the two groups equal enough?  (Within one is okay.  7 and 7 is okay.  7 and 6 is okay.)  If not, jump to the subroutine to equalize the sizes of the two groups numerically.  Once done, exit routine and return to main.

 

Next, begin drawing by assigning sprites to WRM's.  The ball and missile draw the WRM's in Group A and the P0 and P1 sprites draw the WRM's in Group B.  Each frame, the ball and missile are assigned the next 2 WRM's from list A and the P0 and P1 sprites are assigned the next 2 WRM's from list B.  

 

Exception Handling: If any WRM's were moved to equalize the lists, then sooner or later, an exception will occur.  If WRM's were moved from Group A to Group B, then while drawing Group B, a 1, 2, 4 or 8 would be discovered.  Or if WRM's were moved from Group B to Group A, then while drawing Group A, a 3, 5, 6 or 7 would be discovered.  Then call the handling routine.  That routine will adjust the pixel width to an appropriate number by following the well known rules: moving a WRM from Group A to Group B, a 2 can become a 3, a 4 can become a 3 or a 5 and an 8 can become a 7; 1's should not be moved.  Going the other way from Group B back to Group A, a 3 can become a 2 or a 4, a 5 can become a 4 and a 7 can become an 8; 6's should not be moved.  Then the WRM will be assigned to a sprite to be drawn.  

 

As the WRM's are assigned to sprites, their respective bits in their respective registers are cleared to 0.  After 3.5 frames, then all 14 WRM's will have been assigned to sprites ("drawn") and all of their bits in the A and B registers will have been cleared.  

 

If the process finishes with one or more sprites unused, then compute two new lists A and B and continue assigning sprites until all four sprites are used.  All four sprites should be used every frame.

 

BITS AND BYTES

Group A register: 14 bits

Group A counter: 1 nybble

Group B register: 14 bits

Group B counter: 1 nybble

TOTAL 28 bits and 2 nybbles = 3 bytes and 4 bits and 2 nybbles = 4 bytes and 4 bits

 

A WORK-AROUND

  • Use Method C at slow speeds.  When the car is going slowly, we want to see the beautiful, smooth animations.  
  • Use Method B at high speeds.  When the car is going fast, we need a fast a routine to handle it and if the animation is a little flawed, maybe no one can tell at such high speeds, anyway.  

VERSION C : USES PRE-PROCESSING AND A SMALL AMOUNT OF RAM

Spoiler

OVERVIEW:

This method attempts to improve upon Method B while using only a tiny amount of RAM so that the game could be done using the standard 4k kernel.  This method works like Method A, creating two lists A and B, but instead of moving them to new locations in RAM, they are marked where they are by a single bit.  

 

RAM

  • For each of the 7 pairs of WRM's, we add one bit of RAM.  Let's call this bit GROUP_AB.  
  • Totally, 7 bits of additional RAM are needed

 

PRE-PROCESSING

  • Drawing refers to assigning a WRM to a specific sprite.  The 4 sprites available are the ball, missile 1, P0 and P1.
  • Before drawing, pre-processing will be done to improve the smoothness of the 3D effect.
  • Here is the pre-processing routine:
    • For each pair of WRM's, the y-value is plugged into a simple formula to calculate the value of X-WIDTH (1-8) in pixels.  That is, the width in pixels of the WRM at that y-value on the screen.  (The lower on the screen, the larger they become.)
    • If X-WIDTH is 1, 2, 4 or 8, then the GROUP_AB bit will be reset to 0, signifying that the pair of WRM's are placed in Group A and will be drawn by the ball or missile 1.  
    • If X-WIDTH is 3, 5, 6 or 7, then the GROUP_AB bit will be set to 1, signifying that the pair of WRM's are placed in Group B and will be drawn by the P0 or P1 sprite.  
    • After the GROUP_AB bits for all 7 pairs of WRM's have been assigned either a 0 or a 1, then the 7 GROUP_AB bits will be summed up.  Let's call this sum AB_SUM (0-7).  
      • If AB_SUM is 0, then move 3 pairs of WRM's from Group A to Group B.
      • If AB_SUM is 1, then move 2 pairs of WRM's from Group A to Group B.
      • If AB_SUM is 2, then move 1 pair of WRM's from Group A to Group B.
      • If AB_SUM is 3, then we don't need to move anything.  
      • If AB_SUM is 4, then we don't need to move anything.  
      • If AB_SUM is 5, then move 1 pairs of WRM's from Group B to Group A.
      • If AB_SUM is 6, then move 2 pairs of WRM's from Group B to Group A.
      • If AB_SUM is 7, then move 3 pairs of WRM's from Group B to Group A.
    • Pairs of WRM's are moved from Group A (1, 2, 4, 8) to Group B (3, 5, 6, 7) as follows: a 2 can be changed to a 3; a 4 can be changed to a 3 or a 5; an 8 can be changed to a 7.  1's cannot be changed.  
    • Pairs of WRM's are moved from Group B (3, 5, 6, 7) to Group A (1, 2, 4, 8 ) as follows: a 3 can be changed to a 2 or a 4; a 5 can be changed to a 4; a 7 can be changed to an 8.  6's cannot be changed.  
    • WRM's are changed from one group to the other by flipping their GROUP_AB bits.  
    • Once AB_SUM has a value of 3 or 4, pre-processing is finished.
  • Now draw the sprites.  All WRM's in Group A (1, 2, 4, 8 ) will be drawn by the ball and missile 1 only.  All of the WRM's in Group B (3, 5, 6, 7) will be drawn by the P0 and P1 sprites only.  
  • Each frame, the next two WRM's from Group A will be assigned to the ball and missile 1 and the next two WRM's from Group B will be assigned to P0 and P1.  
  • There is an issue with there being an odd number of pairs of WRM's.  I'll have to find a work-around for that.  

 

ADVANTAGES

  • Values of X-WIDTH from 1 to 8 will be drawn much more consistently resulting in a much smoother animation.  In particular, we expect that most of the 3's should be drawn correctly.  
  • It only uses 7 extra bits of RAM, a small enough amount that we can probably still use the standard 4k kernel.  

 

DISADVANTAGES

  • Pre-processing uses more processor cycles and could slow the game down.   
  • Inefficiency.  X-WIDTH will need to be calculated twice: once to set the GROUP_AB bits and a second time to draw the WRM's.  

 

VERSION B: ON THE FLY AND NO RAM NEEDED

Spoiler

OVERVIEW:

- This is my attempt to perform the task of this 3D effect (WRM's are smaller far away, become bigger as they get closer) without using any RAM so as to stay in the 4k standard kernel.  

 

Recall that the ball and missile 1 can draw perfectly WRM's with widths of 1, 2, 4 or 8 pixels.  

P0 and P1 sprites can perfectly draw WRM's of any width from 1-8 pixels.

Therefore, WRM's of widths 3, 5, 6 or 7 are best drawn by P0 or P1.

Especially WRM's of width 6.  That's the worst case, and should always be drawn by P0 or P1.

 

Which pairs of WRM's on the screen could have a width of 6?  

 

Pair    Likelihood of having 6's

1  never

2  never

3  never 

4  highly unlikely

5  sometimes

6  highly likely

7  highly likely 

 

Therefore, we change the order for drawing.

 

New drawing order:

6  highly likely

1  never

7  highly likely 

2  never

5  sometimes

3  never 

4  highly unlikely

 

Recall that we draw these 14 objects 4 at a time using the ball, missile 1, P0 sprite and P1 sprite.

 

1st Four: We expect probably two 6's here

6  highly likely

1  never

 

2nd Four: We also expect probably two 6's here

7  highly likely 

2  never

 

3rd Four: Sometimes, two 6's here.  

5  sometimes

3  never 

 

Plus the Last Two: We don't expect to see 6's here.  

4  highly unlikely

 

PROCEDURE: Use P0 and P1 to draw the WRM's in the first pair of each group, above.  Those are the only groups that we expect might contain 6's.  Use the ball and missile 1 to draw the second pair of WRM's in each group.  We don't expect to see any 6's in those.  Some small adjustments might sometimes be necessary, changing 3's to 2's or 4's, changing 5's to 4's and changing 7's to 8's.  

 

ADVANTAGES OF THIS METHOD:

- Speed.  Can be done on the fly.  

- Doesn't require any RAM.  The drawing sequence 6-1-7-2-5-3-4 would never change and could therefore be "hard-wired" into the drawing subroutine of the program, I think.  

 

DISADVANTAGES:

- Near the horizon, you will probably never see a 3.  All WRM's near the horizon will be assigned to the ball and missile 1 and all 3's near the horizon will be changed to 2's or 4's so either the ball or missile can draw them.  

- 8's near the bottom of the screen would almost always be assigned to P0 or P1; they should have been assigned to the ball or missile instead.  

- If the player turns the paddle hard so that some of the 14 WRM's move off screen either to the right or left, in the above implementation, the unused sprite is wasted and flicker is not reduced.  

- MORE WARBLE: Compared to the other method that uses more RAM, this method would not do as good of a job of assigning sprites to avoid warble.  

 

CONCLUSION:

- If I were determined to finish this game in 4k using the standard kernel, we could try using this method, but the other method that uses more RAM would certainly produce a 3D effect that is much smoother and nicer looking.  

 

VERSION A: REQUIRES PRE-PROCESSING AND USES RAM

Spoiler

Solution: 

 

Suppose that there will be 10 WRM's. 

  1. Do calculations.  Make the list of the 10 WRM's to be drawn.  
  2. Sort the WRM's into two groups according to their widths in pixels.   
    • Put the WRM's with a width of 1, 2, 4 and 8 into one group.  Call this Group A.  These WRM's will be drawn by the ball and m1.  
    • Put the other WRM's with a width of 3, 5, 6 and 7 into another group.  Call this Group B.  These WRM's will be drawn by P0 and P1.  
  3. Compare Group A and Group B.
    • If they both have 5 items, skip ahead to step 4.
    • If Group A has more items than Group B, do this:
      • Move items from Group A to Group B until the two groups are equal.
      • The permitted movements are:
        • A 2 in Group A can become a 3 in Group B.
        • A 4 in Group A can become a 3 or a 5 in Group B.
        • An 8 in Group A can become a 7 in Group B.  
    • If Group B has more items than Group A, do this:
      • Move items from Group B to Group A until the two groups are equal.
      • The permitted movements are:
        • A 3 in Group B can become a 2 or a 4 in Group A.
        • A 5 in Group B can become a 4 in Group A.
        • A 7 in Group B can become an 8 in Group A.  
  4. Draw the WRM's
    • The ball and m1 will draw the WRM's in Group A with widths of 1, 2, 4 and 8 pixels.
    • The P0 and P1 sprites will draw the WRM's in Group B with widths of 3, 5, 6 and 7 pixels.  

The Result

  • WRM's at the horizon will have a width of one pixel.  WRM's at the bottom of the screen will have a width of 8 pixels.
  • As the WRM's "fall" from the horizon down to the bottom of the screen, their widths will transition smoothly (more or less) from 1 to 8 pixels wide.  
  • This system will not be perfect.  Sometimes, a WRM will unexpectedly decrease one pixel in width and then increase one pixel in width or vice versa.  Note though that the heighths of each WRM will transition flawlessly.  

 

 

Link to comment
Share on other sites

Paddle Controls

 

Spoiler

image.jpeg.eebf0315b3823dc9efa19bf2ba60e8bb.jpeg

PADDLE: turn your can left or right

HOLD BUTTON: gas pedal

SPECIAL ("RELEASE AND SQUEEZE"): shift up

 

Like the arcade version, there will be four gears.  

From a full stop such as at the start of the game or after a collision, the car will begin in first gear automatically.

Hold down the button to accelerate.

To shift up, your car must be at the top speed of the current gear.  Then, release the red button and quickly squeeze it again ("Release and squeeze").  Then, your car will shift up to the next higher gear.  

Repeat until the car is in 4th gear and attains top speed.  

 

BRAKING/SHIFTING DOWN

  • There is no brake and you can't shift down.
  • To brake and/or shift down, release the button and the car will begin to slow down.  
  • As the car slows down, it will downshift automatically.  The gear changes will be displayed as the car downshifts.  
  • It may take several seconds for the car to slow down all the way to a full stop.  

ACCELERATING/SHIFTING UP

  • The car will only shift up when you double tap "release and squeeze" at the proper time, which is when the car has maxed out the speed of the current gear.  
  • The car can never be in the "wrong" gear.  If you double tap "release and squeeze"/try to shift too early, the gear will not change.  
  • It will take several seconds for the car to shift through all four gears and attain top speed.  

GEAR DISPLAY

  • After any double tap, the gear 1-4 will be displayed momentarily in the six-digit display.
  • If the gear shifted up, the new, higher gear number will be displayed.
  • If the double tap was too soon and the car did not shift up, then the gear number will still be displayed, but it will be the same gear number as before.  
Link to comment
Share on other sites

Paddle Steering - Concept

 

Spoiler

Turning the paddle left will shift the white road markers to the right.  This gives you the feeling that your car has turned left.

 

Turning the paddle right will shift the white road markers to the left.  This gives you the feeling that your car has turned right.

Link to comment
Share on other sites

Night Driver (Atari, 1976) - Arcade Manual

 

Spoiler

image.jpeg.e5af7a6851257c17414648cfd0881440.jpeg

Night Driver - manual PDF  

 

One player

 

CONTROLS

Steering wheel wheel_135x150.jpg.4175b6eb75aaba2c479df4a6ae477b06.jpg

4-speed gear shifter Shifter_97x100.jpg.07fe794bb95ac80d7e1de98b0d040670.jpg  image.jpeg.100aa5b76cf061d8c28eb344689b8e79.jpeg

 

Accelerator foot pedal image.jpeg.3c4efc3ce394fe6b26decff6420915e9.jpeg   image.jpeg.cb6111b203910224868afd0891f6ebe7.jpeg  

 

NOTE: There is no brake.  

 

GAMEPLAY

 

START GAME

- Choose track (NOVICE, PRO or EXPERT) image.jpeg.a00ab1f14a5bce28af59a99e412e1cc9.jpeg   image.jpeg.7821adaf4f2740e1945bca6c298d5247.jpeg  3-way rocker switch

- Press START. image.jpeg.49727685bb9d6fafb6bdfe4a08c69dce.jpeg   

The timer counts down from 100. 

NOTE: It's not necessarily 100 seconds.  See GAME TIME, below.  

The sound of an idling motor is heard.  

 

START DRIVING 

- Start in 1st gear.  Press the accelerator.  

NOTE: If you start in any gear other than 1st gear, the car will accelerate more slowly.

 

Once the car starts moving, shifting into progressively higher gears increases the speed of the car.

If the car goes into a turn too rapidly, there will be the sound of the car skidding.

If the car drives into a track boundary, a crash sound will be heard and the screen will flash.  

 

TV MONITOR

The monitor only produces black and white, unlike home televisions which can produce shades of gray.

 

GAME MODES

 

ATTRACT MODE

image.jpeg.e4260fb66e7ff4459548799087421c1b.jpeg

- The game will start in ATTRACT mode until coins are inserted, track selected and START is pressed.

Then counter will count down in one digit increments.  When timer reaches zero, the game will again return to the ATTRACT mode.

- During ATTRACT mode, the game will display the high score and top speed since the machine was last powered on.  The words "GAME OVER" will flash on the screen.  The pylons will move as if the car is moving along the road.

 

PLAY MODE

image.jpeg.bbce21cebaca8705cf22b8ca6b702a0b.jpeg

- The roadway advances when the accelerator pedal is pressed.

- Shifting the gear shifter up through the gears increases the speed of the roadway pylons.  

- If the car comes into contact with one of the pylons, the roadway pylons will stop advancing, the monitor screen will flash and a crash sound is heard.  

- If the car drives off the roadway, the following message appears on the screen: 

OFF THE ROAD

WAIT FOR TOW TRUCK

After about 3 seconds, the message will disappear and the roadway pylons will reset so that the car is once again between the roadway pylons.  

 

GAME OPTIONS

- GAME TIME The time of game play can be set to either 50, 75, 100 or 125 seconds.  

- NO BONUS TIME

- BONUS TIME equal to GAME TIME awarded for score of 350

- HARD TO GET BONUS TIME for a score of 350 "more difficult to achieve"

- REVERSE TURNS of all 3 tracks

 

5.3.5 GAME PLAY OPERATION TEST

- The motor sound increases while shifting through the gears with the accelerator foot pedal depressed

 

TABLE 8-1 NIGHT DRIVE SIGNAL DESCRIPTIONS

image.thumb.png.b0722328ec3b9dbcacd6b5f05bb30fb4.png

image.jpeg.927ba7351bc2ac1ea9f92f1beebff19c.jpeg  image.jpeg.cb6111b203910224868afd0891f6ebe7.jpeg

NOTE: We see that the accelerator pedal is an on/off switch.  

 

SOUNDS

- BANG/CRASH - When car hits a pylon

- MOTOR - frequency increases with the car's speed

- SCREECH1/SKID1 

- SCREECH2/SKID2

image.thumb.png.467d8825269c4393d3148211eb563e07.png

NOTE: We see that the motor sound is a function of the car's speed.  

image.thumb.png.15eaacad6fd5051d222316ce0476fe6a.png

NOTE: SCREECH1 is 1 kHz and SCREECH2 is 833 Hz.  Both are modulated by digital noise.  

image.jpeg.7b346ad3a0fb63d4c5402d2846416f6b.jpeg

NOTE: We learn that the roadway consists of fourteen roadway pylons.  

  • Like 1
Link to comment
Share on other sites

Big P0 WRM - DEMO

 

Spoiler

image.thumb.jpeg.6902dcd97fc83a5b45a32c65f3cf62f6.jpeg

Note: Phosphor effect was turned on to take this screenshot.  Turn off phosphor when you run the demo.

 

What does this demonstration show?

 

That by using PLAYER0, we can use the P0 sprite to make a white road marker that is 8 pixels wide by 20 pixels high, the largest size that I imagine that we would need in this game. 

 

NOTE: The reason that the P0 sprite only makes one wrm is because in this case it's also being used to draw the orange car.  

 

0003_10_wrm_car_big_P0_WRM's_demo.bas

0003_10_wrm_car_big_P0_WRM's_demo.bas.bin

 

Big P1 WRM's - DEMO

 

Spoiler

image.thumb.jpeg.9582a3792d0a1e6d75f4c86556f55298.jpeg

Note: Phosphor effect was turned on to take this screenshot.  Turn off phosphor when you run the demo.

 

What does this demonstration show?

 

That by using PLAYER1, we can use the P1 sprite to make white road markers that are 8 pixels wide by 20 pixels high, the largest size that I imagine that we would need in this game.  

0003_10_wrm_car_big_P1_WRM's_demo.bas

0003_10_wrm_car_big_P1_WRM's_demo.bas.bin

  • Like 1
Link to comment
Share on other sites

Video Review

 

Spoiler

After a crash, you can shift into first gear and begin accelerating while the screen is still flashing.  

 

Spoiler

The crash occurs at 11:05.  The player immediately shifts and begins accelerating even while the screen is still flashing.  

 

Your score is 3 digits.  After 999 it rolls over back to 000.  

 

Spoiler

The score rolls over from 999 to 000 at 12:27.  


Is it possible to get BONUS TIME twice in one game?  

 

Spoiler

The game starts at 8:44.  At 12:56, the game ends with a rolled over score of 152.  

 

Question: Why did the game end? 

 

This player scored, totally, 1151 points (999 + 152 after it rolled over).  You only need 350 points to get BONUS TIME.  He had enough points to get bonus time three times!  So why did his game end after the first bonus time?  I guess in Night Driver, you can only get bonus time once no matter how high you score.  

 

Gears and Speeds

 

Spoiler

A new game starts at 6:32

Gear  Speed

1         0-30

2        30-60

3        60-90

4        90 - ???

 

Top Speed

 

Spoiler

EXPERT TRACK - 344

image.thumb.jpeg.615a9e083dc1130b6440e21d674bd5ac.jpeg

At 21:30 (the end of the video), the Top Speed is 343.  I believe this was on the EXPERT track.  

 

PRO TRACK - 300

At 5:30 in the video, he crashes.  His top speed was 300.  At 5:38, he is heard saying, "Oh, that's why!" and he reaches with his right hand and turns the rotary knob track setting.  I think he wondered, "Why was my top speed so slow?  Only 300?  Oh, that's because it's on the PRO setting, not EXPERT."  And so he changed it to EXPERT.  Then on his next run, he achieved a top speed of 344 at 7:46 in the video.  

Link to comment
Share on other sites

12 WRM's and No Car - DEMO

 

Spoiler

The arcade version has 14 white road markers.  Let's see how ours looks with 12 WRM's and no car.  

image.thumb.jpeg.be432a97769e56fbe9b089389bbd890c.jpeg

Note: Phosphor effect was turned on to take this screenshot.  Turn off phosphor when you run the demo.  

0003_12_wrm_no_car_demo.bas

0003_12_wrm_no_car_demo.bas.bin

 

14 WRM's and No Car - DEMO

 

Spoiler

The arcade version has 14 white road markers.  Let's see how ours looks with 14 WRM's and no car.  

image.thumb.jpeg.c8c6d5aa11ecab9121979238e0a4de65.jpeg

Note: Phosphor effect was turned on to take this screenshot.  Turn off phosphor when you run the demo.  

0003_14_wrm_no_car_demo.bas

0003_14_wrm_no_car_demo.bas.bin

  • Like 1
Link to comment
Share on other sites

SPLIT 3+3 DIGIT SCORE - DEMO 

 

Spoiler

image.thumb.jpeg.63cbe53a9c211fe6cb3f8e3f0c31650a.jpeg
image.thumb.jpeg.272089b16a359e313c7a7461369ac3f0.jpeg

Note: Phosphor effect was turned on to take these screenshots.  Turn off phosphor when you run the demo.

  

What does this demonstration show?

 

The SCORE (bottom-left) counts upward.  

The TIMER (bottom-right) counts down the GAME TIME remaining. 

0003_14_wrm_no_car_33score_demo.bas

0003_14_wrm_no_car_33score_demo.bas.bin  

 

Special thanks to @batari for sharing his 3+3 Score Mini-Kernel!  

  • Like 1
Link to comment
Share on other sites

BITS AND BYTES

 

Spoiler

NOTE: The plan currently doesn't include sound.  We will add sounds later.  

 

THE MAIN GAME PROCESS 

  • There are 7 pairs of white road markers (WRM's) on the screen and an 8th pair off the bottom of the screen that you don't see but that are still tracked in memory.
  • For each pair of WRM's (including the 8th pair off screen), the (x,y) coordinates of the midpoint of the road and the y-residuals used for gear box calculations will be stored in RAM.  
  • The 3D effects can be calculated by plugging y values into some simple formulas.  So, quantities related to the 3D effects won't need to be stored in RAM.  Those are: increasing width of road and increasing the size of WRM's as the road comes "closer."   
  • An index (1-14) (the "WRM Index") will be used to specify the 14 individual WRM's in the first 7 pairs.  An index of 15 will specify the 8th pair which is off screen.  Let's call one rotation of the index through all of the 16 WRM's a cycle.  
  • An index (1-4) (the "Sprite Index") will be used to specify which of the four sprites will be used to draw the WRM's.  
  • A special counter (estimated 0-1,024) called "The Mad Bomber's Timer."  It is a special odometer, highly accurate for short distances.  It is not meant to measure the total distance traveled by the car over the entire course of the game.  Instead, it is meant to measure with high precision the short distances from one set of WRM's to the next.  I think it will be an accumulator that repeatedly adds the SPEED OF CAR.  NOTE: I haven't worked out the details yet.  
  • A counter (estimated 1-4) (the "WRM Drop Counter") will be used to increment the Long Distance Odometer (AKA 3-digit SCORE) approximately once every four times the Mad Bomber "drops" a new pair of WRM's.  Note: the exact ratio is TBD.  
  • The Mad Bomber's movement would go according to game states.  At random, a new game state would be selected from a list of possible options.  Options would include things like "left turn" and "right turn" and "stay in place" and "S-Curves," etc.  The The Mad Bomber's game state byte would be set accordingly.  A target x-coordinate would be selected at random.  Perhaps a speed of "fast" or "slow" would be selected at random also.  Each drawing cycle, the Mad Bomber would move according to this set of game states.  The Mad Bomber would continue performing the movement until either it was completed or the GAME TIME timer ran out.  Once the move were completed, if GAME TIME had not run out, another random set of game states would be chosen.  In this way, the Mad Bomber would go from random game state to random game state (performing an endless series of random movements) until the GAME TIME runs out.  
  • Generally, the program will start at the bottom of the screen and work it's way up.  
    • First, when the WRM Index points to the 8th pair of WRM's, the collision check will be done.  Suppose there are no collisions.
    • Second, the paddle inputs will be sampled.  
    • Next, the WRM's in the 7th row (the row closest to the bottom of the screen) will be drawn and then moved down.  Drawing means assigning the WRM's to one of the four sprites in a simple rotation.  Moving down refers to increasing the y value according to some simple formula and gear box calculations based on the car speed and y-residuals.  So, first, the 7th pair of WRM's will be drawn and moved down.  Then the 6th pair.  Then the 5th pair.  Then the 4th pair, etc. until all seven pairs of WRM's have been drawn and moved down.  This process will take 3.5 frames (14 objects drawn 4 at a time) and we will call it one cycle. 
    • The Mad Bomber's Timer is a precision odometer used to measure the short distances between pairs of WRM's.  Whenever the car is moving, The Mad Bomber's Timer is counting up the distance travelled since the last pair of WRM's was reached.  
    • When the Mad Bomber's Timer goes off, it is time for the Mad Bomber to "drop" another pair of WRM's on the road.  The seven pairs of WRM's on the screen will change variables.  Changing variables means that the data stored in RAM for the current pair of WRM's (the x and y coordinates of the midpoint of the road and the y-residuals) will be moved to the variables for the next pair of WRM's.  That is to say, the "old" 7th pair of WRM's becomes the "new" 8th pair (not visible off the bottom of the screen); the "old" 6th pair becomes the "new" 7th pair and so on moving up the screen until the "old" 1st pair becomes the "new" 2nd pair and the "new" 1st pair is empty.  And the "old" 8th pair of WRM's that was previously off the bottom of the screen is deleted from memory.  Finally, a new pair of WRM's is "dropped" at the top of the screen at the horizon - they become the "new" 1st pair of WRM's - and the Mad Bomber's Timer is reset back to zero, ready for the process to start all over again.  
    • Suppose that for a particular speed of the car, it takes 50 cycles (175 frames) for the Mad Bomber's Timer to go off.  That means that for 49 consecutive cycles, the program will draw the 14 WRM's on the screen and move down all 16 WRM's (including the two that you can't see off the bottom of the screen), but on the 50th cycle, it will draw, move downchange variables and drop a new pair of WRM's at the top of the screen.  Dropping means creating a new pair of WRM's at the horizon.  
    • Once every approximately 4 times that the Mad Bomber drops a new pair of WRM's, the WRM Drop Counter will tell the Long Distance Odometer (AKA 3-digit SCORE) to increment one unit.  Note: The exact ratio is TBD.  
    • At the end of the game in attract mode, TOP SPEED will be displayed in the place where the GAME TIME had been displayed during the game.  

With this process in mind, we update our BITS AND BYTES a little bit to reflect the changes.

 

UPDATED LIST OF EVERYTHING TO BE STORED IN RAM

 

STANDARD KERNEL

  • 26 bytes a-z
  • Gain 4 bytes 44-47 if not scrolling playfield
  • statusbarlength: Gain 1 byte if not using life counter or status bars
  • lives and lifecolor: Gain 2 more bytes if not using pfscore bars

TOTAL 26+4+1+2=33 bytes


Plus 6 temporary variables temp1-temp6 that are erased when you call drawscreen

--------------------------------------------------------------
WRM (X,Y) COORDINATES AND RESIDUALS

Note: There are 8 pairs of WRM's (7 pairs on screen, 1 pair off the bottom of screen)

  • The x and y coordinates of midpoint of road for each pair of WRM's
    • x-coordinate (0-150): 1 byte
      • 1 byte * 8 pairs = 8 bytes
    • y-coordinate (0-128 off screen) + residue (0-1) in the 8.8 Fixed Point format : 2 bytes
      • 2 bytes * 7 pairs = 14 bytes
      • 1 byte for the 8th pair off the bottom of the screen (not in 8.8 format): 1 byte

Notes:

  • The 3D effects can be calculated by plugging y into some simple formulas and therefore don't need to be stored in RAM.  The 3D effects are: the increasing width of the road and the increasing size of WRM's as the WRM's come "closer."  
  • We only use 1 byte for the y coordinate of the 8th pair of WRM's to save 1 byte of RAM.  

TOTAL: 8 bytes + 15 bytes = 23 bytes
--------------------------------------------------------------
INDEXES AND COUNTERS
WRM INDEX (1-16): 1 nybble

SPRITE INDEX (1-4): 2 bits

MAD BOMBER'S ACCUMULATOR (estimated 1-1,024): (0-255) + fractional amount in the 8.8 Fixed Point format : 2 bytes (we will do lots of math with this number!)  NOTE: I haven't worked out the details yet.  

WRM DROP COUNTER (estimated 1-4): 2 bits  NOTE: I haven't worked out the details yet.  
TOTAL: 2 bytes + 1 nybble + 4 bits = 3 bytes
---------------------------------------------------------------

THE MAD BOMBER'S GAME STATES

Note: These RAM amounts are place-holders.  I haven't worked out the details for this part yet.  

  • 1 byte to store the Mad Bomber's current x-coordinate
  • 1 nybble to store the Mad Bomber's current game state.
  • 1 byte to store the x-coordinate of the Mad Bomber's target destination
  • 1 bit to store the Mad Bomber's speed (slow or fast)

TOTAL 2 bytes and 1 nybble and 1 bit

---------------------------------------------------------------
GAME VARIABLES
ATTRACT MODE OR PLAY MODE: 1 bit
GAME VARIATION (0-15): 1 nybble
NOVICE, PRO OR EXPERT: 2 bits

MANUAL OR AUTOMATIC: 1 bit
SPEED OF CAR (0-350) divided by 10 and represented internally as (0-35) + fractional amount in the 8.8 Fixed Point format : 2 bytes (we will do lots of math with this number!)
GEAR (1-4): 2 bits
TOP SPEED (0-350): 1 byte + 1 bit (for display purposes only; we won't do math with this number)
TIRE SKID: 1 bit
COLLISION: 1 bit
BONUS TIME: 1 bit
GAME OVER: 1 bit

TOTAL: 2 bytes + 10 bits = 3 bytes + 2 bits


NOT STORED IN RAM

GAME VARIATION (0-15): This number can be re-constructed from the toggle bits and doesn't need to be stored in RAM.  
GAME TIME: I think it is already stored in the score mini-kernel and we don't have to store it again
SCORE: I think it is already stored in the score mini-kernel and we don't have to store it again
MOTOR SOUND FREQUENCY: can be calculated from SPEED OF CAR
ACCELERATOR: same as PADDLE BUTTON (JOY0LEFT)
START: will be the same as PADDLE BUTTON (JOY0LEFT)


NOT NEEDED
TOW TRUCK: this game may not have this feature
HARD TO GET BONUS TIME: This game may not have this feature
-------------------------------------------------------------------

PLAYER CONTROLS

PADDLE POSITION (1-75): 7 bits

PADDLE BUTTON (JOY0LEFT): 1 bit

TOTAL: 8 bits = 1 byte  0 bytes

NOTE: To save RAM, we will not store the paddle control inputs 

-------------------------------------------------------------------

MANUAL TRANSMISSION

A nybble (4 bits) for a counter, 1 bit for a flag and 1 bit to shift up one gear.  

TOTAL: 1 nybble and 2 bits

-------------------------------------------------------------------
GRAND TOTAL
WRM (X,Y) COORDINATES AND Y-RESIDUALS: 23 bytes

INDEXES AND COUNTERS: 3 bytes

MAD BOMBER'S GAME STATES: 2 bytes and 1 nybble and 1 bit
GAME VARIABLES: 3 bytes and 2 bits

PLAYER CONTROLS: 1 byte 0 bytes

MANUAL SHIFTING: 1 nybble and 2 bits
GRAND TOTAL: 31 bytes and 2 nybble and 5 bits = 32 bytes and 5 bits

 

Leaving us 3 bits under the 33 byte limit  

 

WHAT EFFECT WILL THESE CHANGES TO RAM HAVE ON THE GAME?

Spoiler

SCREEN LAYOUT

Top Speed is eliminated from the game entirely.  Not calculated internally and then obviously not displayed on the screen, either.

 

The screen layout will be more simplified.

  • odometer/score in lower left
  • time remaining in lower right
  • nothing on top

 

GEARS

Internally, there will be 4 gears.  Using the debugger, you could probably verify that at all times the computer knows which gear the car is in.  Players will see, hear and feel and in general fully experience 4 gears.  The gear number will just not be displayed on the screen.  Each gear will have it's own speed range.  When the player holds down the red button, as speed increases, the computer will automatically shift up to the next higher gear.  Conversely, when the player releases the red button, as speed decreases, the computer will also automatically downshift to the next lower gears.  When there is a collision, speed is set to 0 and the gear is set to 1 and the player may press the red button to begin accelerating the car all over again. 

 

GAME OVER/ATTRACT MODE

When the timer reaches 0, the odometer value becomes the player's score and is locked in.  The words "GAME OVER" will be displayed on the screen and the game goes into the attract mode.  This will be accomplished by using a modified road-drawing routine that only uses 8 WRM's that will be drawn exclusively by the ball and missile.  The 3D size effect will only go from 1 to 4.  The road will be shorter but it will still move and turn.  Sprites P0 and P1, thus freed, will be used to draw the words "GAME OVER" in the middle of the screen above the horizon.  P0 will draw GAME using flicker.  (Alternating between GA and ME.)  P1 will draw OVER (alternating between OV and ER.)  It will flicker some but it will look alright.  GAME OVER will stay on the screen all the time during the attract mode, just like in the arcade.  And the last player's score will also stay on the screen during attract mode, just like in the arcade.  

-------------------------------------------------------------------
@mzxrules Thank you for the example!  

  • Like 1
Link to comment
Share on other sites

GEAR BOX CALCULATIONS - DEMO

 

Spoiler

In Stella, set controllers to joysticks and turn phosphor off.  

 

Using the joystick, move the white dot left and right with great precision.  

 

What does this demonstration show?

 

It shows that using Fixed Point Variables in bB, we can do calculations that have an integer part and a fractional part.  I call them "gear box" calculations.  These kinds of calculations can produce very fine and precise motions on the screen.  

 

0003_gear_box_demo.bas

0003_gear_box_demo.bas.bin

Link to comment
Share on other sites

SOLVING A SIMPLER PROBLEM - NO 3D EFFECTS

 

Spoiler

Sometimes, when a particular problem seems too difficult, we can learn something useful by solving a simpler problem first.

 

SIMPLIFIED NIGHT DRIVER - NO 3D EFFECTS

 

Something that makes Night Driver seem complicated are the 3D effects.  What are those?  

 

Review - What are the 3D effects in Night Driver?

Spoiler

As the road comes "closer": 

1.  The road gets wider

2.  The white road markers become larger

3.  The road moves faster

 

Let us strip away all the 3D effects from Night Driver.  Then what would Night Driver look like?  And how would the game work?

 

What would Night Driver look like?  

Spoiler
  • The road would look like 2 parallel lines.
  • All WRM's would be the same size and be moving at the same speed.

 

This is indeed an easier problem to solve!  

 

How would this simpler version of Night Driver work?  

Spoiler

What is the driving force that makes the road move forward?  

Spoiler

SPEED OF CAR (0-350)

 

How does SPEED OF CAR make the road move forward?

Spoiler
  1. The rate (in pixels per 3.5 frames) that the WRM's move down the screen is (probably) proportional to SPEED OF CAR.
  2. The frequency at which the Mad Bomber drops new pairs of WRM's is (probably) also proportional to SPEED OF CAR.

 

How can we find the constant of proportionality for the rate of movement of the WRM's?

Spoiler
  • Study video from the arcade game.  
  • Find a short 3 second piece of video in which we see a pair of WRM's being created, then fall all the way down the screen and disappear off the bottom, all while SPEED OF CAR remained constant.  Suppose SPEED OF CAR is 349.  
  • Take screenshots of the moment the pair were created and another screenshot of the moment they fell off the bottom.
  • Open these screenshots in a paint program.  
  • Count paint pixels to measure distance the pair of WRM's travelled down the screen.   
  • Use the game timer in the video as a time reference to measure GAME TIME elapsed.  
  • Convert the GAME TIME elapsed to actual time elapsed in real seconds.  

That's the arcade version.  Now in our Atari 2600 version...

  • We know the number of pixels from horizon to the bottom of the screen.  (We ought to know.  We're making the game!)
  • In our game, we know the frame rate.  Convert the time elapsed in seconds to frames.  
  • In our game, we draw the sprites every 3.5 frames.  We call those drawing cycles.  Divide frames by 3.5 to get drawing cycles.
  • Now divide the distance in pixels by drawing cycles and store as an 8.8 fixed decimal.  That is the rate at which WRM's would move down the screen when SPEED OF CAR is 349.  Let's call this rate y-down.  
  • Divide SPEED OF CAR by y-down.  This is the constant of proportionality.  Let us call it K-soc

Now, given any value of SPEED OF CAR, we can divide by the constant K-soc to get y-down, the rate in pixels/cycle that the WRM's should be moved down the screen.  

 

That is, if K-soc is constant.  We should capture more video of the arcade version at different values of SPEED OF CAR and verify that K-soc really is constant.  

 

How can we find the target value for the Mad Bomber's Accumulator?

Spoiler

In our Atari 2600 version...

  • We know the number of pixels from horizon to the bottom of the screen.  (We ought to know.  We're making the game!)
  • From our work, above, we also know the number of cycles in our Atari 2600 version for a single pair of WRM's to go from the horizon to falling off the bottom of the screen when SPEED OF CAR = 349.
  • We desire to have 7 pairs of WRM's on the screen at once.  Divide this amount of time by 7.
  • That is the target number of cycles.  Let us call it C-target.  Every time this number of cycles pass, we want the Mad Bomber to "drop" another pair of WRM's.
  • Multiply SPEED OF CAR by C-target to get the target value of the Mad Bomber's Accumulator.  Let's call this number K-DIST.  

That is for the case when SPEED OF CAR is 349.  What is the general rule?

  • I think that K-DIST will be a constant.  Here is evidence.
Spoiler
  • Go back to the arcade version.  Suppose SPEED OF CAR is half.  Well, then the GAME TIME elapsed for a pair of WRM's to fall down and disappear will be doubled.  Yes?  And then in our Atari 2600 version, the number of frames will be doubled and so the number of drawing cycles, C-target, will also be doubled.  Finally, we will have (1/2*SPEED OF CAR)(2*C-target) and the two's will cancel out, leaving us with SPEED OF CAR * C-target, the same as before.
  • Replace 2 with n and see that this will hold true for any value of n (where n<>0).    

 

The general rule seems to be that SPEED OF CAR * C-target is K-DIST.  So, you only need to find K-DIST once using any value of SPEED OF CAR and then you will know it for every value of SPEED OF CAR (as long as SPEED OF CAR <>0).  

 

If we ever do feel that we fully understand how this simplified version of Night Driver works, then we should build a demo of it and show that it works.  And if that demo is successful, then we can add back the 3D effects and try to understand how the full game works.   

 

  • Like 1
Link to comment
Share on other sites

ROADMAP - STEPS FORWARD

 

Spoiler

MOST RECENT VERSIONS ON TOP

 

VERSION B

Spoiler

To be updated, implementing the changes from THE ANDREW DAVIES 'SNAKE' EXAMPLE  

 

 

VERSION A

Spoiler
  1. VIDEO CAPTURE: screen measurements
    1. Determine exact location of horizon
    2. DEMO: 14 stationary WRM's with adjusted location of horizon.  
  2. VIDEO CAPTURE: 3D Effect #1: width of the road increases as it gets "closer"
    1. Enter into spreadsheet.  Let it do curve fit.
    2. Simplify as four or five linear regions
    3. DEMO: 14 stationary WRM's with 3D Effect: road gets wider as it gets "closer"
  3. VIDEO CAPTURE: 3D Effect #2: width and heighth of WRM's getting larger as WRM's get "closer"
    1. Enter into spreadsheet.  Let it do curve fit.
    2. Simplify as four or five linear regions
    3. DEMO: 14 stationary WRM's with 3D Effect: width and heighth of WRM's getting larger as WRM's get "closer"
  4. VIDEO CAPTURE: Find the values of the constants K-soc and K-DIST.  
    1. From the arcade version, measure the time in real seconds for a pair of WMR's to be created and fall off the bottom of the screen for a given value of SPEED OF CAR.
    2. For our Atari 2600 version, find the constant of proportionality K-soc used to find y-down, the rate that WRM's move down for a given value of SPEED OF CAR.  
    3. For our Atari 2600 version, find the constant K-DIST used with the Mad Bomber's Timer.
    4. DEMO: 14 moving WRM's with SPEED OF CAR controlled by paddle button and all 3D effects turned off
  5. DEMO: 14 moving WRM's with SPEED OF CAR controlled by paddle button and 3D effect #1 turned on: the road widens as it gets "closer."
  6. DEMO: 14 moving WRM's with SPEED OF CAR controlled by paddle button and 3D effect #2 turned on: the WRM's get larger as they get "closer."
  7. VIDEO CAPTURE: Find y-3D.  (See 3D Effect #3: WRM's move faster as they come "closer."
    1. DEMO: 14 moving WRM's with SPEED OF CAR controlled by paddle button and 3D effect #3 turned on: the WRM's move faster as they get "closer."   
  8. DEMO: 14 moving WRM's with SPEED OF CAR controlled by paddle button and all three 3D effects turned on
  9. VIDEO ANALYSIS: Study the movements of the Mad Bomber from the arcade version
    1. Determine the Mad Bomber's game states (as best as we can)
    2. DEMO: The Mad Bomber's Game States with the road turned off
  10. DEMO: The Mad Bomber's Game States with 14 moving WRM's with SPEED OF CAR controlled by paddle button and all three 3D effects turned on
  11. Add paddle steering control (if not done so already)
    1. DEMO The Mad Bomber's Game States with 14 moving WRM's with SPEED OF CAR controlled by paddle button and all three 3D effects turned on and paddle steering control

I hear that in the arcade version, the road may get narrower as you progress.  If true, we might try to do some screen captures of that effect and try to bring that into our home version as well.  

  • Like 1
Link to comment
Share on other sites

4-SPEED TRANSMISSION

 

Spoiler

My current thinking about the car's 4-speed transmission. 

 

OVERVIEW

Spoiler

Each gear (1-4) will have an acceleration curve and a speed range.  All together, the  look something like this.  

image.thumb.jpeg.4e46a53068ee295f1063fd8e01a4bf03.jpeg

 

Acceleration Curves

  • They are TBD.  They will found from analysis of video of arcade version.  
  • They will probably be modeled as straight lines

 

Gear Speed Ranges:

From arcade video, we found: 

  • 1st gear: 0-30
  • 2nd gear: 30-60
  • 3rd gear: 60-90
  • 4th gear: 90-200 (novice), 90-300 (pro) and 90-350 (expert)

 

Main Ideas

  • The higher the gear, the lower the acceleration.  1st gear has the highest acceleration.  4th gear has the lowest acceleration.  
  • 4th gear has an exceptionally large speed range, going from 90-200 in Novice Mode, 90-300 in Pro Mode and 90-350 in Expert Mode.   

 

VIDEO ANALYSIS

Spoiler

From video of the arcade version

  • Find a video showing a smooth acceleration from 0 to the maximum speed (or as close to max speed as you can find).  
  • Measure the time in real seconds for the car to accelerate from 0 to 30, from 30 to 60, from 60 to 90 and from 90 to the max speed.  

In our Atari 2600 home version

  • We know the frame rate of our game.  Suppose it is 60 fps.  
  • In our game, we draw the screen once every 3.5 frames.  We call 3.5 frames one drawing cycle.  
  • In our game, one second of real time is approximately 17 drawing cycles.  (60 / 2.5 is approx. 17)
  • From our video analysis, above, we know the number of seconds of real time for the car to accelerate from 0 to 30 then 60 then 90 then maximum speed.
  • Using the conversion 1 sec = 17 drawing cycles, we find the number of drawing cycles to go from 0 to 30 and then to 60 and then to 90 and then to maximum speed.
  • Finally, divide as follows
    • 1st gear (0-30): divide 30-0=30 by the number of drawing cycles from 0 to 30.  Call it y1.  
    • 2nd gear (30-60): divide 60-30=30 by the number of drawing cycles from 30 to 60.  Call it y2.  
    • 3rd gear (60-90): divide 90-60=30 by the number of drawing cycles from 60 to 90.  Call it y3.  
    • 4th gear (90-max speed)
      • Novice (max speed 200): divide 200-90=110 by the number of drawing cycles from 90 to 200.  Call it y4n.  
      • Pro (max speed 300): divide 300-90=210 by the number of drawing cycles from 90 to 300.  Call it y4p.  
      • Expert (max speed 350): divide 350-90=260 by the number of drawing cycles from 90 to 350.  Call it y4e.  


IMPLEMENTATION

Spoiler

Expressed in English pseudo programming language: 

 

If the paddle button is down, then

  • if the gear is 1, then speed of car = speed of car + y1
  • if the gear is 2, then speed of car = speed of car +y2
  • if the gear is 3, then speed of car = speed of car +y3
  • if the gear is 4, then
    • if the track is novice, speed of car = speed of car +y4n
    • if the track is pro, speed of car = speed of car +y4p
    • if the track is expert, speed of car = speed of car + y4e

% Don't forget max speed for each gear

  • if gear is 1 and speed of car >30, then speed of car is 30.
  • if gear is 2 and speed of car >60, then speed of car is 60
  • if gear is 3 and speed of car >90, then speed of car is 90
  • if gear is 4
    • and track is novice and speed of car>200, then speed of car is 200
    • and track is pro and speed of car>300, then speed of car is 300
    • and track is expert and speed of car>350, then speed of car is 350

 

If we did everything correctly, then the car in our Atari 2600 home version should accelerate from 0 to 30 to 60 to 90 to max speed in about the same amount of time as in the arcade version.  

 

BITS AND BYTES

Spoiler

MANUAL SHIFTING

We will need a nybble (4 bits) for a counter, 1 bit for a flag and 1 bit to shift up one gear.  TOTALLY: 6 bits

 

Counter (1 nybble): Suppose our game is running in Stella at 60 fps. Our program draws the 14 WRM's every 3.5 frames.  We call that a "drawing cycle."  We will therefore have about 17 drawing cycles per second running at 60 fps.  We want a "gear shift" (release the red button and grip it again quickly) to happen within let's say 1/2 of a second.  Half a second would be about 8 or 9 "drawing cycles" in our game.  So a one nybble (4 bits) counter (0-15) should be enough. 

 

Flag (1 bit): When the speed of car is at the top of the current gear's range, and if the button is not pressed, then this flag is set and the counter is reset to zero.  This flag tells the program each time in the main loop to check whether or not the button is pressed before the timer runs out.  If so, then a "gear shift" (release button and press again quickly) event has occurred.  Set the Shift Up bit.

 

Shift Up (1 bit): When a "gear shift" even has occurred, this bit is set, informing the program at the next opportunity to shift up.  Shifting up is a procedure that involves incrementing the gear variable in RAM (2 bits) and playing sounds.  When the shifting up processed has finished, the Shift Up bit is reset to 0 again.

 

SHIFT UP PROCEDURE

Spoiler

Suppose the car is in 1st gear and its speed is 30.  (The top speed of gear 1.  The player can shift up now.)

 

THE PLAYER DOES A "RELEASE AND SQUEEZE" WITH THE PADDLE BUTTON

  • The shift up bit is set to 1.
  • Acceleration of the car is paused.  The speed of the car is held constant at 30 for a moment.
  • Gear shifting sounds may be played.  
  • GEAR is increased by 1.
  • The pause on acceleration is ended.  The car lunges forward and accelerates again, now in 2nd gear.  
  • The shift up bit is reset to 0.
  • Normal engine sounds take over.  These engine sounds increase in pitch with speed.  

 

CONTINGENCIES

What if the car collides while in the middle of the gear shifting procedure?

  • No problem.  Just exit the gear shifting procedure and begin the collision procedure.  

What if the player releases the red button before the gear shifting procedure is finished?

  • Once started, the gear shifting procedure should be finished unless
    • The GAME TIMER runs out and the game is over
    • A collision occurs
  • Actually, no need to check the status of the red button again until after the gear shifting procedure has finished.  

 

MANUAL OR AUTOMATIC

Spoiler

We can give the player the option of either MANUAL or AUTOMATIC transmission. 

 

BITS AND BYTES

Spoiler

1 bit will be needed to indicate either MANUAL or AUTOMATIC transmission.  

 

AUTOMATIC

Spoiler

When the speed of car reaches the top speed of the current gear (for example, speed 30 when in 1st gear), then the paddle button is checked and if it is down, then the SHIFT UP bit is set to 1 and the shift up routine is executed.  Thus, the only difference between MANUAL and AUTOMATIC modes in this game is that MANUAL needs a "release and squeeze" button action from the user at the right time to proceed, whereas the AUTOMATIC mode does not.  

 

 

  • Like 1
Link to comment
Share on other sites

GAME SELECT

 

Spoiler

My current thinking is that we prefer 1970's-style GAME VARIATIONS over a GAME MENU.  

 

WHEN THE CONSOLE IS POWERED ON

  • The game loads in the ATTRACT MODE
  • GAME VARIATION 1 is pre-loaded into the display area on the screen.

IF GAME SELECT IS PRESSED (AND RELEASED) IN THE ATTRACT MODE

  • The game variation number is internally increased by one 
  • The toggle bits in RAM are updated according to the information in the GAME SELECT MATRIX in the game instruction manual.
  • The new game variation number is displayed on the screen
  • The player of course can press (and release) GAME SELECT as many times as desired to choose the desired game variation.  All the while, the attract mode animates the screen.

IF GAME RESET IS PRESSED (AND RELEASED) IN THE ATTRACT MODE

  • The game ATTRACT MODE bit is toggled to GAME MODE.
  • "GAME OVER" disappears from the top of the screen.  The road is cleared and one pair of WRM's is drawn at the horizon.  "000" is displayed in your score area and "100" is displayed in the GAME TIME area.  The game is ready to be played.  

DURING GAME PLAY

  • IF GAME SELECT IS PRESSED (AND RELEASED): The current game is discarded without saving the score.  The game is put back into ATTRACT MODE.  The current GAME VARIATION is displayed on the screen.  
  • IF GAME RESET IS PRESSED (AND RELEASED): The current game is discarded without saving the score.  The game is started over for the current GAME VARIATION.  

GAME OVER

  • When the game ends, the game enters the ATTRACT mode.  The player's SCORE and the current GAME VARIATION are displayed on the screen.  

 

BITS AND BYTES

  • No RAM is needed to use GAME SELECT.  GAME VARIATION (0-15) can be reconstructed from the toggle bits using a series of IF-THEN statements. 
  • Ordinarily, you would use a nybble to store a value from 0-15.  However, we are currently nearly out of RAM and we don't have a nybble to spare. 
Spoiler

Suppose Game Variation 1 has the following: NOVICE mode (not PRO or EXPERT), FIXED track (not random) and MANUAL transmission (not automatic).  Then, if the GAME VARIATION number were lost, it could be reconstructed by a series of IF-THEN statements as follows.  IF the track is NOVICE and the track type is FIXED and the transmission type is MANUAL, then GAME VARIATION is 1.  You would need one IF-THEN statement in your program for every GAME VARIATION. 

 

BORROWING A VARIABLE

Spoiler

You could store this number in a TEMP variable, but it would be lost after Draw Screen and on the next frame, the number would have to be reconstructed again.  Or, following Nukey Shay's advice, we might find some variable that is currently not being used and borrow it temporarily to store the GAME VARIATION number. 

Spoiler

"The ram variables are read/written the same way regardless of what rom bank you are in. So you need to try to reuse ram wherever you can. Got a variable that doesn't apply to this portion of the game? Reuse it for something else."

image.thumb.jpeg.a18227e1e2e43328ec30ac67b2e89d06.jpeg

For example, in the ATTRACT MODE, there will be a special WRM drawing mode that has no collision detection, so we can borrow the x-coordinate of the 8th pair of WRM's to store the GAME VARIATION.  But once the game enters GAME MODE, then this variable will again be used for collision detection and the value of the GAME VARIATION would again be lost.  Upon entering ATTRACT MODE the next time, the GAME VARIATION number would again have to first be reconstructed by IF THEN statements from the toggle bits.  And perhaps then again stored in a borrowed nybble.  And the process would repeat all over again.  And this may sound awkward.  But this method would allow us to implement GAME SELECT in the attract mode without using more RAM (or by only using borrowed RAM).  

 

  • Like 1
Link to comment
Share on other sites

Just a humble suggestion, but I feel like you should stop "planning" so much, and just start writing some code and get things onscreen and see what works.  Otherwise, you aren't really getting anywhere.

 

 

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...