Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PoC] Elevators
Abion47 Offline
Senior Member

Posts: 349
Threads: 22
Joined: Oct 2015
Reputation: 46
#1
[PoC] Elevators

This seems to be turning into a trend. Here I am extending what I learned about Sequences from the making of the last PoC into making a working elevator.

[Image: ?interpolation=lanczos-none&output-forma...olor=black]
[Image: ?interpolation=lanczos-none&output-forma...olor=black]

As usual, you can grab the map and associated files on the Steam Workshop. EDIT: This and my other PoC mods are now available on MoDDB as well.

An interesting thing I found out about doing elevators is, when I looked at the examples that are in SOMA itself, the few that I could find fell into one of two categories:

  1. The elevator unit itself was stationary while things moved around it, simulating the experience of riding an elevator. When the sequence was complete, the player is teleported to an identical position further along. (Theta)
  2. While the elevator moved, the player had a story-reason to be fixed in place during the entire elevator ride. (Omicron)

The programming behind the second one revealed why all the elevators in SOMA weren't the proper "elevator-unit-moves-with-the-player-inside" option, as in order to get the player to move with the elevator, you have to move them along with the elevator relative to their position in relation to the elevator itself. This has the nasty side-effect of leaving the player unable to move at all during the sequence. What's more, if you simply has the elevator move independently of the player, the player's camera has that weird "fall-then-bob-continuously" quirk that games have where the physics doesn't directly support this kind of action.

So yeah, it will take quite a bit more tinkering as well as some clever physics workarounds to enable that kind of elevator action, so until someone comes up with it (there are games that do it, so the how-to's gotta be out there somewhere), we're stuck with using one of these two categories.
(This post was last modified: 11-14-2015, 05:29 PM by Abion47.)
10-26-2015, 09:42 AM
Find Reply
Romulator Offline
Not Tech Support ;-)

Posts: 3,577
Threads: 61
Joined: Jan 2013
Reputation: 193
#2
RE: [PoC] Elevators

Actually, in a lot of video games, that first option occurs. The same mechanic was used in Amnesia, and is spoken about in the developer commentary about it. Great work! I was going to tackle this issue but procrastination kicked in :p

If you get a moment, could you put up an article about this on the wiki? While your Workshop mod will be beneficial for copy-pasting, some users are unable to access the Workshop. Furthermore, some people may want to learn how sequences work and may learn greater from actually reading and implementing rather than simply looking at code Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 10-26-2015, 11:13 AM by Romulator.)
10-26-2015, 11:11 AM
Find Reply
jens Offline
Frictional Games

Posts: 4,095
Threads: 199
Joined: Apr 2006
Reputation: 202
#3
RE: [PoC] Elevators

Sequences are documented here, https://wiki.frictionalgames.com/hpl3/ga.../sequences
10-26-2015, 11:29 AM
Website Find Reply
Abion47 Offline
Senior Member

Posts: 349
Threads: 22
Joined: Oct 2015
Reputation: 46
#4
RE: [PoC] Elevators

(10-26-2015, 11:11 AM)Modulator Wrote: Actually, in a lot of video games, that first option occurs. The same mechanic was used in Amnesia, and is spoken about in the developer commentary about it. Great work! I was going to tackle this issue but procrastination kicked in :p

Oh for sure. I was only sort of surprised to find out that was the case. I do know that some 3D games have the capability to be on a platform that is actually moving and still retain full motion, but they generally appear to be the exception rather than the rule, and I'd imagine those games have customized physics engines in order to do so.

I mean, it doesn't sound like it would be difficult in theory. Just have it so that when your character is standing on a platform, when that platform enters motion, have the player's character body lock its local transforms to be in reference to the platform rather than the world as a whole, then perform input and velocities with the new reference in mind. But I guess that if that were so easy, then there would be a whole lot more games doing it. Tongue

(10-26-2015, 11:11 AM)Modulator Wrote: If you get a moment, could you put up an article about this on the wiki? While your Workshop mod will be beneficial for copy-pasting, some users are unable to access the Workshop. Furthermore, some people may want to learn how sequences work and may learn greater from actually reading and implementing rather than simply looking at code Smile

Yeah, as jens posted, Sequences already have a fairly comprehensive page detailing their usage. The only thing it could really benefit from is a practical example of their application, and I've put up two of them now. Tongue
10-26-2015, 11:57 AM
Find Reply
Romulator Offline
Not Tech Support ;-)

Posts: 3,577
Threads: 61
Joined: Jan 2013
Reputation: 193
#5
RE: [PoC] Elevators

Ahh yes, I keep forgetting that there is more than just the Community section of the wiki, which is quite lazy of myself to do so x)

Discord: Romulator#0001
[Image: 3f6f01a904.png]
10-26-2015, 12:59 PM
Find Reply
Apjjm Offline
Is easy to say

Posts: 495
Threads: 18
Joined: Apr 2011
Reputation: 51
#6
RE: [PoC] Elevators

One thing you could do is work out of the position of the player relative to some point of the elevator at the start of the elevator. Then, teleport the player's body to an area of the map which is identical to the elevator the player is in for the duration of the elevator ride.
However, instead of putting the camera on the player's head, use the player's offset from the off map position and the offset from the elevator initially to place the camera where the player would be if he was in the elevator.
Then at the end, just set the position of the player to where it should be given the camera's current position. That way you don't need to move the map around the elevator, you can simply move the elevator and update the camera once a frame for the duration of the ride.

Portal 2 used this approach for the opening sequence in the stasis room with it crashing into stuff iirc.
(This post was last modified: 10-27-2015, 06:21 PM by Apjjm.)
10-27-2015, 06:20 PM
Find Reply
Abion47 Offline
Senior Member

Posts: 349
Threads: 22
Joined: Oct 2015
Reputation: 46
#7
RE: [PoC] Elevators

That is the exact approach used in the second category I talked about above. In fact, there are a couple of Entity functions available in the HPL3 API to enable that kind of behavior. First is the Entity_GetDeltaToEntity function, which gets the offset of one entity relative to another in the form of a cVector3f. Then an overloaded version of the Entity_PlaceAtEntity function allows using that offset to move an entity to a position that would put it at the same relative offset. It's implemented in the way that, at the start of the Sequence step where the elevator is triggered to move, the delta is calculated between the player and the elevator, then during each Update step, that delta is used to put the player in the same position relative to the elevator.

And that's the approach that has the side-effect of overriding player input in such a way that during the elevator ride all they can do is look around, which is why during the times in SOMA that used this approach, the player was given a story-based reason to not be able to move. (e.g. Being strapped into the chair during the descent into the abyss.)

I suspect there might be a way to achieve player motion during the elevator ride, but it would involve changing up the logic behind handling player input, which for my PoC maps wasn't something I wanted to mess with, but might be something I look into later down the line. (And I haven't had a thorough look into the files that handle regular movement yet, so for all I know that part of the code might be locked behind the API wall.)
10-27-2015, 11:08 PM
Find Reply




Users browsing this thread: 1 Guest(s)