Games like prey open whole new level of gameplay

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
benny53
Posts: 131
Joined: Fri May 26, 2006 10:21 pm
Location: Ohio

Games like prey open whole new level of gameplay

Post by benny53 »

Ok,so I just recently finished playing through Prey,and it really got me thinking. Through that whole game,I was wondering how they achieved the effects they did. Some were more clear than others. The portals I found out relatively quickly. I mean,its obvious they are using textured quads,especially when,its either them or some people from valve,said thats what they did. But the one thing that really makes me wonder is the physics with the player and the gravity floor,and the gravity switches. Now,it doesn't honestly make sense of how they could do that.

On top of that,the player can enter portals that lead to upside down rooms where physics still has gravity in a certain direction,and the player will turn to the direction of gravity mid-air. When thinking about it,I considered having six points around a rigid body,in which the rigid body was equal size all around. That way, you could simply find which direction the player is in,and then get the new direction of gravity,then smoothly transition the camera to the specified node on the rigid body.

But with that being said, with rigid bodies and "normal" physics engines, you tend not to be able to have rigid bodies being attracted to certain materials or whatever. So this made me think,maybe they are using some kind of joint that only exists when certain qualities are met in the game. As in, if the gravity platform is turned on,if the player is actually on it,and the players "node" is 180 degrees from the floor. It would also need to let you jump,so I'm assuming the joint would then be destroyed.

With the portals, how would you be able to just simply shoot bullets through,or like in Nebecular Drop(the portal game to set it all of really), the camera,if in tps mode,can actually go through portals,and collide with walls on that side as well. It really makes you wonder. Or not. Feedback would be great. I'm trying to get these ideas set so I can create a semi-advanced physics engine. By that I mean,not your run of the mill physics engines,but as in animated ragdolls(there are papers on this for ODE,I just forget atm what the paper was called),advanced material options(such as the sticking to walls and all that sort of stuff). Many of my ideas were brought upon from the games Prey, Portal, and then the Havok meets endorphine physics engine,which is being used by Lucas Arts to develop a new starwars game.

So,how accurate do you think my observations are to being true? These are some of the only logical explanations I have.
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

You have to remember that Prey uses the Doom3 engine. Most likely, the gravity walkways and mini-planets are simple trigger entities, or they have an trigger entity that defines gravity overall in every room. All you have to do then, is test if the player is within the bounds of the trigger, and change the gravity direction to whatever is set in the corresponding key-value pair. A lot of physics engines let you set gravity to a vector, so that part is easy. All you'd need to do after that is check to see if the camera is upside down, and flip it to be right side up with the new gravity (which is the opposite of the gravity vector). I don't see a reason for a custom joint :)

Generally speaking, with quake based engines, the programmer tries to hand off as much of the work to the level designer as possible. Let the level designer worry about how far off the platform the player needs to jump to stop being affected by the gravity, and just code it to switch if the gravity ends up changing.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

It's very easy to shoot and move things through portals. You just do collision detection and then when something (bullet or player) collides with the portal you then move it to the place where the portal is rendering from and let it continue from there.

With the differeing gravity in different rooms, it doesn't seem that complicated to me, it seems like you could just have a flag or something saying two rooms have different gravity and then you'd know if you have to make any changes to the player's orientation.
Image Image Image
benny53
Posts: 131
Joined: Fri May 26, 2006 10:21 pm
Location: Ohio

Post by benny53 »

@ Dark_Kilauea - You have a good point with the gravity. Seeing as I'll most likely use newton, which makes you apply gravity to rigid bodies,then you just apply the different gravity on different objects.

@ JP - Yeah,thats a good point. With the gravity,I'm thinking you could also do a check to see if the player is in a box(invisible of course),and if he or she is,then apply that boxes gravity to the player. Idk,but I think I know how to achieve these effects. Now all I gotta do is get the portal type stuff from narbecular drop working. But that comes with a paper,so it should be easy enough. Funny thing is,though,that all the portals only use the main camera. It just repositions your camera at the portals exit,renders,then moves the camera back.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

For the camera orientation concerning the gravity changes:
We could do this already in Irrlicht. But the mouse will not be aligned with the camera.

I was able to walk in my level ceiling when I tested this. Each camera as an UPnormal vector. You only have to define that vector for the direction opposite of your gravity. This can be changed at runtime. The camera gravity vector is to be defined also on the camera animator.

The only thing needed is to find a way to convert the mouse coordinate to the UPvector of the camera. My mouse was reversed when I was upside down in my level ceiling.
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

On top of that,the player can enter portals that lead to upside down rooms where physics still has gravity in a certain direction,and the player will turn to the direction of gravity mid-air. When thinking about it,I considered having six points around a rigid body,in which the rigid body was equal size all around. That way, you could simply find which direction the player is in,and then get the new direction of gravity,then smoothly transition the camera to the specified node on the rigid body.

But with that being said, with rigid bodies and "normal" physics engines, you tend not to be able to have rigid bodies being attracted to certain materials or whatever. So this made me think,maybe they are using some kind of joint that only exists when certain qualities are met in the game. As in, if the gravity platform is turned on,if the player is actually on it,and the players "node" is 180 degrees from the floor. It would also need to let you jump,so I'm assuming the joint would then be destroyed

Gravity is just a force
(0,-9.8,0)

before physics are applied all forces (linear that is) are added together, it doesnt matter what the force is.

