A trip down a Funfair Big Dipper (no reatraints: stay on it)

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
esdel
Newbie
Posts: 4
Joined: Wed Nov 17, 2010 8:05 am

A trip down a Funfair Big Dipper (no reatraints: stay on it)

Post by esdel » Thu Jan 05, 2012 5:38 am

Our challenge is to make a computer game more fun even than the hardware game I was given as a Christmas present.

In the hardware game the entire big dipper is enclosed in a transparent sphere clasped in our hands.
We shake and gyrate this sphere so that the ball on the rails of this "Funfare Big Dipper" experiences the dynamic forces that we hope (vainly) will keep it on the rails.
Instead of the "seat-of-the-pants" terrifying sensations of the big dipper we have only the VIEW (our external view) of the ball rolling down the slope and soon leaving the rails! This big dipper has no seat belts nor restraining structures. Only two narrow rails whose spacing and incline vary and whaose banking is "all wrong".

The FUN lies in creating a game where the computer provides ONLY the feedback required for those of skill to be able to win.
We must manipulate the sphere so the ball rolls down the slopes
1. So it is ALWAYS above the rails (in the gravitational sense)
2. NOT so fast it goes off the rails due to centrifugal force on corners (curved sections)
3. Not so SLOW that it fails to traverse straight sections where the two rails are almost touching.

In the code snippet below I have tried to illustrate these ideas:
A. A pitch, roll, yaw headup display for the HANDS that control the SPHERE
B. A "pilot's view" from atop the ball looking down the track the way the ball is rolling

The twists and turns of the descent seen ahead lets the pilot GUESS what motions of the sphere will all-too-soon be required if the ball is to stay on the rails

We will NOT spoil all the fun by giving too much help from the computer - such as displaying the force currently exerted by each rail.
But we may decide to help with a warning flashing red dot when the force on any rail goes to zero.

Assuming consumate skill from the hands that control the sphere (correcting for all incorrectly-banked turns etc annd successfully controlling speed along the rails) there are TWO situations:
1. The ball is stably supported above rails that appear CONCAVE to it. (bottom of a valley)
2. The ball is supported above rails that appear CONVEX to it (top of a hill)

In case 1 the game CAN be paused, for a breathtaking cuppa: the ball "parked" there at rest
But case 2 is UNSTABLE - the ball is about to plunge down the valley!

OK here is my ATTEMPT at showing a portion of the game (towards its end, when "NOT TOO SLOW" is demanded to reach the goal over a SINGLE rail straight section)

Code: Select all

'@ help guiding a ball down a Roller Coaster
SCREEN 12
WINDOW (-1.5, -1)-(1.5, 1)
PRINT
PRINT "                        Lost contact warning lights"
 
PRINT "         Left rail                                           Right rail"
CIRCLE (-1, .78), .031
CIRCLE (1, .78), .031
LOCATE 24, 1: PRINT "View down track from atop ball";
LOCATE 24, 40
PRINT "Headup display Pitch, Roll, Yaw"
PRINT "                                      rate for hands controling Sphere"
LOCATE 7, 28: PRINT "goal"
CIRCLE (-.8, .2), .5, 14, 1.4, 3.34, 1
CIRCLE (-.745, .195), .5, 14, 1.45, 3.6, 1
LINE (-.68, .632)-(-.5, .632), 4
CIRCLE (-.42, .57), .1, 2

LINE (-.68, .6)-(-.75, .5)
LINE (-1.29, .11)-(-1.2, -.5), 14
LINE (-1.2, .014)-(-.8, -.5), 14
LOCATE 5, 1: PRINT "Too fast"
PRINT "here and"
PRINT "Fall off"
LINE (-1.33, .53)-(-1.23, .4)
LOCATE 9, 16
PRINT "To SLOW here"
LOCATE 10, 16
PRINT "and fall off"
LOCATE 11, 16
PRINT "one rail only!"
LOCATE 14, 40
PRINT "How to show RATE of roll, pitch, yaw"
LOCATE , 40: PRINT "and control in a way understood!"
Last edited by esdel on Thu Jan 05, 2012 2:58 pm, edited 1 time in total.

User avatar
burger2227
Veteran
Posts: 2425
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Thu Jan 05, 2012 1:54 pm

Please use Code box button before code and click again after cursor is at end of code. This prevents smiley faces.

I fixed your post. Edit it to see how I put it inside the code box.

Moderator Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Post Reply