Problem with collision + zoom?!

For questions about using Classic.

Post » Fri Apr 04, 2008 8:42 pm

I have made a small example of the problem:

I have a small green 16x16 sprite named "Player" and a 16x1 sprite ("Detector")which is supposed to stop the player sprite from falling when it overlaps something solid. Both sprites are in a family called "Movers".

Detector NOT overlaping solid -> Movers: Set Y to Movers.Y + (80 * TimeDelta)

The layout resolution is 320x240 and it runs in a 640x480 window with 200% Zoom.

The problem is now, that with the zoom, the Player sprite appears to be stuck in the solid ground 1 pixel. However, when you remove the zoom the sprite will be stopped correctly.

Here is the cap:

[url:3gl62ao1]http://www.erikakempf.de/blessing/falltest009.cap[/url:3gl62ao1]
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Apr 04, 2008 9:00 pm

It appears to be correct to me, it's just that the edges are blurred because of the zoom. At least on my screen.



I've had problems with blurred edges on scaled-up sprites and tiled bg's in the past. As a result I've decided that all my future projects will just be 640x480 or higher. It's just too much of a pain dealing with the zoom in that way. There are other problems as well, when you get into parallax and such. I'd rather just scale my sprites up 2x and then import them...
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Apr 04, 2008 9:07 pm

That's weird... here is how it looks for me:



And when I remove the zoom it looks right.

Does anyone else get the same error?

And deadeye, did you try it several times? Cause sometimes it works right with the zoom (very rare though for me), but mostly it doesn't.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Apr 04, 2008 9:42 pm

I tried a few. It always looked the same for me.

But I'm mad that yours looks all crisp. :x I need a new graphics card, dammit :(
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Apr 04, 2008 10:58 pm

Ok PixelRebirth here's the problem, "TimeDelta" its pretty much around 1,3 so it will be innacurate thus going over the solid. Instead use for example:
Detector is not overlapping Solid -> Movers.Y + 1

[url:c1qclj2m]http://www.mediafire.com/?7vnxb9zim5b[/url:c1qclj2m]

Edit: Ow yeah i forgot to tell, it's not a Zoom problem, well if its changing your Frame rate then Zoom is causing the Time Delta to change.
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Fri Apr 04, 2008 11:18 pm

That would mean back to the beginning, since before all movements were just that, X/Y +/- 1.

But I wanted to add TimeDelta so it would run pretty much exactly the same speed on all computers. At least that's the idea I got from reading the article about it.

So am I right that I actually can't use TimeDelta for custom movement engines as it will cause some inaccuracy?!
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Apr 04, 2008 11:27 pm

Ummm i tried the "X/Y +/- 1" style with different FPS and it worked just fine.

Edit:Ok now i get what you want... have to research more at this.

Edit2:
[quote:1fx2gnjd] Drawbacks
This system can cause problems very low framerates. A game running at 5 FPS means a fast-moving object going at 500 pixels per second will be jumping 100 pixels every tick. This can cause problems with collision detection: if the object is small, it is possible it will "step" over an obstacle without registering a collision. Being aware of this can help you design your game to avoid this situation.

* Very thin or small obstacles are more likely to be missed
* If the moving object is large, it is less likely to miss
* Slower moving objects are less likely to miss
* Instant hit bullets with a small enough step will never miss a collision[/quote:1fx2gnjd]

The Drawbacks of Timedelta.
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Fri Apr 04, 2008 11:36 pm

What I understand from the TimeDelta article the issue with different speeds is mainly with the monitor refresh rate. And TimeDelta is meant to fix this.

EDIT:
Okay I just read your edit :>

Anyway, I guess I will be using the "old" engine style then, which is pretty much the same I used for years with MMF.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Apr 04, 2008 11:57 pm

You can keep on using timedelta, just make a "push-up" loop to get your objects unstuck.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Apr 05, 2008 1:36 am

Ok made with deadeye suggestion with "push-up" , its working not good at 1~25 fps, but on everything else its good.
[url:hhqi2mpg]http://www.mediafire.com/?hwd0dhmnccl[/url:hhqi2mpg]
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests