Gravitation in Games

Discussions about the look and feel of Orxonox.

Moderator: PPS-Leaders

Post Reply
User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Gravitation in Games

Post by beni » Wed May 06, 2009 8:05 am

I just recently watched a game review of "Riddick: Assault on Dark Athena" where they have a funny thing called the "gravity generator" room. In there all things which are not fixed on the ground fly into the middle of the room. But have a look for yourself.

This is rather for entertainment, but I think we should also note this for future development as an interesting level design possibility and a motivation to get more involved with our physics engine, which frankly at the moment isn't used as much.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
1337
Baron Vladimir Harkonnen
Posts: 521
Joined: Wed Oct 10, 2007 7:59 am

Re: Gravitation in Games

Post by 1337 » Wed May 06, 2009 12:01 pm

Sounds cool!
You'd have to do the gravity physics yourself though, but it's not very difficult I can imagine.
We might be able to do it with a trigger object because triggers can act on WorldEntities, right? And all the required physics stuff for gravity is in the WE as well.
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Re: Gravitation in Games

Post by beni » Wed May 06, 2009 12:27 pm

Exactly. Should be easy. However: Those triggers are still quite complicated to use. We use triggers for all kind of stuff at the moment: For instance gravity fields and it's more a hack than an actual solution.
What we need is something like those zones, which activate a trigger if they collide (for any collision detection we could use bullet, also for the already existing trigger). So the trigger would get a bullet ghost object and if a certain target collides with that ghost object of any form, it'll trigger an event. That's my idea of the future of the triggers.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
1337
Baron Vladimir Harkonnen
Posts: 521
Joined: Wed Oct 10, 2007 7:59 am

Re: Gravitation in Games

Post by 1337 » Wed May 06, 2009 12:31 pm

yeap, Bullet ghost objects will be our friends. It shouldn't be much of a deal.
There's another benefit as well: The Microsoft compiler implements the dynamic_cast unspeakably bad and uses I believe 80% of a fully loaded dedicated server for iterating over the WEs in the triggers...
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: Gravitation in Games

Post by x3n » Wed May 06, 2009 11:08 pm

No, triggers aren't the right approach for this. A trigger has a state and this state is based on the players actions. So the player has an effect on the trigger, not the trigger on the player. The trigger is an autonomous object which is able to fire an event and can therefore interact with other objects, but this interaction is based on the triggers state and not on the players that activated the trigger.

As a result of this, if the trigger releases an event (= gets triggered), you can't tell why this happened, you can just tell THAT it happened. Of course with some pretty nasty stuff (~PlayerTrigger) you can store the player that triggered the trigger first, but a) there's no way to use this feature/hack in XML (and remember, our trigger/event-system was mainly developed for XML, because in C++ there are plenty of other ways to connect objects), b) it will fail if there is more than one player in the range of the trigger and c) this is not even close to be a generic solution, so if you somehow get it to work with a player, it won't work with a barrel or whatever.

The solution to our problem are zones. Zones don't have a state and don't fire events, they affect the objects within their range. Of course, if it comes down to implementation, you will have some pretty obvious similarities between DistanceTriggers and Zones, but remember, a DistanceTrigger is just one of several trigger types and you really shouln't abuse the trigger concept to act like a zone, just because parts of your code look similar.

To reduce the redundancy between those two classes, we should remove the DistanceTrigger as soon as we have zones and replace it by a ZoneTrigger which gets triggered if the assigned zone is active (~if players are in it's range). With this replacement we will even win in terms of modularity and generality instead of ruining a nice concept and creating some XML-unfriendly hacks.
Fabian 'x3n' Landau, Orxonox developer

User avatar
1337
Baron Vladimir Harkonnen
Posts: 521
Joined: Wed Oct 10, 2007 7:59 am

Re: Gravitation in Games

Post by 1337 » Thu May 07, 2009 6:33 am

Actually, I was thinking about something like Zones. But since I didn't exactly know what a trigger is in our framework (thanks btw for the nice explanation) I simply chose that ;)
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Re: Gravitation in Games

Post by beni » Thu May 07, 2009 8:58 am

Your right. It's too hacky to use triggers for that. It won't work on several occasions and situations. And I guess, calling it a DistanceTrigger after the changes does not do it justice, so ZoneTrigger is okay with me.

So we need the zones ;-). Where the ghost object is our friend I guess. The collision will just result in something else than obstruction, but rather an effect (like slowing down, doing damage etc.) we can define before hand. And this'll be totally XML friendly.
"I'm Commander Shepard and this is my favorite forum on the internet."

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests