This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Project Releases => Your Projects
Author Message
GloryMXE7
Puzzleman 3000


Active Member


Joined: 02 Nov 2008
Posts: 604

Posted: 28 Nov 2008 02:13:28 pm    Post subject:

i just played insane i got to level 7
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 30 Nov 2008 10:01:50 pm    Post subject:

Nice.

How does the "physics" work? Move up 'x' distance no matter what you hit or how far you fall? ;o

I don't understand physics so thats what i'd do :}
Back to top
bananaman
Indestructible


Calc Guru


Joined: 12 Sep 2005
Posts: 1124

Posted: 30 Nov 2008 10:58:56 pm    Post subject:

I gave the game parabolic motion by giving the tank a velX and velY. Each frame gravity would decrease your velY by one and if you weren't holding and arrow, friction would decrease the magnitude of your velX by one. When you press an arrow you only increase your velX by one, so it takes a few frames for you to start moving. Each pixel is horizontally 4 and vertically 8, this makes it so that you never move more than a few pixels per frame.

When you hit an enemy it sets new x and y velocities dependent upon if you hit the left, right, top, bottom, center of the enemy. The miner of course, gives you a higher velY boost. Bombs max out your velY, except for the homer. I placed a maximum on your velY so that you can't launch to far off the top of the screen.
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 01 Dec 2008 06:08:40 pm    Post subject:

Ah interesting. Shame that I don't understand velociy and stuff like that. :{
Back to top
GloryMXE7
Puzzleman 3000


Active Member


Joined: 02 Nov 2008
Posts: 604

Posted: 01 Dec 2008 07:33:58 pm    Post subject:

velocity is distance traveled over time
acceleration is velocity over time
Back to top
pugboy


Active Member


Joined: 11 Apr 2007
Posts: 544

Posted: 01 Dec 2008 07:35:41 pm    Post subject:

How is it that the last time I remember being here, someone requested this to be made o.O

Amazing work!

EDIT:
And it works perfectly on the NSpire 84+ Mode Very Happy


Last edited by Guest on 01 Dec 2008 08:17:43 pm; edited 1 time in total
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 01 Dec 2008 09:51:48 pm    Post subject:

Quote:
velocity is distance traveled over time
acceleration is velocity over time


I'm taking Calculus and i've learned about the derivatives and crap but it means nothing to me.

So if something is accelerating downwards at 9.8 meters per seconds... Then the displacement is completely screwed up since you'd fall 4.9 meters in one second which doesn't make sense to me.

No idea how to calculate the displacement for anytime, but hey, physics is over rated anyway.

If someone could successfully explain how it all ties up, i'd cry happy tears. Wink
Back to top
Harrierfalcon
The Raptor of Calcs


Super Elite (Last Title)


Joined: 25 Oct 2006
Posts: 2535

Posted: 01 Dec 2008 10:27:58 pm    Post subject:

Acceleration, algebraically defined, is velocity over time, but it'd be better explained as the rate at which the velocity changes. (Yay derivatives--I get to do those next year.)

If something is accelerating downwards at 9.8 meters per second per second, and it starts from rest (0 m/s), its final velocity after 1 second will be 9.8 meters a second. Total displacement, therefore, would logically be somewhere in between 0 and 9.8 m/s, the starting and ending velocities.

If you graphed the velocity over time on an XY plane, it would look kind of like Y=X; that is, it gradually increases in a perfectly straight line, starting at (0,0). Displacement is represented on this graph by how much total area there is in the triangle, if you create said triangle by making a vertical line at a certain time. The vertical line would be on one second, and in that moment in time the velocity is 9.8 m/s, so since it's a triangle the total area is half that of a rectangle with the same base and height--half of 9.8 * 1.

I'm taking AP Physics this year, so I'll whip out a few good ol' kinematic equations.

[1] D = VT + .5AT2
[2] D = .5(V+W)T
[3] W2 = V2 + 2AD

Where D is displacement, V is initial velocity, T is time elapsed, A is acceleration, and W is final velocity.

We know everything but displacement. So...

V = 0
W = 9.8
T = 1
A = 9.8

[1]
D = (0)(1) + .5(9.8)(1)
D = 0 + .5(9.8)
D = 4.9

[2]
D = .5(0 + 9.8)(1)
D = .5(9.8)
D = 4.9

[3]
9.82 = 02 + 2(9.8)D
96.04 = 2(9.8)D
48.02 = (9.8)D
48.02/9.8 = D
4.9 = D

I hope that clears it up.

EDIT: Disabling emoticons every time you edit is a pain in the #$%@.


