The Computational Complexity of Portal And

The Computational Complexity of Portal And

1 The Computational Complexity of Portal and 2 Other 3D Video Games 3 Erik D. Demaine 4 MIT CSAIL, 32 Vassar Street, Cambridge, MA 02139, USA 5 [email protected] 1 6 Joshua Lockhart 7 Department of Computer Science, University College London, London, WC1E 6BT, UK 8 [email protected] 9 Jayson Lynch 10 MIT CSAIL, 32 Vassar Street, Cambridge, MA 02139, USA 11 [email protected] 12 Abstract 13 We classify the computational complexity of the popular video games Portal and Portal 2. We 14 isolate individual mechanics of the game and prove NP-hardness, PSPACE-completeness, or 15 pseudo-polynomiality depending on the specific game mechanics allowed. One of our proofs 16 generalizes to prove NP-hardness of many other video games such as Half-Life 2, Halo, Doom, 17 Elder Scrolls, Fallout, Grand Theft Auto, Left 4 Dead, Mass Effect, Deus Ex, Metal Gear Solid, 18 and Resident Evil. These results build on the established literature on the complexity of video 19 games [1, 3, 7, 18]. 20 2012 ACM Subject Classification Dummy classification 21 Keywords and phrases video games, hardness, motion planning, NP, PSPACE 22 Digital Object Identifier 10.4230/LIPIcs.FUN.2018.19 23 Related Version arXiv:1611.10319 24 1 Introduction 25 In Valve’s critically acclaimed Portal franchise, the player guides Chell (the game’s silent 26 protagonist) through a “test facility” constructed by the mysterious fictional organization 27 Aperture Science. Its unique game mechanic is the Portal Gun, which enables the player 28 to place a pair of portals on certain surfaces within each test chamber. When the player’s 29 avatar jumps into one of the portals, she is instantly transported to the other. This mechanic, 30 coupled with the fact that in-game items can be thrown through the portals, has allowed 31 the developers to create a series of unique and challenging puzzles for the player to solve as 32 they guide Chell to freedom. Indeed, the Portal series has proved extremely popular, and is 33 estimated to have sold more than 22 million copies [2, 20]. 34 We analyze the computational complexity of Portal following the recent surge of interest 35 in complexity analysis of video games and puzzles. Examples of previous work in this 36 area includes NP-completeness of Tetris [5], PSPACE-completeness of Lemmings [19] and 1 Work started while author was at School of Electronics, Electrical Engineering and Computer Science, Queen’s University, Belfast, BT7 1NN, UK © Erik D. Demaine, Joshua Lockhart, and Jayson Lynch; licensed under Creative Commons License CC-BY 9th International Conference on Fun with Algorithms (FUN 2018). Editors: Hiro Ito, Stefano Leonardi, Linda Pagli, and Giuseppe Prencipe; Article No. 19; pp. 19:1–19:21 Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany 19:2 The Computational Complexity of Portal 37 Super Mario Bros. [6], and hardness of many other classic video games [7,18]. See also the 38 surveys [4, 9, 11]. 39 In this paper, we explore how different game elements contribute to the computational 40 complexity of Portal 1 and Portal 2 (which we collectively refer to as Portal), with an 41 emphasis on identifying gadgets and proof techniques that can be used in hardness results for 42 other video games. We show that a generalized version of Portal with Emancipation Grills is 43 weakly NP-hard (Section 4); Portal with turrets is NP-hard (Section 5); Portal with timed 44 door buttons and doors is NP-hard (Section 6); Portal with High Energy Pellet launchers 45 and catchers is NP-hard (Section 7); Portal with Cubes, Weighted Buttons, and Doors is 46 PSPACE-complete (Section 8); and Portal with lasers, laser relays, and moving platforms is 47 PSPACE-complete (Section 8). 48 Table 1 summarizes these results. The first column lists the primary game mechanics 49 of Portal we are investigating. The second and third column note whether the long fall or 50 Portal Gun mechanics are needed for the proof. Section 2 provides more details about what 51 these models mean. The turret proof generalizes to many other video games, as described in 52 Section 5.4. Mechanics Portals Long fall Complexity Emancipation Grills, No Terminal Velocity Yes Yes Weakly NP-comp. (§4) Turrets No Yes NP-hard (§5) Timed Door Buttons and Doors No No NP-hard (§6) HEP Launcher and Catcher Yes No NP-hard (§7) Cubes, Weighted Buttons, Doors No No PSPACE-comp. (§8) Lasers, Relays, Moving Platforms Yes No PSPACE-comp. (§9) Gravity Beams, Cubes, Weighted Buttons, Doors No No PSPACE-comp. (§9) Table 1 Summary of new Portal complexity results 53 2 Definitions of Game Elements 54 Portal is a single-player platform game: a game with the goal of navigating the avatar from 55 a start location to an end location of a series of stages, called levels. The gameplay in Portal 56 involves walking, turning, jumping, crouching, pressing buttons, picking up objects, and 57 creating portals. The locations and movement of the avatar and all in-game objects are 58 discretized. For convenience we make a few assumptions about the game engine, which we 59 feel preserve the essential character of the games under consideration, while abstracting 60 away certain irrelevant implementation details in order to make complexity analysis more 61 amenable: 62 Positions and velocities are represented as triples of fixed-point numbers in Cartesian 2 63 coordinates. Each velocity vector is limited in magnitude by a terminal velocity 푣max . 64 Time is discretized and represented as a fixed-point number. Parameter 훿 defines the 65 amount of time advanced during each simulation time step. 66 At each time step, there is only a constant number of possible user inputs: button presses 67 and the cursor position. The user is able to apply any of these inputs within a time step. 2 The actual game uses floats in many instances. We claim that all our proofs work if we round the numbers involved, and only encode the problems in the significand. E. D. Demaine, J. Lockhart, and J. Lynch 19:3 68 The cursor position is represented by two fixed-point numbers in spherical coordinates. 69 At each time step, we update all objects’ positions and velocities as follows: 70 Update velocities based on acceleration from user commands and from gravity: ⃗푣푡+1 = 71 ⃗푣푡 + 훿(⃗푎input + ⃗푎훾 ) where ⃗푎훾 = [0, 0, −훾] and 푔 is a constant. 72 If a velocity vector ⃗푣푡+1 has magnitude > 푣max , scale it down to have magnitude 푣max . 73 Update positions according to these velocities: ⃗푝푡+1 = ⃗푝푡 + 훿⃗푣. 74 Check for collisions by extruding the objects into a fourth temporal dimension by 훿 3 75 and checking for intersection of those objects. 76 For the purposes of this paper, we define a collision model only between single moving 77 objects and non-moving objects, as this is all we need in our proofs possibly involving 78 collisions (Sections 4 and 7). We ignore details of more complex collisions as they are 79 not relevant to our results. 80 For an inelastic collision between a moving object 퐴 and a non-moving object 퐵, we ′ 81 calculate the first time 훿 ≤ 훿 at which the objects would intersect, and move 퐴 instead ′ 82 to this position (scaling the velocity vector by 훿 instead of 훿). Then we project 퐴’s 83 velocity vector onto the surface of 퐵 at the point of intersection. 84 For an elastic collision, we similarly calculate the first time of intersection and update 85 the position of 퐴, but update the velocity vector instead to its reflection off of the 86 surface at the point of intersection. 87 If an object passes through a portal, its velocity vector is rotated by the rotation that 88 brings the entering portal frame to the exiting portal frame. 89 Portals from the portal gun and bullets from turrets are resolved instantaneously in a 4 90 single time step by line-of-effect rather than any ballistic simulation. 91 In Portal, a level is a description of the polygonal surfaces in 3D defining the geometry of 92 the map, along with a simulation rate and a list of game elements with their locations and, 93 if applicable, connections to each other. In general, we assume that the level can be specified 94 succinctly as a collection of polygons whose coordinates may have polynomial precision, 95 (and thus so can the player coordinates), and thus exponentially large values (ratios). This 96 assumption matches the Valve Map Format (VMF) used to specify levels in Portal, Portal 2, 97 and other Source games [16]. A realistic special case is where we aim for pseudopolynomial 98 algorithms, that is, we assume that the coordinates of the polygons and player are assumed 99 to have polynomial values/ratios (logarithmic precision), as when the levels are composed of 100 explicit discrete blocks. This assumption matches the voxel-based P2C format sometimes 101 used for community-created Portal 2 levels [15]. 102 In this work, we consider the following decision problem, which asks whether a given 103 level has a path from the given start location the end location. 104 I Problem 1. Portal 105 Parameter: A set of allowed gameplay elements. 106 Input: A description of a Portal level using only allowed gameplay elements, and spatial 107 coordinates specifying a start and end location. 108 Output: Whether there exists a path traversable by a Portal player from the start location 109 to the end location. 3 This approach is precise, and should reasonably capture the relevant dynamics in the game, but computationally inefficient and likely not how collision detection is performed in practice.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    21 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us