• Announcements

Archived

This topic is now archived and is closed to further replies.

help : smooth motion when speed is slow

Recommended Posts

wonyee    122
hi, i'm making a pool game, and got a problem. when a ball's speed is very slow, the ball seem to move in an odd fasion. For example, when the ball's speed is 0.5 pixel per second, u'll see the ball stops for 2 seconds , and *jump* 1 pixel , and stop for 2 seconds again, and *jump* again. when the direction of the speed vector is nearly horizontal ( but now horizontal), the motion will be more funny. the ball will stop for a while , and then move right( suppose the speed vector directs to up-right), and stop again, and move right again. but some time later, it'll jump *up-right*, because the direction is not straight to right, and so the path of the ball is zigzag.(like below)
                                 _____________________
__________________|
_____________|

i've tried a method that draw the ball two times. for example, the ball is moving from (0.0, 0.0) to (0.2, 0.0). firstly i draw the ball in (0, 0) without transparency. then, i draw the ball again, in (1, 0), with 20% transparency. but it's no use... please help if u know how to SMOOTH THE MOTION, and thanks in advance ! [edited by - wonyee on August 13, 2003 4:04:10 AM]

Share on other sites
superpig    1825
Mmmh, you need sub-pixel accuracy methinks.

If you''re trying to draw a pixel at (0.4, 1) then you''d color both pixels (0,1) and (1,1), with (0,1) getting 60% of the color and (1,1) getting 40% of the color.

As the pixel (or collection of pixels) move from one to the next, it''ll ''fade'' positions, thus seeming smoother.

In theory, at least.

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4

Share on other sites
wonyee    122
that''s what i''ve done before.however, i''m using alpha blending, so after drawing the ball for two times, it still looks transparent...maybe i should try using alternative method that the intersection part should looks opaque.

Share on other sites
Stonicus    157
Why are your pool balls only 1 pixel big?

Share on other sites
Facehat    696
I'd suggest adding a stopping factor for speeds too slow to be noticeable (if the speed is less than a few pixels per second or so you could just stop the ball).

You might also increase the resolution, so that individual pixels aren't as visible.

----------------------------------------
"Before criticizing someone, walk a mile in their shoes.
Then, when you do criticize them, you will be a mile away and have their shoes." -- Deep Thoughts
"If you have any trouble sounding condescending, find a Unix user to show you how it's done." - Scott Adams
FaceHat Software -- Wear the hat.

[edited by - The Senshi on August 13, 2003 3:28:30 PM]

Share on other sites
wonyee    122
i''ve already set a stop factor. but billiards balls are impossible to stop suddenly. so stop fact cannot get rid of low speed...
increasing resolution is useless, i think. in fact, the resolution is already high.

Stonicus: my ball is 20*20 big.

there''s a game named "Cue Club". the billiards in that game can move with a very very slow speed, but the motion still looks very very smooth...admire...

Share on other sites
JohnBolton    1372
quote:
Original post by wonyee
that''s what i''ve done before.however, i''m using alpha blending, so after drawing the ball for two times, it still looks transparent...maybe i should try using alternative method that the intersection part should looks opaque.

This should work:

1. Clear a buffer to black (alpha=0).
2. Draw the centered ball (including alpha) using the appropriate alpha value.
3. Draw the offset ball (including alpha) using the appropriate alpha value with additive blending.
4. Draw the buffer on the screen with standard alpha-blending.

Share on other sites
LuckyNewbie    122
Not that I've tried this or anything... but try having a few trailing "ghost balls" a la "mouse trails", each ball more faded than the next. Just an idea.

I was hoping for a sort of "Out of Context Melee" in this tread with such gems as "you need to make your balls bigger" or "my balls look weird when they move" or "thats why you're balls are clunky-looking," but alas I'll have to look elsewhere :-]

"Let me just ejaculate some ideas"

[edited by - LuckyNewbie on August 17, 2003 11:17:26 AM]