I'm overriding Timedelta, and it... seems good.

Post your own tutorials, guides and demos.

Post » Tue Dec 30, 2008 2:41 am

I'm making a game that uses a lot of small physics objects as a controllable swarm. If the framerate goes down (eg, on older computers), the physics seems to get less accurate, and a lot of things clip through each other. I'm using TimeDelta in events that apply force to the swarm, but that doesn't make much difference.

If I use override TimeDelta, the game slows down to cope with the load and the physics works perfectly. A bit of slowdown in this type of game won't cause problems or make the game unfair. I don't see any graphics problems so far.

So... can I use override Timedelta under these circumstances, or will it cause other problems in the long run? I'm willing to sacrifice the ability to scale time.

Are there any alternative ways to keep the physics accurate?

Link to .cap: http://www.mediafire.com/?tdzzvpdjjwj
B
5
S
2
G
4
Posts: 113
Reputation: 2,101

Post » Tue Dec 30, 2008 3:03 am

i just have to say that you have a very novel game idea here and i'm looking forward to seeing more :)
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Tue Dec 30, 2008 6:24 am

Thanks for the feedback!

I came up with the swarm idea by accident (it started out as smoke in a completely different physics-based game, but the smoke became more fun than the core gameplay). I'm hoping to make a sort of exploration/puzzle game, with an underlying sci-fi plot - I'll put it up when I have a few levels done.
B
5
S
2
G
4
Posts: 113
Reputation: 2,101

Post » Tue Dec 30, 2008 11:15 am

overriding time delta will destroy the very fabrics of this universe!
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Tue Dec 30, 2008 12:16 pm

Na overwriting timedelta shouldn't have much of a side effect, except how fast it runs on peoples computer. btw this game is really awesome!
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Tue Dec 30, 2008 12:43 pm

That's a really cool game concept, I hope you work on it more :).
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Tue Dec 30, 2008 3:34 pm

You can use 'Override Timedelta', but be aware of what it does.

TimeDelta is the time between two frames at runtime, and is measured very accurately. This is used to move objects so they move at the same speed no matter what the framerate is. The problem is if the framerate drops a lot, TimeDelta (the time between frames) becomes large, and Physics can be unstable when TimeDelta is large, because objects are often jumping large distances instead of moving smoothly, so objects can end up inside each other etc.

Overriding TimeDelta makes it always return the same value, so even at low framerates, objects are basically moving the same distance every frame. This means the entire game slows down if the framerate drops. It also means if you're V-Synced (and you should be) then your game runs twice as fast on a 120Hz monitor as opposed to a 60Hz monitor. If you're happy to accept this, then overriding timedelta is a good way to keep your physics stable.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Dec 31, 2008 7:27 am

Okay, thanks Ashley! The issue with 120hz monitors wouldn't destroy the fabric of the universe, I think. I'll see how demanding the game ends up being; maybe I won't need TD override after all. :)
B
5
S
2
G
4
Posts: 113
Reputation: 2,101

Post » Wed Dec 31, 2008 3:00 pm

now that was a fun game :)
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Wed Dec 31, 2008 6:51 pm

Wow, that's really sweet :). Nice, simple use of physics, but the gameplay is all the better for it.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest