vr anchors and elevators
One of the cornerstones of Tea For God's implementation of impossible spaces is something that I call VR Anchors.
First, let's talk about spaces. For Tea For God I use different reference spaces. I have World Space, Object Space, VR Space.
World Space, also sometimes called Room Space is space that describes a room. The origin point in it is just something arbitrary, completely made up. It is used to tell where everything in a room is.
Object Space tells where everything is in reference to a given object.
VR Space tells where objects are in the real world, in your play area, referred to your real room.
If the game would not have elevators or any moving platforms or vehicles and all rooms would be small, all in-game rooms would match your real-world room. The whole world could actually be generated in a reference to real-world space.
But the game is a bit more complex than that. First, we have elevators that not only go up and down but also to sides and sometimes even rotate. And we have rooms that have multiple doors, although bits of floor that connect doors are separate, ie. it just behaves like there would be separate rooms that see each other.
There was no way to transform from VR Space (real-world) - to World Space (in-game) just like that. That's why I came up with the concept of VR Anchors.
VR Anchors tell where VR Space is placed inside World Space. This is done not per room but per door and also per object. Storing VR Anchor per door makes it easy to place the player in the game's world. But if the player is on a moving platform, VR Anchor for their in-game object should move too. That's why it is (well, might be, as it is only for the player) stored per object.
This means that the player always knows where it is in the real world and where the real world is in the game world and can easily transform between the two.
The idea was that if the player is on a moving platform, VR Anchor should move just like the moving platform. This required some extra stuff, locking the player to the platform etc.
What's more, VR Anchor helps to tell where eyes (headset) and hands are in the game world.
All simple and easy, right? Right.
But there's one thing that complicates this a bit.
The player has to be also represented by a game object that has to have its place in the game world. So the enemies could shoot at it etc. And for elevators to detect that the player is inside them.
One but that was there in the game a long time ago was that the elevators were not working if the player was pushing buttons. After quite a long investigation I noticed that this was happening if something exploded near the player. VR Anchor was forcing the eyes to be at a proper level but the actual object representing the player was high above. It was following the headset horizontally but there was no mechanism to move it vertically other than impulses from explosions. This was fixed by telling the player to move towards the proper location, at VR Anchor level. And by disabling impulses as well.
But then, I added something new. Because I didn't want to force the player to stop when they would hit a wall and deal with the consequences of that, I decided that the object follows the player. I introduced a mechanism that may (or may not if you don't want to) prevent going through walls. If the player would somehow ends up on the other side of the wall, they could not move back, unless it never happened, right? That's why I added an extra check that was always there to trace through the world to see if the current movement would end up bringing the player to the other side of the wall. And... it could still happen.
Enter elevators, with the movement of VR Anchor. There were lots of small bugs that when combined together could lock the player's object outside the world and prevent going through any door. Most of the time this wouldn't happen if the player was walking slowly and confidently, was stopping at the elevator before pressing buttons and would move out only if the elevator stopped. This basically would be happening not so often as if the player is running away from the enemies, trying to get to an energy dispenser quickly or is speedrunning.
In the end, I decided to have a very simple mechanism that was meant to replace all the others. Right now, each elevator has something I call "safe volume". It is used to keep the player's object within an area on a moving platform of any sort. This is an extremely simple solution. Solved all the problems.
That's what I thought.
Because do to an incorrect setup, some elevators were able to push the player below the ground. When I noticed this, my first thought was "you gotta be kidding me". There was this elegant and simple solution that would always work unless it was incorrectly set up. And lo behold, it luckily was.
And now - why did I do all of that?
I didn't want to have a physical player object moving through the world as it could introduce some unwanted vertical movement. Or behaving badly on elevators. Or even worse, being able to leave the elevator mid-way through. What should happen then? Should you fall? Stay in the air?
I wanted to force the player to remain in the elevator to prevent such issues.
Yes, I got some bugs on the way. But now I have a quite easy-to-explain solution and understand (Vr Anchor tells where the real-world space is in the game world, moves with moving platforms, moving platforms lock the player on them, player's game object follows the headset horizontally while keeping an object at VR Anchor's level and if it is possible that something may break, force the object to remain within a safe boundary) that works.
And I hope that this time for good.
Get Tea For God
Tea For God
vr roguelite using impossible spaces / euclidean orbifold
Status | In development |
Author | void room |
Genre | Shooter |
Tags | euclidean-orbifold, impossible-spaces, Oculus Quest, Oculus Rift, Procedural Generation, Roguelite, Virtual Reality (VR) |
Languages | English |
More posts
- performance of a custom engine on a standalone vr headsetMar 27, 2023
- "Beneath", health system and AI changesFeb 16, 2023
- v 0.8.0 new difficulty setup, experience mode, new font, performance updateDec 15, 2022
- performanceDec 02, 2022
- getting ready for demo udpate, scourer improvementsNov 15, 2022
- new difficulty + insight upgradeOct 31, 2022
- release delayOct 20, 2022
- loading times and early optimisationOct 17, 2022
Comments
Log in with itch.io to leave a comment.
Love the good work! Keep it up. I'm really excited to see where this game leads in the future :)