Jump to content
  • entries
    8
  • comments
    0
  • views
    1,838

Setting the Road Pylons in Motion: DEMO - A Speed of 35 w/ No 3D Effects


Living Room Arcade

353 views

My newest thoughts about Night Driver Arcade.

 

Please comment respectfully.  This is not my job.  I don't get paid to do this.  Please do not ask me to write code.  If I find time to write code, I will do it.  And if I never find time, then I never will.  Please understand and be respectful when you comment.  Thank you.  

 

We will measure the acceleration of the car later.  I realized that with just the information we had, we could calculate an important constant and set the road pylons in motion.  So let's do that instead, shall we?  

 

Road Pylon Movement - Theory of Operations

Spoiler

See "THE ANDREW DAVIES 'SNAKE' EXAMPLE"/Applying the Idea to This Game/How to Implement this Idea?/VERSION B "The road is like a ladder with 8 rungs," etc.

 

We think of the road as a ladder with 8 rungs and 7 spaces in between.  Each space in the ladder has a top rung and a bottom rung.  We imagine that on the road, each pair of white road markers (WRM's) is assigned to one of the 7 spaces.  We imagine further that each pair of WRM's starts on the top rung and moves down to the bottom rung.  Then, it magically appears back on the top rung and repeats this motion until the game is over. 

 

The location of one pair of WRM's on it's bottom rung overlaps the pixels of the next lower pair of WRM's when they are on their top rung.  This creates the illusion that a single pair of WRM's is created on the horizon at the top of the screen and then moves all the way down and "falls off" the bottom of the screen.  Actually, they don't.  Actually, as you now know, each pair of WRM's travels no farther than the distance of one space on the ladder.  

 

So, each pair of WRM's moves from the top rung to the bottom rung of one space on the ladder.  This movement happens simultaneously in all seven spaces of the ladder.  That is, there are 7 pairs of WRM's and each is assigned to one space on the ladder and they all move together in unison.  

 

Directing the movements of the 7 pairs of WRM's so that they will be in unison is the Mad Bomber from Activision's Kaboom!.  We imagine that the Mad Bomber has a timer that goes from 0% to 100% and we call it the Mad Bomber's Percentage (MBP for short).  When the MBP is at 0%, then all 7 pairs of WRM's are on their top rungs.  When the MBP reaches 100%, all 7 pairs of WRM's will be on their bottom rungs.  And everywhere in between, the proportion is maintained.  That is, when the MBP is at 50%, then all 7 pairs of WRM's will be 50% of the way from their top rungs to their bottom rungs.  And when the MBP is at 75%, then all 7 pairs of WRM's will be 75% of the way down from their top rungs to their bottom rungs.  It is like an orchestra, and the Mad Bomber is the conductor.  

 

The rate at which the Mad Bomber's Percentage goes from 0% to 100% depends directly on SPEED OF CAR.  We use the following formula.

 

Quote

SPEED OF CAR * Conversion Factor *100% = Amount to be Added to MBP each Drawing Cycle

As you can see from the above equation, as SPEED OF CAR increases, the Amount to be Added to MBP also increases.  That is, at a small value of SPEED OF CAR, only a small amount will be added to the MBP each drawing cycle.  The result will be that the road will move more slowly.  Conversely, at high values of SPEED OF CAR, a large amount will be added to the MBP each drawing cycle.  This will result in the road moving much faster.  Thus, the speed of the road pylons on the screen is directly proportional to SPEED OF CAR.  

 

Calculation of the Constant

Spoiler

A Speed of "35"

 

Previously, we have found that a speed of "35" in Night Driver is equal to 0.76 odometer turns per second (OT/sec) (link).  We have also found that the distance from the cockpit of the car to the horizon is 2.0 odometer turns (OT) and that is equal to 7 pairs of WRM's (link).  That is, 2.0 OT = 7 pairs of WRM's.  Combining these two equations, 

Quote

A speed of "35" = (0.76 OT/sec)(7/2 pairs of WRM's/OT)= (0.76)*(3.5) pairs of WRM's/sec = 2.66 pairs of WRM's/sec

We could also say that at a speed of "35," 2.66 pairs of WRM's = 1 second.  

 

In our program, there are 14 WRM's being drawn by four objects; the ball, missile1, the P0 sprite and the P1 sprite, resulting in a drawing cycle of 14/4=3.5 frames.  Batari Basic runs at 60 frames per second.  Thus, when bB is running our program, there will be 60/3.5=17.14 drawing cycles per second.  Thus, we could also say that 17.14 drawing cycles = 1 second.  We can combine the two equations together and say that at a speed of "35," 17.14 drawing cycles = 2.66 pairs of WRM's.  Rearranging, 1 pair of WRM's = (17.14 drawing cycles)/2.66.  Thus, at a speed of "35," 1 pair of WRM's = 6.44 drawing cycles.  

 

Quote

A drawing cycle is the number of frames needed for the game program to draw all of the objects on the screen.  In Night Driver Arcade, a drawing cycle is 3.5 frames.  There is no such thing as a "half of a frame," of course.  The meaning is that the 14 road pylons will be drawn first in 4 frames, then in 3 frames, then in 4 frames, then in 3, etc. such that, on average, it will take 3.5 frames to draw the road and we call that one drawing cycle.  

 

What percentage of 6.44 drawing cycles is 1 drawing cycle?  It is 1/6.44 = 0.155 * 100% = 15.5%  Since the MBP goes from 0% to 100%, this is the amount that would be added to the MBP each drawing cycle to move the road at a speed of "35".  

 

For Any Value of SPEED OF CAR

 

We use the equation 35*CF=15.5% to solve for the conversion factor, CF, in the equation given above in the section "Road Pylon Movement - Theory of Operations."  We calculate CF to be (0.155)/35 = 0.443%.  We guess that this conversion factor, CF, will be valid for all allowed values of SPEED OF CAR.  Thus, our formula becomes

Quote

SPEED OF CAR * 0.443% = Amount to be Added to MBP each Drawing Cycle

Sample Calculation

 

35*0.443%=15.5%.  That is, if an amount of 15.5% is added to the MBP each drawing cycle, then this will cause the road pylons to move at a speed of "35."  

 

 

The 3D Effects - A Review

Spoiler

See SOLVING A SIMPLER PROBLEM - NO 3D EFFECTS

Quote

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?  

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

This requires a bit of imagination, but it's not too hard.  If you give it a bit of thought, I think you can grasp this idea that if you strip away the three 3D effects in Night Driver, then what you will be left with is a road that consists of two parallel lines and pairs of WRM's that are equal in size and are all moving at the same speed.  

 

Demo: A Speed of 35 with No 3D Effects

Spoiler

image.jpeg.37ba4e3b28573db664ef61ab292fbf4c.jpeg 

Note: Phosphor effect was turned on to take this screenshot.  Turn off phosphor when you run the program (or adjust it to your liking).  

 

20241008 Moving Road, Speed 35, No 3D DEMO.bas.bin  EDIT #2: New .bin file #2. A bug was fixed. I think it's working perfectly now. Please use this one.

 

This demo was tested using Stella 6.7.1.  TIP: Click on the Stella window, letting it be the active window.  Then, let go of your computer's mouse and wait for the frame rate to reach a steady 60.0 fps.  Then, the pylon flickering should settle down and it should look pretty good.  

 

On the bottom we see 35, meaning that SPEED OF CAR is set to 35.  And we see the odometer turning to indicate how fast distance is traveled in the game at that speed.  

 

What This Demo Shows:

This is what a speed of "35" would look like in Night Driver with all of the 3D effects removed.  The road appears as two parallel lines.  The road pylons are all equal in size and are all moving at the same speed.  

 

Keyboard Shortcuts:

Ctrl R: Start over

Alt P: Turn phosphor on/off

Alt L: Show/hide frame rate 

 

What's Next?

Spoiler

We'll see, but I'm thinking that next I'd like to make some screen measurements of the 3D effects in the game and start adding in the 3D effects mentioned above. 

 

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

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