Last edited by Guest on 01 Dec 2008 10:44:00 pm; edited 1 time in total
Back to top
bananaman
Indestructible


Calc Guru


Joined: 12 Sep 2005
Posts: 1124

Posted: 01 Dec 2008 10:48:32 pm    Post subject:

Flash Example

Our good ol buddy axcho wrote a flash game that represents the relationship between position velocity and acceleration. It may make learning physics a little bit more fun.
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 02 Dec 2008 12:20:07 am    Post subject:

Quote:
[2] D = .5(V+W)T
Where D is displacement, V is initial velocity, T is time elapsed, A is acceleration, and W is final velocity


Huh...

So let's say V = 9.8, W = 19.6 (9.8 m\s\s change)..and that's a 1 sec elapse, then i'd travel 4.9 m.... but mathmatically i should have traveled 14.7 ft from graphing the displacement, which is a 3 second elapse (4.9 * 3 = 14.7)....which makes me ask what is 'T' relative to?

I dunno.

From calc graphin' the displacements should be:
at 1 second = 4.9 ft , 2 second = 19.6, 3 second = 44.1, etc.


Last edited by Guest on 02 Dec 2008 12:21:37 am; edited 1 time in total
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 02 Dec 2008 06:52:30 am    Post subject:

the average of 9,8 and 19,6 is 14,7
the time is 1 s

14,7 * 1 = 14,7



short story long:

avarage * time = distance
Back to top
bananaman
Indestructible


Calc Guru


Joined: 12 Sep 2005
Posts: 1124

Posted: 02 Dec 2008 08:43:57 am    Post subject:

Gravity is a constant acceleration. At all times it increases your velocity at a constant rate. For this reason, we can take the average velocity and multiply it by time to get rid of the per seconds.

When we look at acceleration due to gravity it is constant at -9.8 m/s*s This means that each second your velocity decreases by 9.8m/s. If we were to start at 0 we get this effect...

1 second :: V=0, W=-9.8m/s, avgV=4.9m/s, D=4.9m
2 seconds :: V=0, W=19.6m/s, avgV=9.8m/s, D=19.6m
3 seconds :: V=0, W=29.4m/s, avgV=14.7m/s, D=44.1m

If you notice something about all of these is that we started from the same location. The D, is the displacement from our original position. And the avgV is the average velocity over the entire interval. When you are simulating physics on the calculator you really don't want to keep track of the entire interval that you are in the air. What we do is analyze what happened over the last second.

0-1 seconds :: V=0m/s, W=9.8m/s, avgV=4.9m/s, D=4.9m
1-2 seconds :: V=9.8m/s, W=19.6m/s, avgV=14.7m/s, D=14.7m
2-3 seconds :: V=19.6m/s, W=29.4m/s, avgV=24.5m/s, D=24.5m

These are the numbers that you stumbled upon earlier. They mean the same thing as the first numbers I came across, but they let you forget about your starting time, and initial velocity for the jump. Now they let you remember your velocity from 1 second ago. You can average that with your current velocity and since you traveled for 1 second, your displacement is equal to your average velocity. If you examine both sets of numbers they mean the same thing. (4.9 + 14.7 + 24.5) = 44.1

If you wanted to be really close to real life you could go through all these calculations each frame, but that starts to get pretty intensive when you have lots of objects on the screen. We can simplify things for the calculator. First, we need to break each pixel on the screen into subpixels. This makes our physics more appealing because the character doesn't move more than a few pixels in each frame. Then we assume gravity to have a constant acceleration of 1 sub-pixel per frame per frame. This means that we take our initial velocity for the frame and subtract one every frame to represent gravities pull downwards. We could go ahead and calculate the average velocity without too much work, but let's keep it simple and just assume that your displacement changes the same amount as your current velocity. Add your velocity to your position and then check for new collisions.

Since velocity is a vector, we could represent it with a magnitude and an angle, but then we need trig to update your (x,y) coordinates. We can break velocity down into 2 separate vectors. One for the x-direction and one for the y-direction. Each frame we apply gravity to the y-vector. We may check to see that we don't surpass a terminal velocity. Then we take your x-vector and update it according to the user input. Then we apply some friction or air resistance. You can do this similar to gravity, but don't change it every frame. Maybe every few frames, if you are on the ground, friction reduces your x-velocity, and if you are in the air it takes a few more frames for your x-velocity to be reduced.

