Problems with physics and huge universe

Post your own tutorials, guides and demos.

Post » Tue Dec 02, 2008 11:03 pm

I created this game with ridiculously big universe, with diameter of about 2*2^30 pizels (= 2 147 483 648 pixels) and applied a physics behaviour. However, the block the player is controlling, stops and begins to ignore player's commands when it's taken too far, about 20 000 pixels from the starting point. And it's NOT far, at least compared to the hugeness of the universe (and yes, those stars have physics also, and the furthest ones are over two BILLIONS of pixels away, still not causing problems [is it 'cause they don't move?])

Is it a bug with physics? Or just a restricment of the possible world size?
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Tue Dec 02, 2008 11:18 pm

Wow, I've never seen such a big game universe!

Yeah, the physics behavior has a finite world size. The Box2D docs don't make it clear the purpose of the world bounding box - it's just been made as large as reasonably would be expected to be useful, which does seem to end about 20,000 by 20,000. It vaguely mentions it might improve performance to use a smaller bounding box, but I don't know why. What you want is effectively an unlimited physics world size anyway - I'm not sure that's possible with existing physics engines.

You might be able to get some mileage by changing the world x/y scale (either make it really huge, or really small, I forget which). Apart from that, I think you're pushing beyond the limits of a physics engine. I don't think they're designed to span billions of pixels.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,564

Post » Tue Dec 02, 2008 11:32 pm

Well, I'll have to make a custom engine then :I. The game type doesn't definitely need complex physics... The cube has have angular and linear velocity and I'm planning that the planets pull the cube with gravitational forces, but not each other. Nothing more than that. Or, well... I might try some kind of coarse gravitation map people talked about in some thread. Besides that, the most hardest part will be the collision with planet's surface. We'll see.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Wed Dec 03, 2008 11:37 am

Well at least you know where its own private universe ends. I'm guessing you could add some code to extend it from there. Its interesting this kind of of reminds me of a show I saw that talked about whether or not the universe is shrinking or expanding. Any way it was like its hard to tell because gravity is not a constant throughout the universe. More like pockets of gravity, with some other force that's been dubbed dark energy, or dark matter.
Perhaps you could use something similar, by using different layouts.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Fri Dec 05, 2008 5:22 pm

Okay, I got rid of the problems!

I implemented my own physics. You should be able to travel everywhere in the universe, though I noticed that the game experience gets worse in the edges of the universe, it's probably hitting the boundaries of the float numbers accuarcy. BUT, you won't be in the edge of the universe in a while, since it's so friggin' huge. I'm thinking of creating a game on this engine, but I need still the concept and ideas...

Tell me how far did you get :D
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Sun Dec 07, 2008 10:10 pm

Oh, sorry for the double post. I forgot to tell a protip:

It seems that the controls of the rocket engines are pretty hard. Every key in "QWERASDF" corresponds to one of the rocket engines of the cube. Use W and E to thrust forward. W causes a counterclockwise torque and E a clockwise one. Using them at same time keeps the current angular velocity. And use spacebar! It's the only automatical controller I build there, but it shoud help a lot :D (If this is going to be a game, I guess that I have to make some more automatic features, since manual functioning is so hard)
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Sun Dec 07, 2008 11:50 pm

[quote="Drasa":19bk89w5]I'm thinking of creating a game on this engine, but I need still the concept and ideas...[/quote:19bk89w5]

I think the controls would need a little more polish before you tried turning this into a game. At the moment they seem to be in their most complex form and with a tiny nudge you can send yourself spiralling into a head-ache inducing rotation, the gravity of each star doesn't help with this.

I think that slowing everything right down so it has that slow motion feeling of space, or building up the speed over time from VERY SLOW to what you have now would work a lot smoother. Also if it took a long period of time to build up to the maximum speed it would make the exploration of what is already a huge universe, seem even larger than what it is.

If you need ideas however I'd be happy to try and help you out, purely from a design perspective.
B
2
G
4
Posts: 22
Reputation: 1,094

Post » Mon Dec 08, 2008 12:18 am

It's impressive how big the universe is, but as isyc said, the controls really leave something to be desired. The tiniest tap on a thruster sends you into a death spiral. To get anywhere you need the spacebar held down the entire time.

It also takes FOREVER to turn around and go the other way. I'm thrusting at max and still drifting slowly backwards, backwards, backwards.... okay, finally moving forwards.... inching along... okay now I have some momentum. Maybe it's just because I had to play zoomed out really far to actually see any movement at all and I was just going way too fast.

The speed also makes it hard to navigate in a cluster of stars. At least, I can't.

One key for thrust, one key each for left/right turns, one key for reverse, and one for full-stop I think would be sufficient. I applaud you for trying to come up with a unique control scheme though.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Dec 11, 2008 8:38 am

that's really cool, reminds me of elite 2
Needs some work but awesome cool
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Thu Dec 25, 2008 11:22 pm

Its HUGE cant say anything else...
B
11
S
3
G
4
Posts: 622
Reputation: 3,186

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest