Im wondering the possibility of a 2D physics with friction. The use for it being a billiards game, simple graphics, use different points for striped or solid balls. Friction would seem easiest but what about the collision detection and angles involved, just a thought.
Well, if you hit a wall with angle X between the wall and the ball, then it needs to leave at that angle, with 180-2X in between the start and end angle. I will work on the ball formula later.
this might help
http://tibasicdev.wikidot.com/forum/t-66464/epsilon#post-275019
I made this a while back, and its the best physics engine i could make in pure basic. It was later implemented in my game Peggle. It seems that your ideas of billiards would require multiple object calculation, which is a lot more complicated and slow. ;)
But your right that friction would be easy, as the momentum of the object would be stored in 1 variable, direction in another, and friction could be simulated by subtracting small amounts from the momentum variable.
rebound calculation is fairly easy, figuring out the angle of the think you are hitting, is very VERY difficult. I used pxltesting, but that might not work, depending on what game your making.
In conclusion, unfortunately, true physics eingins are just not possible in BASIC, all we can do is try. :)
complex physics engines aren't possible at a believable rate. eg. A ti-84 might be able to predict tomorrows weather. Unfortunately, it will take until next week to find out the results.
Yeah that's about comparable.
World's fastest computer used for weather calculations has a total (it consists of many, many single CPU's) compute power of 1,000,000 (one million) GHZ and the speed of a TI-84 is 15 MHZ, so it would take around 66,666,667 times as much time… What this IBM-Roadrunner does in one second, would take our calc around 2 years, 5 weeks, 6 days, 11 hours and 46 minutes (yes I calculated this myself).
Talking about useless knowledge…:D
<-|-HJTP-|->
Wow…
Cool.
Someone needs to make a weather predictor for the calculator.
I have an idea :)
input "today's weather",Str1
disp "The weather for tomorow will be",Str1
Chances are that tomorow will be at least a little similar to today!
Hey HJTP, basic wouldnt even have the advantage of 15mhz as the TI-OS has to translate it into assembly with each command correct?
Please check out this link:
And you don't think that they might notice that today's weather is the exact same as tommorows? Hey, I just had an idea for a game I'm making.
Actually, I'm starting to wonder whether a weather predictor is feasible. If weather can be determined by past correlations, then it might be possible if only 20% accurate.
Timothy Foster - @tfAuroratide
Auroratide.com - Go here if you're nerdy like me
Visit Calccrypto for info on crypto
KC2ZOF
Heres an idea for a very simple and very rigid one.
Every time the pixel moves you check a 3x3 grid around the pixel, if it matches with predetermined lists than you change the direction according to the list that it matched up with. In checking a 3x3 area I discerned that there would be 8 possible things to check for. 4 walls, and 4 corners/diagonal walls(they would have a similar pixel arrangement) this of course only gives the pixel 8 directions to move in. Its possible to scale this up to checking a 5x5 pixel area giving many more degrees of reflection. However you can imagine how slow this would be to check every combination. Of course you could render it beforehand.
X holds pixels movement along X axis -1 go left 1 go right 0 nothing
Y holds pixels movement along Y axis -1 go up 1 go down 0 nothing
Every iteration turn the 3x3 area into a temporary list of 9 elements, compare this to the predetermined lists of 11 elements(1 for x, 1 for y) then if theres a match change X and Y
the way i did it, was have 1 pxl-test to see if the next position of the ball is inside a wall, and only if it is, do the 3x3 grid detection.
1Pxl-Test(X+1,Y+1)+
2Pxl-Test(X,Y+1)+
4Pxl-Test(X-1,Y+1)+
8Pxl-Test(X+1,Y)+ -I removed X+0,Y+0 because it is irrelevant.
16Pxl-Test(X-1,Y)+
32Pxl-Test(X+1,Y-1)+
648Pxl-Test(X,Y-1)+
128Pxl-Test(X-1,Y-1)
…would give you a single number representing a unique scenario that could be looked up in a list really fast. Of course, this is a large number of possibilities, so you might need to tune the numbers a bit. In Peggle, i did 4 pxl-Tests and used this look up method to get a fidelity of 45 degrees! ;)