You could make a game with (0,0,0) gravity then apply (0,-9.8,0) or any other vector, attractive objects simply work using a vector that pulls the object towards the attractive one:

force = normalize(attractiveobjectpos - affect objectpos) *strength* object mass*1/distance^2
then apply the force to the object. (this equation is simplified from a more complex one)

this doesn't require any modifications to normal physics engines

jumping is a movement opposite to the floor normal, physics engines support ray casting that will get you this normal, apply a force = normal *-1 to jump

rotating cameras for portals with different gravities works by setting a low center of gravity for the rigid body that dictates camera movement.
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
zeno60
Posts: 342
Joined: Sun May 21, 2006 2:48 am
Location: NC, USA
Contact:

Post by zeno60 »

benny53 wrote:@ Dark_Kilauea - You have a good point with the gravity. Seeing as I'll most likely use newton, which makes you apply gravity to rigid bodies,then you just apply the different gravity on different objects.
http://www.newtongamedynamics.com/forum ... php?t=3891 This Newton user has been experimenting with some of these prey-like topics.
agi_shi
Posts: 122
Joined: Mon Feb 26, 2007 12:46 am

Post by agi_shi »

zeno60 wrote:
benny53 wrote:@ Dark_Kilauea - You have a good point with the gravity. Seeing as I'll most likely use newton, which makes you apply gravity to rigid bodies,then you just apply the different gravity on different objects.
http://www.newtongamedynamics.com/forum ... php?t=3891 This Newton user has been experimenting with some of these prey-like topics.
The forum is down it seems, but that wouldn't be me, would it? Because Newton is awesome for Prey-like stuff (and, yes, I've been doing loads of those things).

Videos of accomplished Prey-things:
Portals - http://www.youtube.com/watch?v=cld_wZv0DBc
Gravity Flipping (in this little video I just did a gravity flip to whatever direction the camera was pointing) - http://video.google.com/videoplay?docid ... 2475345029 and http://www.youtube.com/watch?v=4ND1dmVfFMY
etc., etc. Look under "More User Videos" or whatever it was called.

(sorry, yes, I'm using Ogre - but this topic seems to be more about the physics of things, of which I am indeed using Newton and can relate)
agi_shi
Posts: 122
Joined: Mon Feb 26, 2007 12:46 am

Post by agi_shi »

Now that I've fully implemented all kinds of physics stuff, including portals, but not restricting to "portals on walls" (like in Portal/Narbacular Drop), allowing movable portals (where you can just pick it up, throw it, etc., just like a normal object), I would like to clarify some things:

- Prey uses the stencil buffer to render the portals. It's a volume portal technique that I use as well, Portal, IIRC, does not use a volume portal. It does, however, use the stencil buffer, as well.
- Things are not as simple as "if something collides with a portal, move it". Definitely not that simple.
- The Narbacular Drop paper does not do a very good job on the portal descriptions.
- Gravity flipping is easy, having the player correctly orientated at all times is not. Commercial games (and my game) do not just move and use a simple camera. It's not a "oh, look, gravity just changed - just rotate the camera 180 degrees" type of thing.
miha
Posts: 32
Joined: Tue Jun 26, 2007 9:27 pm
Location: Serbia

...

Post by miha »

As Dark_Kilauea said, they most probably used bounding volumes.
With these you can split your level/room geometry in a lot of different
areas. Say you declare 6 types of bounding volumes. Each represents
a space with some different rules. Gravity, damage level, and some other
possibilities which are countless.
You could f.e. set a generic name for each type of volume. Say BV1, BV2...
When you test which type of bounding volume player collides, you check the
node name, if it's f.e. BV2, you set all parameters to appropriate values,
and if no volume is colided, you set parameters to default, normal, however.
This all should be tested not in every frame, if miliseconds are not of utmost
importance in that type of game.
Bounding volumes are used pretty much from 1996/7 to now. For ex. one
of the most famous BV uses are fixed cameras in Resident Evil 1,2,3.
Also Serious Sam 1 (maybe 2 too) uses BVs a lot (so i heard).
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

Check out his latest progress
http://www.youtube.com/watch?v=OtO0jLN-4yo
Joe_Oliveri
Posts: 448
Joined: Tue Oct 05, 2004 3:24 am
Location: Boston, MA

Post by Joe_Oliveri »

Now that's cool, good job on it. :D
Irrlicht Moderator || Game Designer
Learn the basics at </dream.in.code>
miha
Posts: 32
Joined: Tue Jun 26, 2007 9:27 pm
Location: Serbia

...

Post by miha »

That is great implementation alright.
I would like to see the code behind that.
agi_shi
Posts: 122
Joined: Mon Feb 26, 2007 12:46 am

Post by agi_shi »

Heh. Thanks, guys ;)

But that is not my latest stuff.

Movable portals (v0.24): http://www.youtube.com/watch?v=KHiNjLba ... re=related
Stuff colliding with itself (v0.30+):
http://www.youtube.com/watch?v=JwL-nTODl2E&feature=user

Currently at version 0.35. If any of you wan to try my portal implementation, there will be a demo (with a full story and what-not, and nice graphics: http://www.youtube.com/watch?v=rsD7AqVT ... re=related) at version 0.5.

And, sorry, you can't look at my source. It's closed source ;). But I'll be writing up a good paper on it, so, yeah. Just not soon. First I must finish 0.5.
Post Reply