Now you may ask, how do we interpret a jump? When you jump, you apply a massive force on the ground, the ground gives the same force back to you and you fly into the air. Once you are in the air, you can no longer give yourself an additional boost unless you hit something. How do we represent this massive force in physics? We increase your characters y-velocity by a large amount. In indestructo tank, I gave you a boost of 22 to your y-velocity when you hit a standard bomb. So, in the first frame after you hit a bomb you traveled up 22 sub-pixels. This translated to 2.75 pixels on the screen. It would take 22 frames for your velocity to decrease to 0 due to gravity. At this point, you would have reached the peak of your jump. And along the way you would have traveled, 22+21+...+1 = 253 subpixels, or 31.625 real pixels. If we were to use real physics, V would be 22, W = 0, avgV=11, and displacement 22frames * 11 subpixels / frame = 242 subpixels or 30.25 real pixels. You notice that by ignoring the average velocity and using the final velocity our distance traveled is slightly different, but you still follow a parabolic path that your mind is used to.

I hope that this cleared up game physics for you a little bit, and didn't confuse you even more. If you want to be confused, go look at sonic. When you jump in sonic you don't move straight up, but rather go perpendicular to the ground. Then you have to get all the collisions right for the different slopes.
Back to top
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 03 Dec 2008 07:11:03 am    Post subject:

I've reviewed the file at ticalc.org, waiting for ticalc staff response.

(good results overall, check it out when it's processed)
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 03 Dec 2008 09:57:19 am    Post subject:

I understood the physics.

That of dividing 1 pixel into many was great. That trick makes the playing much better in a easier implementation.

Offtopic: is impression of mine or ticalc doesn't have things very automated?
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 03 Dec 2008 12:33:24 pm    Post subject:

noting except the voting i think...
Back to top
bananaman
Indestructible


Calc Guru


Joined: 12 Sep 2005
Posts: 1124

Posted: 03 Dec 2008 01:14:19 pm    Post subject:

It is definitely noticed by the fact that they haven't updated any of the screenshots for the last 200 programs submitted to the archives. With the quality (or lack thereof) of most of the programs, it is usually pretty good to look at the screenshots to see if a game is worth downloading. Unfortunately, they haven't even posted my screenshots for IndestructoTank.

Galandros:
I got the idea of dividing pixels from the original sonic games. They actually divided each pixel on the screen into 256 subpixels. I think that is a little bit overkill, so I decided to only use 8 instead of 256.


Last edited by Guest on 03 Dec 2008 01:16:38 pm; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 03 Dec 2008 03:40:37 pm    Post subject:

bananaman wrote:
It is definitely noticed by the fact that they haven't updated any of the screenshots for the last 200 programs submitted to the archives.  With the quality (or lack thereof) of most of the programs, it is usually pretty good to look at the screenshots to see if a game is worth downloading.  Unfortunately, they haven't even posted my screenshots for IndestructoTank.

Galandros:
I got the idea of dividing pixels from the original sonic games.  They actually divided each pixel on the screen into 256 subpixels.  I think that is a little bit overkill, so I decided to only use 8 instead of 256.
[post="129863"]<{POST_SNAPBACK}>[/post]

Actually, that's what I'm doing in my Mario game. Smile The 256 sub-pixels, I mean.
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 03 Dec 2008 03:50:13 pm    Post subject:

actualy, i think that's what everyone is doing

the besic concept is that you have one byte to hold the decimal "pixel"
Back to top
GloryMXE7
Puzzleman 3000


Active Member


Joined: 02 Nov 2008
Posts: 604

Posted: 03 Dec 2008 05:20:13 pm    Post subject:

um how do you split a pixel in the first place any way
Back to top
bananaman
Indestructible


Calc Guru


Joined: 12 Sep 2005
Posts: 1124

Posted: 03 Dec 2008 05:56:25 pm    Post subject:

It's not a physical split of the pixel. It is a theoretical split of the pixel. It means that if my x-velocity is 4 sub-pixels per frame and I start at the position (0,0), at the end of 1 frame I will now be at position (4,0) Since each pixel on the screen is represented by 8 sub-pixels, you won't see any physical change because the character will be at the same pixel. After the 2nd frame you will be at position (8,0). Now you have moved 1 full pixel and when the screen is updated you will see that the character is displayed on the screen at (1,0).

@darkstone:
Wow, I didn't even realize that they did 256 pixels in order to make it act like a fixed decimal point system. I'm really stupid, that would simplify a ton of my math. Oh, well, I guess I can use that if I ever make 2.0
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2, 3  Next
» View previous topic :: View next topic  
Page 2 of 3 » All times are UTC - 5 Hours

 

Advertisement