[{"content":{"text":"I Expect You To Die<\/em><\/a> (IEYTD) is Schell Games' VR, escape-the-room puzzle game in which you step into the shoes of a super spy with telekinetic powers.<\/p>This blog, originally published in 2017, has been republished in an effort to highlight our engineering team, and preserve the work they did in tackling key challenges in VR to create a unique and immersive world of espionage. The love they put into this game is a huge reason this game is still so celebrated today and has spawned multiple sequels.<\/em><\/p>"},"id":"d3c4ce7f-f14c-4a89-aea4-6f21bfd87c1d","isHidden":false,"type":"textBlock"},{"content":{"level":"h2","text":"Hands of a Super Spy<\/strong>","customid":""},"id":"2b10e629-5373-4c29-95bd-cc84d834eb6f","isHidden":false,"type":"headingBlock"},{"content":{"text":"One of the biggest feature changes for IEYTD since the release of the original Oculus Share demo was the integration of hands. Hand controls now feel inherently tied to the game, but IEYTD was originally built for the mouse only. <\/p>However, after the Dev team got the first Oculus Touch hardware and did some early prototypes, they were convinced that hand controls were how the game was meant to be played. It made the players feel more powerful and elevated their sense of presence.<\/p>"},"id":"41dfbc4f-b6b0-4e53-b7e8-4a45f73dbb06","isHidden":false,"type":"textBlock"},{"content":{"level":"h3","text":"Transitioning to Hands<\/strong>","customid":""},"id":"bbc3618b-dd64-4392-b844-08ff7f8c930c","isHidden":false,"type":"headingBlock"},{"content":{"text":"In IEYTD, the core idea is that the player interacts with objects in the environment to solve puzzles. With the mouse, you are constantly using telekinesis, during which you can aim at objects using a reticle and interact with them. This mode allows players to interact with objects that are farther away from them. <\/p>As the Dev team transitioned to hands, it was important that the player didn't lose this ability, but at the same time, we wanted players to experience the beauty of holding and manipulating objects in VR. As a result, we came up with two modes for hands: Local Grab Mode and Telekinesis (TK) Mode.<\/p>"},"id":"6862d99d-3232-488a-8f43-453631720fcd","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/ny1lxzc6gax9sygc"],"src":"","alt":"Gif of a player tossing up and catching flare guns then shooting them around an office","caption":"Do not try this at home","link":"","ratio":"","crop":"false"},"id":"e9208e88-ff3f-4fbc-b7e7-e22d63bd33f4","isHidden":false,"type":"imageBlock"},{"content":{"level":"h3","text":"Local Grab Mode<\/strong>","customid":""},"id":"c7f70ea3-3fae-4540-a297-03a661a9d5fe","isHidden":false,"type":"headingBlock"},{"content":{"text":"The ability to grab objects using virtual hands is a powerful experience and supporting this mechanic was crucial to IEYTD\u2019s gameplay. In the game, the player\u2019s virtual hands are represented as a pair of spy gloves along with animations to show different hand poses. In this mode, when the player grabs an object, the hands fade out completely. This is done for a couple of reasons. <\/p>The first, and more obvious reason, is scope. There are a large variety of objects that can be picked up and manipulated in IEYTD. Therefore, creating a unique animation and grab pose for each of them was not feasible. Secondly, the way objects are held varied based on the person and the context in which they were being used.<\/p>"},"id":"2c2e6260-c6ba-41f1-8e28-032f92088606","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/fvrlxhj3lci1y6ze"],"src":"","alt":"Gif of a VR player grbabbing a cigar, putting it in their mouth and lighting it ","caption":"Object gets grabbed. Hands fade out.","link":"","ratio":"","crop":"false"},"id":"55517b1f-4cff-4912-818f-1f31a76eb957","isHidden":false,"type":"imageBlock"},{"content":{"text":"As the player\u2019s hands explore the environment, the objects that are \u201cgrabbable\u201d become highlighted. We predict this with the help of a trigger volume and a raycast from the player\u2019s head to their hand. The trigger volume helps maintain a list of grabbable candidates and the raycast helps us select the object that is closest to the player\u2019s head. The assumption we make here is that the grabbable candidate that is closest to the player\u2019s head, is the one that is most likely to be interacted with.<\/p>"},"id":"d0cdd206-0b48-4730-b32a-9b08d7c35b4c","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/5q7os7nlig0kkk0n"],"src":"","alt":"Illustration of the use of raycasting to show how objects are made grabbable in IEYTD","caption":"","link":"","ratio":"","crop":"false"},"id":"8cf2023e-8882-4497-88c5-023777ab9524","isHidden":false,"type":"imageBlock"},{"content":{"level":"h3","text":"Telekinesis (TK) Mode<\/strong>","customid":""},"id":"5868ecb3-6899-4768-98b5-0ab3f1fe475f","isHidden":false,"type":"headingBlock"},{"content":{"text":"The TK mode is our solution to allow players to interact with objects that are not within their reach, allowing our puzzles to be more flexible and making it possible to create more diverse environments. It also solidifies the game\u2019s super spy theme because it adds an additional \u201cspy-like\u201d element to the players\u2019 arsenal of tools.<\/p>"},"id":"fb003ca9-4e1d-4151-ba1e-5775220d26ec","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/eabhmlunspgxrhhz"],"src":"","alt":"IEYTD player in VR using telekines to grab two far away books and bring them to their hands","caption":"Objects out of reach? It's TK time!","link":"","ratio":"","crop":"false"},"id":"10905a6d-65dd-4959-9708-b2b33238c4d1","isHidden":false,"type":"imageBlock"},{"content":{"text":"For TK mode, our goal was to translate the reticle based on interaction from the mouse controls to the hands. To achieve this, we parent a reticle to each hand and assign it a forward vector. The reticle is then positioned in 3D space along this vector using a raycast against the level\u2019s collision geometry. This implementation worked in most cases; however, there were a couple of undesirable consequences.<\/p>The first one was that the reticle moved considerably. Since it was parented to your hand, the slightest hand movement would cause it to move. At greater distances, this movement was magnified, and ironically, made it difficult to accurately target far away objects. To address this issue, we add a \u201csmoothed reticle\u201d that follows the original reticle using a damping curve. The amount of smoothing applied is inversely proportional to the displacement of the original reticle. As a result, small displacements of the reticle are smoothed out and large displacements are immediate.<\/p>"},"id":"8c8d12b1-769d-46a0-91d7-8b212f35264a","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/qd2dyruagozgr5fi"],"src":"","alt":"Tackling the depth perception issue using raycasts to ensure the reticle appeared where the player expected it","caption":"","link":"","ratio":"","crop":"false"},"id":"b99d684a-30d1-4412-95f0-85ff91e1a4bd","isHidden":false,"type":"imageBlock"},{"content":{"text":"The second issue was a consequence of how we render the reticle in the game. In order to avoid clipping issues and to give a 2D feel to the reticle, we render it on top of all world geometry. While this solution works well when the reticle is parented to your head, it wasn\u2019t the case with hands. The player\u2019s perception of the reticle\u2019s position was severely impacted. The problem was most noticeable when there were objects at different depths along the player\u2019s line of sight. <\/p>To the player, the reticle would appear to be on top of the object that was closest in their line of sight, when it was actually on top of an object at a different depth. This discrepancy caused confusion amongst players as to why they couldn\u2019t interact with the object they were targeting. To solve this problem, we do a raycast from the head to the reticle and detect if there is an interactable object along its path. If an object is detected, we snap the reticle in front of it.<\/p>"},"id":"2fce624a-bfe2-4a48-93f6-85190800a54a","isHidden":false,"type":"textBlock"},{"content":{"level":"h2","text":"Hands Collision Model<\/strong>","customid":""},"id":"98252f78-6720-4196-abd2-d5c2208b0842","isHidden":false,"type":"headingBlock"},{"content":{"text":"A huge challenge with hands in VR is how they interact with the world from a physics standpoint. Game physics is an approximation and when you combine it with virtual hands, whose motion is not constrained by world geometry, terrible and often hilarious things happen. The hand collision model is made up of two aspects: Hand Physics and Held Object Physics.<\/p>"},"id":"8783f8b5-b862-4ea8-a6d4-fff44597b350","isHidden":false,"type":"textBlock"},{"content":{"level":"h3","text":"Hand Physics<\/strong>","customid":""},"id":"6bee4e72-8e44-4141-8a57-2c8b18203c7d","isHidden":false,"type":"headingBlock"},{"content":{"text":"In IEYTD, the hands do not have colliders; they only have trigger volumes to grab objects. Players can push their virtual hands into geometry and it will clip right through. At one point, we considered giving visual feedback when this happened, but eventually didn\u2019t do it because we felt that it would alert the player even more to the fact that their hands were inside geometry. Lastly, we did not want players to be able to push objects forcefully out of closed containers, especially ones that were locked away and crucial to the puzzle.<\/p>"},"id":"58b6cfd3-0f4a-48a2-96ce-54c99e4139bd","isHidden":false,"type":"textBlock"},{"content":{"level":"h3","text":"Held Object Physics<\/strong>","customid":""},"id":"368efb2b-7237-4a77-965f-d43e55ccf1cc","isHidden":false,"type":"headingBlock"},{"content":{"text":"Determining the physics behavior of objects held by the player is an interesting problem. Our first iteration was a model where held objects collided with the environment, and when the collision amount was above a certain threshold, the object dropped from the player\u2019s hand. At first, this solution seemed to work well, but as the levels and interactions became more complex, it made object interaction frustrating. <\/p>"},"id":"a492b459-693e-4615-891a-adde6bd98e24","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/qyx2nvmj9xjocyw5"],"src":"","alt":"A look at Unity's collision tool setting up boundaries in the game","caption":"How do you let players move objects in tight spaces without frustrating them?","link":"","ratio":"","crop":"false"},"id":"e3deae1c-b54e-473c-80c0-a8acdedfb896","isHidden":false,"type":"imageBlock"},{"content":{"text":"We had stacks of cash, cigars and grenades placed inside tight spaces. When the player grabbed these objects, especially during speed runs, the tight spaces would cause the physics system to constantly try to resolve penetration, resulting in severe physics glitches. And often, such penetration caused the collision amount to exceed the object drop threshold, resulting in the player dropping objects unintentionally. It was frustrating and became a hindrance to puzzle solving.<\/p>Our second approach was to turn off collision when the object was picked by the hand. Early tests were promising because you no longer saw physics glitches when grabbing objects from tight spaces. But, it did come with the caveat that players could now stick objects into geometry, and upon release, they would bounce into unpredictable locations as physics tries to resolve the penetration. However, in our playtests, it was fairly uncommon and most of the times when it happened, people wouldn\u2019t notice it.<\/p>"},"id":"68bb80d4-c3ab-49e1-bbd8-2b1834357814","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/xg9pjlw6tk0zglei"],"src":"","alt":"In-engine look at how objects are made interactable in IEYTD","caption":"Oh, the things you can interact with!","link":"","ratio":"","crop":"false"},"id":"9296e80e-9f8c-4d44-a6e1-468594df77b0","isHidden":false,"type":"imageBlock"},{"content":{"text":"There was still one issue we had to solve with this approach. Since we turned off colliders when you picked up an object, it no longer detected collisions. As a result, we lost the ability to break objects. This change affected our puzzle solving since breaking objects is a core puzzle mechanic and secondly, it is immersion breaking to not acknowledge such an impulsive action. <\/p>In order to address this issue, we turn on colliders on the held object based on the hand\u2019s acceleration. Therefore, if the player moves the held object quickly, we turn on its colliders for a brief moment, thereby allowing it to send and receive collision events. This solution worked well since it was an intuitive action to perform when breaking objects.<\/p>"},"id":"784d2541-e04a-497a-bfdd-a10c52b56db2","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/qwwziltlgnlrunkr"],"src":"","alt":"IEYTD player in VR using a coffee mug to break through a pane of glass","caption":"Your Stanley could never","link":"","ratio":"","crop":"false"},"id":"922f94af-d120-4dba-abe7-987f36129f24","isHidden":false,"type":"imageBlock"},{"content":{"text":"Lastly, the colliders are never turned off on the held object when the hand is in Telekinesis Mode. We experimented with this, however it felt very unnatural to TK objects in and out through geometry without any form of resistance. It also had a higher chance of losing objects inside geometry.<\/p>"},"id":"ca36bf1a-6292-4c04-9e23-6c6702f5fad5","isHidden":false,"type":"textBlock"},{"content":{"level":"h2","text":"Ears of a Super Spy<\/strong>","customid":""},"id":"58ac8906-2ca7-4d08-875a-8fb3a39e4e4f","isHidden":false,"type":"headingBlock"},{"content":{"text":"Audio plays a crucial role in delivering a good VR experience. At its core, IEYTD is a puzzle game, however it is also a physics sandbox. Players are able to stack objects, throw them around, break them and even shoot them. As a result, these objects collide with the environment a lot and it was important that they make believable collision sounds when it happens.<\/p>"},"id":"32dc0607-c055-429b-beb5-8166c8330ec2","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/s8f7xzy2h7kxanvc"],"src":"","alt":"Paint over showing how different surfaces were coded in IEYTD to give each a different audio interaction","caption":"","link":"","ratio":"","crop":"false"},"id":"be77cc37-1a9c-4a01-af48-6d1fa1f1ea8d","isHidden":false,"type":"imageBlock"},{"content":{"text":"In order to achieve this audio interaction, we designed a system that allowed us to tag environment colliders as Soft, Hard, Glass and Metal surfaces. The image above shows a paint over of the different surfaces in the Car Level. The sound designer created two collision sounds (normal and heavy) for each type of surface, and for every object that can be picked up by the player. The idea is then to adjust the volume levels of these two sounds on impact, based on their collision velocity, and then play them simultaneously. <\/p>Our initial tests were positive, and with some additional tweaking, we were able to get the system to produce a good approximation of surface-based collision sounds. The following diagram is an overview of how the system works.<\/p>"},"id":"5bebc5b5-337c-4d24-9f8d-da521576b38d","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/zkgdfvw3f68hbw2k"],"src":"","alt":"Diagram showing how different surfaces produced different clips at various volumes based on the collision velocity","caption":"","link":"","ratio":"","crop":"false"},"id":"e3f8de5f-5226-4aa2-a455-90da7aa33817","isHidden":false,"type":"imageBlock"},{"content":{"level":"h2","text":"Solutions of a Super Spy<\/strong>","customid":""},"id":"4ab91ec0-c37a-451e-84f9-cf480ccb4aee","isHidden":false,"type":"headingBlock"},{"content":{"level":"h3","text":"Hidden Volumes<\/strong>","customid":""},"id":"c0acb562-6d97-4103-b81a-0fdc0d37e4a3","isHidden":false,"type":"headingBlock"},{"content":{"text":"As mentioned earlier, IEYTD is also a physics sandbox. It allows players to have fun with physics while they try to solve a puzzle. We love this aspect of our game; however, it comes at a cost. Players can easily lose an object that is crucial to the puzzle and put the game in a stale state.<\/p>"},"id":"94a1794d-0d4c-4b3f-bf68-669b523781bd","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/aa6ibvpgoo7niydl"],"src":"","alt":"Diagram of the IEYTD room showing all of the areas a player could potentially drop an object behind","caption":"The x-ray shader comes to the rescue","link":"","ratio":"","crop":"false"},"id":"1da8ca3e-18bf-47d0-b272-1eb745d68d35","isHidden":false,"type":"imageBlock"},{"content":{"text":"We decided to solve this problem using a technique that games have done before: have an x-ray shader on objects that are hidden. At first, we had concerns about it breaking the player\u2019s immersion, but then again you are a super spy with telekinetic powers, so x-ray vision didn\u2019t seem too farfetched. We did not want all occluded objects to use the x-ray shader, since it would compromise objects that are hidden from a puzzle standpoint. Instead, we built a system that allowed us to define approximate areas that are not reachable by the player. We did this using trigger volumes and named them Hidden Volumes. When an object falls into this volume, an x-ray shader is applied to it, allowing the player to see it through geometry.<\/p>Next, we needed a way for the player to be able to interact with objects inside the Hidden Volume. In order to do this, we put the objects into a separate physics layer, thereby allowing us to create a layer-specific raycast to detect and prioritize their targeting. This solution allowed the players to pick up objects through geometry.<\/p>"},"id":"4459e6ca-1538-4530-b77d-ae3edbce7967","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/r8clolnapxvsdjip"],"src":"","alt":"IEYTD player throwing a sandwich behind an object, showing an x-ray, and retrieving the object","caption":"Oh no! My lunch!","link":"","ratio":"","crop":"false"},"id":"6ed9d1e9-dbd6-45a3-9e2b-cb8e102ebf69","isHidden":false,"type":"imageBlock"},{"content":{"level":"h3","text":"Blind Volumes<\/strong>","customid":""},"id":"7da1ca4f-2d8f-4509-96f2-94cfe3800823","isHidden":false,"type":"headingBlock"},{"content":{"text":"As the name suggests, the sole purpose of this volume is to reduce the visibility of the player when they peek into places that are either a crucial part of the puzzle or simply lack any geometry. Under the hood, they are just trigger volumes that are placed in the affected regions of the level. These trigger volumes, by default, cause the screen to fade to black when the player\u2019s head enters it. In other scenarios, it was more convenient to set up a single Blind Volume that caused the screen to fade to black when the player\u2019s head exited it.<\/p>"},"id":"ebc7f62a-3def-486b-b5d6-9818d9fa5012","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/ppdvwgtbkk1cw5gl"],"src":"","alt":"Demonstration of a blind volume fading the screen to black","caption":"Get your head out of there","link":"","ratio":"","crop":"false"},"id":"6cf1af1c-9abc-48ac-a71c-01dea510903d","isHidden":false,"type":"imageBlock"},{"content":{"level":"h3","text":"Compartment Lids<\/strong>","customid":""},"id":"16668b06-7eba-4ba8-8ca3-658ecc037b0d","isHidden":false,"type":"headingBlock"},{"content":{"text":"In IEYTD, we have a number of compartments containing objects that the players can pick up. In order to prevent them from grabbing these objects without opening the compartment door (or lid), we put the lid collider on a special physics layer. Using a raycast against this layer, from the player\u2019s head to their hand, we detect if this collider is hit. If it is, then we deduce that the player is trying to access an object inside a compartment without opening it. When this happens, we simply disable the player\u2019s ability to grab objects.<\/p>"},"id":"c73f3e96-5319-4663-8648-d8cbbc85e586","isHidden":false,"type":"textBlock"},{"content":{"location":"kirby","image":["file:\/\/mzpx8py3cewd513x"],"src":"","alt":"Gif of IEYTD showing a player opening a car middle console and retrieving items","caption":"No breaking the immersion","link":"","ratio":"","crop":"false"},"id":"5cd6a483-77b0-4e3d-a7c7-99ad2b7bfcb3","isHidden":false,"type":"imageBlock"},{"content":{"level":"h2","text":"Power of VR<\/strong>","customid":""},"id":"dacf0fdf-073b-4f42-98eb-3eb26da0025e","isHidden":false,"type":"headingBlock"},{"content":{"text":"The development of IEYTD has been a challenging and rewarding experience. The techniques described here are the result of countless playtests<\/a> and iterations, and knowledge shared by the VR community. VR is a powerful medium that allows us developers to entice players in new and exciting ways. And, it does a pretty darn good job of transporting them to a world we\u2019ve created. Here\u2019s hoping that IEYTD gets people closer to their dreams of being a sophisticated and responsible Super Spy.<\/p>"},"id":"73c20dc2-bc78-4cc9-a740-bbb57e77f384","isHidden":false,"type":"textBlock"}]