|
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - mr why
Pages: [1]
1
« on: May 25, 2012, 12:11:32 pm »
A wonderful resource is _SNDRAW within QB64. With it you can make all manner of realistic sounds - any instrument of any orchestra real or imagined. Chords, polyphonics, harmonies and dischords.
I use SNDRAW (and a bit of physics) to design guitars, bells, drums, organ pipes etc - listening to them before we build them. That way there is no "black museum" of ones that did not work and you can even have the fun of hearing the sound of any that the laws of physics/acoustics say are impossible to build!
Mr Why
2
« on: May 25, 2012, 11:55:44 am »
The 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 whose banking is "all wrong".
The FUN lies in creating a game where the computer provides ONLY the visual 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). Run it in any flavor of BASIC
'@ 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 "Too 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!"
3
« on: May 24, 2012, 03:36:28 am »
This gets you the colours you want and you know what you are getting.
It is a "colour picker" and no matter which screen or monitor you use you get the colour you pick. (The next thing you draw is thet colour and none other. No theory; no broken promises!)
The chart below show all the colours that YOUR monitor screen is ABLE to show. Run it in qb64 nd you will see them all:
DIM colour&(32), r(400, 480), B(400, 480), g(400, 480) SCREEN _NEWIMAGE(640, 480, 32)
WINDOW (-440, -240)-(439, 239) _FULLSCREEN kk = 90 kkc = 130 kkd = 100 kky = 105 kkg = 130 kkb = 150 FOR x = -200 TO 200 xx = x + 200 FOR y = -200 TO 200
yy = y + 200 GOSUB quickcalc r(xx, yy) = 320 * EXP(-ABS(x / kkc) - ABS(y - 200) / kkc) B(xx, yy) = 335 * EXP(-ABS(x - 200) / kkb - ABS(y) / kkb) g(xx, yy) = 320 * EXP(-ABS(x / kkg) - ABS(y + 200) / kkg) r(xx, yy) = r(xx, yy) + 310 * EXP(-ABS(x + 200) / kky - ABS(y) / kky) g(xx, yy) = g(xx, yy) + 310 * EXP(-ABS(x + 200) / kky - ABS(y) / kky) 'xx,yy from 0 to 400, r(xx, yy) = r(xx, yy) + (255 - r(xx, yy)) * calc1 g(xx, yy) = g(xx, yy) + (255 - g(xx, yy)) * calc1 B(xx, yy) = B(xx, yy) + (255 - B(xx, yy)) * calc1 r(xx, yy) = r(xx, yy) + (255 - r(xx, yy)) * calc2 g(xx, yy) = g(xx, yy) + (255 - g(xx, yy)) * calc2 B(xx, yy) = B(xx, yy) + (255 - B(xx, yy)) * calc2 r(xx, yy) = r(xx, yy) + (255 - r(xx, yy)) * calc3 g(xx, yy) = g(xx, yy) + (255 - g(xx, yy)) * calc3 B(xx, yy) = B(xx, yy) + (255 - B(xx, yy)) * calc3 r(xx, yy) = r(xx, yy) + (255 - r(xx, yy)) * calc4 g(xx, yy) = g(xx, yy) + (255 - g(xx, yy)) * calc4 B(xx, yy) = B(xx, yy) + (255 - B(xx, yy)) * calc4
r(xx, yy) = r(xx, yy) * calc5 g(xx, yy) = g(xx, yy) * calc5 B(xx, yy) = B(xx, yy) * calc5
PSET (x, y), _RGB32(r(xx, yy), g(xx, yy), B(xx, yy)) NEXT y NEXT x
END quickcalc: calc1 = EXP(-(((ABS(xx) + ABS(yy))) / kk)) calc2 = EXP(-(((ABS(xx - 400) + ABS(yy - 400))) / kk)) calc3 = EXP(-(((ABS(xx - 400) + ABS(yy))) / kk)) calc4 = EXP(-(((ABS(xx) + ABS(yy - 400))) / kk)) calc5 = (1 - EXP(-(((ABS(x) + ABS(y))) / (kkd)))) RETURN
Now in QB64 Wiki is "explained" how you slide your mouse over the chart and pick exactly the colour you want. Now you see WHY it is useful, give it a try!
With so many millions of coulors it is made a bit complicated. Each colour is made by a recipe of 0 to 255 tots of the 3 primary colours, giving "as dark as your screen gets" to bright white via all colours in between.
But this chart gets rid of all that fuss and bother (inventing colours NOT those actually on YOUR screen). And the command that tells you the state-of-screen at the point where you have put the mouse is well worth knowing and useful for other purposes!
Have FUN Mr Why
4
« on: May 22, 2012, 01:33:50 am »
Here is an example and a challenge game for you. Using gravity I have set up 4 equal heavenly bodies to rotate about one another sharing one and the same double figure 8 orbit.
Can you get them to maintain that double-8 orbit?
It should be very easy! - There are only 4 numbers to adjust: xc(1) = .1306 x-position start xc(6) = -.0153 y-position start xc(10) = -6.0005 x-speed start xc(13) = 1.9245 y=speed start
Adjust these EVER-so-slightly and you may find what I am missing!
I always find the computation errors are too big - the orbit falls apart (beginning in ever-growing fashion) To begin with all seems fine - but soon your hopes are dashed!
But the SINGLE figure-8 shared orbit (3 stars or planets sharing one orbit) is DIFFERENT - for the laws of gravity forgive and correct the computation errors! Similarly if you provide a large central "sun" to rotate around, everything works fine.
DEFDBL A-H, K-M, O-Z: DEFINT I-J, N n = 16: OPTION BASE 1 DIM x(n), xc(n), f(n), c1(n), c2(n), c3(n), c4(n) GOSUB graphics m1 = 1#: m2 = 1#: m3 = 1#: m4 = 1 t = 0# ' ** initial positions ** xc(1) = .1306: xc(2) = 0: xc(3) = -xc(1): xc(4) = 0 'x coords xc(5) = 0#: xc(6) = -.0153#: xc(7) = 0: xc(8) = -xc(6) 'y coords ' ** initial speeds ** xc(9) = 0: xc(10) = -6.0005: xc(11) = 0: xc(12) = -xc(10) 'x vel xc(13) = 1.9245: xc(15) = -xc(13): xc(16) = 0 'y vel
h = .0000015#
agn: GOSUB Runge PSET (xc(1), xc(5)), 12 PSET (xc(2), xc(6)), 9 PSET (xc(3), xc(7)), 15 PSET (xc(4), xc(8)), 13
t = t + h 'IF j = 30000 THEN CLS : j = 0: GOSUB energy GOTO agn END
Equations: d21 = x(2) - x(1): d32 = x(3) - x(2): d43 = x(4) - x(3): d14 = x(1) - x(4) d13 = x(3) - x(1): d24 = x(4) - x(2) d65 = x(6) - x(5): d76 = x(7) - x(6): d87 = x(8) - x(7): d58 = x(5) - x(8) d75 = x(7) - x(5): d86 = x(8) - x(6) r12 = (d21 ^ 2# + d65 ^ 2#) ^ .5# r23 = (d32 ^ 2# + d76 ^ 2#) ^ .5# r34 = (d43 ^ 2# + d87 ^ 2#) ^ .5# r41 = (d14 ^ 2# + d58 ^ 2#) ^ .5# r13 = (d13 ^ 2# + d75 ^ 2#) ^ .5# r24 = (d24 ^ 2# + d86 ^ 2#) ^ .5# p12 = r12 ^ 3#: p23 = r23 ^ 3#: p34 = r34 ^ 3: p41 = r41 ^ 3# p31 = r13 ^ 3: p24 = r24 ^ 3 f(1) = x(9): f(2) = x(10): f(3) = x(11): f(4) = x(12) f(5) = x(13): f(6) = x(14): f(7) = x(15): f(8) = x(16) f(9) = m2 * d21 / p12 + m3 * d13 / p31 - m4 * d14 / p41 'x accn of m1 f(10) = m3 * d32 / p23 + m4 * d24 / p24 - m1 * d21 / p12 ' m2 f(11) = m4 * d43 / p34 - m1 * d13 / p31 - m2 * d32 / p23 ' m3 f(12) = m1 * d14 / p41 - m2 * d24 / p24 - m3 * d43 / p34 ' m4 f(13) = m2 * d65 / p12 + m3 * d75 / p31 - m4 * d58 / p41 'y m1 f(14) = m3 * d76 / p23 + m4 * d86 / p24 - m1 * d65 / p12 ' m2 f(15) = m4 * d87 / p34 - m1 * d75 / p31 - m2 * d76 / p23 ' m3 f(16) = m1 * d58 / p41 - m2 * d86 / p24 - m3 * d87 / p34 ' m4 RETURN
Runge: FOR i = 1 TO n: x(i) = xc(i): NEXT GOSUB Equations FOR i = 1 TO n: c1(i) = h * f(i): NEXT FOR i = 1 TO n: x(i) = xc(i) + c1(i) / 2#: NEXT GOSUB Equations FOR i = 1 TO n: c2(i) = h * f(i): NEXT FOR i = 1 TO n: x(i) = xc(i) + c2(i) / 2#: NEXT GOSUB Equations FOR i = 1 TO n: c3(i) = h * f(i): NEXT FOR i = 1 TO n: x(i) = xc(i) + c3(i): NEXT GOSUB Equations FOR i = 1 TO n: c4(i) = h * f(i): NEXT FOR i = 1 TO n xc(i) = xc(i) + (c1(i) + 2# * c2(i) + 2# * c3(i) + c4(i)) / 6# NEXT RETURN
graphics: SCREEN 12 PAINT (1, 1), 9 xm = .15: ym = .15 VIEW (180, 17)-(595, 460), 0, 13 WINDOW (-xm, -ym)-(xm, ym) xg = .134 FOR xi = -xg TO xg + .001 STEP xg / 20 LINE (-xm, xi)-(xm, xi), 8: LINE (xi, -ym)-(xi, ym), 8 NEXT xi LINE (-xm, 0)-(xm, 0), 9: LINE (0, -ym)-(0, ym), 9
RETURN
energy: ' ** Is energy conserved? ** kin1 = .5# * m1 * (xc(7) ^ 2# + xc(10) ^ 2#) kin2 = .5# * m2 * (xc(8) ^ 2# + xc(11) ^ 2#) kin3 = .5# * m3 * (xc(9) ^ 2# + xc(12) ^ 2#) pot = -(m1 * m2 / r12 + m2 * m3 / r23 + m3 * m1 / r13) energy = kin1 + kin2 + kin3 + pot LOCATE 21, 1: PRINT "Energy" LOCATE 22, 1: PRINT energy LOCATE 17, 7: PRINT " " LOCATE 17, 1: PRINT "Time ="; CSNG(t) RETURN
5
« on: May 21, 2012, 09:41:55 am »
One of the first things most of us want to do is make things look three-dimensional, real and solid, despite only having a flat screen. I will illustrate three ways to help do this, using the programs I did to draw knots and find out when they were actually knotted - not just tangled loops
1. Use colour to indicate depth (like on a contour map) 2. Make distant things smaller 3 SHIFT distant things BEHIND near things as you move your eye-position
By doing 3 (parallelax shift) alternately back and forth birds judge distance very accurtely. Also, for us things that change once-a-second get immediately noticed!
This prog is best run in qb64 (screen resolution and speed)
DEFDBL A-Z
_FULLSCREEN SCREEN _NEWIMAGE(1000, 730, 256) WINDOW (0, 0)-(1000, 730) DIM wx(710), wy(710), wz(710) dt = 710 FOR n = 1 TO dt wx(n) = 1 + SIN(n / 30 - 1.8) wy(n) = 1 + SIN(n / 41 + .7) wz(n) = 1 + SIN(n / 50 - .3) NEXT n
PRINT "Here is a piece of bent wire tied in a knot"
FOR n = 1 TO dt x = 60 + 100 * wx(n) y = 700 - 120 * wy(n) z = 1 + 7 * wz(n) CIRCLE (x, y), z / 3 + 1, z NEXT n LOCATE 9, 1: PRINT "xy view" LOCATE 9, 45: PRINT "xz view"
FOR n = 1 TO dt x = 400 + 120 * wz(n) y = 700 - 120 * wy(n) z = 1 + 7 * wx(n) CIRCLE (x, y), (z + 3) / 3 + 1, z NEXT n
FOR n = 1 TO dt x = 50 + 100 * wx(n) y = 280 - 120 * wz(n) z = 1 + 7 * wy(n) CIRCLE (x, y), (z + 3) / 3 + 1, z NEXT n
LOCATE 40, 1: PRINT "zy view" LOCATE 5, 20: PRINT "A" LOCATE 14, 9: PRINT "B" LOCATE 14, 61: PRINT "B" LOCATE 5, 81: PRINT "A" LOCATE 34, 6: PRINT "B" LOCATE 44, 20: PRINT "A" LOCATE 38, 54: PRINT "B" LOCATE 30, 68: PRINT "A" LOCATE 45, 50: PRINT " View from alternating x-positions";
again: PSET (400, 300), 0 FOR n = 1 TO dt x = 420 + 100 * wx(n) y = 310 - 120 * wy(n) z = 1 + 7 * wz(n) CIRCLE (x, y), z / 3 + 1, z NEXT n GOSUB pause FOR n = 1 TO dt x = 420 + 100 * wx(n) y = 310 - 120 * wy(n) z = 1 + 7 * wz(n) CIRCLE (x, y), z / 3 + 1, 0 NEXT n FOR n = 1 TO dt x = 420 + 100 * wx(n) + 15 / (2.4 - wz(n)) y = 310 - 120 * wy(n) z = 1 + 7 * wz(n) CIRCLE (x, y), z / 3 + 1, z NEXT n GOSUB pause FOR n = 1 TO dt x = 420 + 100 * wx(n) + 15 / (2.4 - wz(n)) y = 310 - 120 * wy(n) z = 1 + 7 * wz(n) CIRCLE (x, y), z / 3 + 1, 0 NEXT n GOTO again:
pause: DO _LIMIT 20 kk = kk + 1 IF kk > 30 THEN kk = 0: RETURN GOTO pause LOOP END
6
« on: May 21, 2012, 02:50:19 am »
I just joined, in relation to qb64, the best resources are at http://www.qb64.net and http://qb64.net/wiki/index.php?title=Main_Page Some tutorials are available at the same wiki, http://qb64.net/wiki/index.php?title=QB64_Tutorials Well anyway good luck with your forum. from a qb64user
QB64user, Welcome, good to have your help! Please tell us more of your ideas on tutorials. I am not sure "Tutorials" is the best word to use - newbies are easily discxouraged if they suffered from "not the best teachig"! We can call them "Getting Started" or "How I wrote my first xxxx program" Put yourself in their shoes - remember how you felt about things when you first began and explain in simple English (keeping away from jargon and technical terms if you can!). Take everything by example and in SIMPLE steps. Yes qb64 is excellent (and a free download). Especially it is excellent (fast and powerful with GREAT music via _SNDRAW) - eventually. That is AFTER you get your program working! But QB64 has no way to warn you AT ONCE of all the errors you make! On the other hand QBASIC lets you ASK wht values all the numbers have reached EVERY TIME it stops working. You just type ? and the name like this for example ? N and it tells you. This makes QBAS far easier to lean on - and your finished program then runs seamlessly and much faster on qb64 So start with QBAS (Quickbasic) and switch to QB64 once you get it working! BIll Gates tried to "torpedo" QBAS in his bodge fix SP2. On many computers he succeeded - but not on mine. So perhaps not on yours. So give QBAS a try and see if it works on your computer.
Pages: [1]
|
Excelling in C++: Trust the Professional Code Experts at MyCodingHomework for Expert Homework Assistance
by Dilamon Saravi
June 05, 2023, 08:02:21 am
|
Make money online: 4 Reasons Why Blockchain Gaming is The Future
by Damingw
March 06, 2023, 05:51:43 am
|
Fairy Cat, New Profitable Blockchain Game
by claude william
March 01, 2023, 11:30:54 pm
|
GameFi - A way out for low-skilled workers
by claude william
February 28, 2023, 11:29:57 pm
|
The History of Gaming — From Pay-to-Play to Play-to-Earn
by claude william
February 27, 2023, 11:50:57 pm
|
Best Blockchain Games
by claude william
February 26, 2023, 11:46:46 pm
|
3 Best Blockchain Games to Invest In 2023
by claude william
February 25, 2023, 11:16:23 pm
|
The History of Gaming — From Pay-to-Play to Play-to-Earn
by claude william
February 24, 2023, 11:57:47 pm
|
Best Play-to-Earn Games with NFTs or Crypto
by claude william
February 24, 2023, 12:04:48 am
|
A few lines of fun writing to IT brothers during Covid
by claude william
February 22, 2023, 11:35:56 pm
|
|
|