{"id":38662,"date":"2017-05-15T08:40:09","date_gmt":"2017-05-15T12:40:09","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=38662"},"modified":"2017-05-15T12:08:40","modified_gmt":"2017-05-15T16:08:40","slug":"prey-debugging-the-problem","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=38662","title":{"rendered":"Prey: Debugging the Problem"},"content":{"rendered":"<p>You might remember <a href=\"?p=38640\">my complaint from yesterday<\/a>, where I talked about a bug that killed my Prey playthrough. I managed to solve the problem. What I found might also help all the other people experiencing strange broken quests triggers<span class='snote' title='1'>At least on the PC. If you&#8217;re playing on a console you&#8217;re on your own. Sorry.<\/span>. I don&#8217;t know. It turns out that (at least in my case) this is an issue with save data collisions between different games.<\/p>\n<p>Note: This post is spoiler-free, aside from the names of levels and random screenshots of the first fifteen minutes.<\/p>\n<p>Prey is pretty good in terms of PC creature comforts for a game of 2017. It&#8217;s got quicksave and quickload and they&#8217;re reasonably fast to use<span class='snote' title='2'>This isn&#8217;t one of those game engines that purges EVERYTHING from memory when doing a quickload.<\/span>. But it&#8217;s still a game of 2017, which means there are some console-minded design decisions impacting the interface. Specifically, you get three save &#8220;slots&#8221;.<\/p>\n<p>Now, each of those slots can hold multiple saves. If you start a game in Slot 1, within that slot you can have multiple auto saves, quick saves, and manual saves. This isn&#8217;t <em>inherently<\/em> a bad system. If you and your little brother are both playing through the game, this system means you can both have your own games without the save files getting all mixed together. The &#8220;only three active campaigns at a time&#8221; limit is a little alien to my PC sensibilities, but whatever. It&#8217;s odd, but I&#8217;m okay with it.<\/p>\n<p>Or I would be, if it wasn&#8217;t for the problems it caused&#8230;<\/p>\n<p><!--more--><\/p>\n<h3>Background<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/prey2017_intro1.jpg' width=100% alt='Prey has a helicopter ride as part of the intro, and it has the opening credits built into the city. It&apos;s strange, but I really dig it.' title='Prey has a helicopter ride as part of the intro, and it has the opening credits built into the city. It&apos;s strange, but I really dig it.'\/><\/div><div class='mouseover-alt'>Prey has a helicopter ride as part of the intro, and it has the opening credits built into the city. It&apos;s strange, but I really dig it.<\/div><\/p>\n<p>I said yesterday that I was starting my second playthrough. This is not technically correct. It&#8217;s actually my <em>third<\/em>. My very first game ended in failure. <\/p>\n<p>My problem was that I was too greedy. I hate leaving behind locked containers, so I kept spending my neuromods<span class='snote' title='3'>Skill points, basically. You don&#8217;t get XP in Prey. Instead, neuromods are simply collected in the world. Or you can fabricate them yourself if you&#8217;ve got the blueprint and the materials.<\/span> on things to help me open more locked rooms and boxes. I put points into hacking<span class='snote' title='4'>I regret this one. The hacking minigame commits the dual sin of being both terrible and difficult at higher levels.<\/span>, into moving heavy stuff<span class='snote' title='5'>Because often vents are blocked by heavy machinery<\/span>, repair<span class='snote' title='6'>So I could repair the elevators and broken doors to gain access.<\/span>, and enlarging my inventory so I could collect more crap<span class='snote' title='7'>Most of which was low-value junk that wasn&#8217;t worth the sacrifices I spent to collect it.<\/span>. The problem is that I wasn&#8217;t really putting points into combat and survivability. <\/p>\n<p>But Prey is a new game with old-school sensibilities, and in this kind of game you can&#8217;t get away with bullshit like this forever. Or at least, not until you really understand the systems well enough to get through with an underpowered character. It&#8217;s certainly an unwise way to play on your <em>first<\/em> trip through.<\/p>\n<p>I&#8217;d been in a death-spiral for a least an hour. My underpowered damage output meant that fights took longer, which meant I took more damage, which drained my ammunition and healing resources.   And yet I continued to spend all of my resources on building more neuromods instead of bullets, and I spent the neuromods on exploration-based stuff. I finally hit a wall when I got to the Deep Storage level and ran into a foe that was literally un-killable for me. I shot it with every bullet I owned (which wasn&#8217;t many) and hit it with every grenade I had, and it still wasn&#8217;t dead. And I didn&#8217;t have enough healing to run up and tank the damage while I finished it off with my wrench. <\/p>\n<p><em>Maybe<\/em> there was a way to stealth past it<span class='snote' title='8'>Spoiler: There is. The exit just didn&#8217;t look like what I was expecting and it was hard to see while being chewed up by the monster.<\/span>, but I couldn&#8217;t make it work. And deep down I knew that even if I pushed through this area with save-scumming, I could run into the same problem again five minutes later. <em>Maybe<\/em> I could beat it if I turned the difficulty down, but that would still leave me with almost no bullets going forward. No, this playthrough was done.<\/p>\n<p>In a strange way, this actually made me appreciate the game more. I <strong>like<\/strong> that you have the freedom to make a broken character. Yes, it sucks to run into a wall like this. But the alternative is for a game to be built around a &#8220;no build is invalid&#8221; philosophy, which means that the game is kind of toothless and your choices are more aesthetic than practical<span class='snote' title='9'>Like the BioShock Infinite system of &#8220;Do you want to kill people with lightning, or fire?&#8221;<\/span>. For your build choices to be meaningful they need to have consequences, and I was simply dealing with the consequences of poor choices.<\/p>\n<p>At any rate, I started a whole new game in the second save slot. I got to the end, had a fantastic time<span class='snote' title='10'>With a better build, better equipment, and better knowledge of the mechanics, that foe in Deep Storage wasn&#8217;t bad at all.<\/span>, and the next morning began yet another playthrough. Rather than using the third slot, I decided to re-use Slot 1. I mean, I&#8217;m never going back to that dead-end game, right? I don&#8217;t want to come back later and get all the different games confused. And why waste the space, right? <\/p>\n<h3>The Save System<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/prey2017_intro2.jpg' width=100% alt='Prey is what you&apos;d get if you rebooted Groundhog Day as a cyberpunk thriller.' title='Prey is what you&apos;d get if you rebooted Groundhog Day as a cyberpunk thriller.'\/><\/div><div class='mouseover-alt'>Prey is what you&apos;d get if you rebooted Groundhog Day as a cyberpunk thriller.<\/div><\/p>\n<p>As I said yesterday, the problem arose when I got to the area called the G.U.T.S. There were no enemies to fight. All the loot-able containers were empty. My quest log stopped updating. The allies stopped calling me on the radio. Suddenly the game was empty.<\/p>\n<p>For the record, if you stick to the main quest then in this part of the game your progression will go like this:<\/p>\n<p>Lobby &raquo; Psychotronics &raquo; G.U.T.S. &raquo; Arboretum &raquo; Crew Quarters &raquo; Deep Storage.<\/p>\n<p>Yesterday I realized that &#8220;no monsters around, and all the containers are empty&#8221; is kind of a good description of what the gameworld looks like <em>after<\/em> the player has gone through. Remembering that I began game #3 in the slot replacing game #1, I wondered if somehow data from the two games was getting mixed together. I mean, it&#8217;s kind of funny that the problem arose just as I began to get close to where game #1 ended.<\/p>\n<p>Checking in the Prey save folder, I did find some suspicious stuff going on. At the top level are three folders, one for each of your slots.<\/p>\n<p><code><br \/>\n\/Campaign0<br \/>\n\/Campaign1<br \/>\n\/Campaign2<\/code><\/p>\n<p>So far so good. Under each of those is another folder for every save associated with that particular campaign. It might look something like this:<\/p>\n<p><code><br \/>\n\/autosave0<br \/>\n\/autosave1<br \/>\n\/autosave2<br \/>\n\/manual0<br \/>\n\/manual1<br \/>\n\/quicksave0<br \/>\n\/quicksave1<br \/>\n\/quicksave2<br \/>\n\/quicksave3<br \/>\n\/quicksave4<br \/>\n\/temp<\/code><\/p>\n<p>The interesting thing here is that &#8220;temp&#8221; directory. It&#8217;s at the same level as the saves, which would imply it has information not tied to any particular save.<\/p>\n<p>If we look inside any of these directories, it will contain a list of files, like so:<\/p>\n<p><code><br \/>\nlobby.level<br \/>\npsychotronics.level<br \/>\nexterior.level<br \/>\nsimulationlabs.level<br \/>\narboretum.level<br \/>\nsave.meta<br \/>\nsave.csf<\/code><\/p>\n<p>So there&#8217;s a couple of &#8220;save&#8221; files, which probably hold player data and maybe some global gamestate information, and then individual files for all the levels. <\/p>\n<p>Prey isn&#8217;t a linear corridor game. The world is persistent and dynamic.  You can make changes to the world, and those changes are maintained across level boundaries. If I drop a wrench in the lobby and move one of the chairs, the game will remember that. I can take an elevator to another level, then go through an airlock to another level, then go on a spacewalk to reach another level, and then go through another airlock to return to the lobby, and that wrench will still be on the floor and the chair will be right where I left it.<\/p>\n<p>The trick here is that you can&#8217;t cram the entire world &#8211; all 14 or so areas &#8211; into memory at once. While I&#8217;m dicking around throwing corpses off the upper balcony in the lobby<span class='snote' title='11'>Don&#8217;t judge me.<\/span>, the game can&#8217;t also be keeping track of where all the wrenches and monster giblets were back in Psychotronics. <\/p>\n<p>That&#8217;s what I think the <code>\/temp<\/code> directory is all about. That&#8217;s a running snapshot of what the <em>rest<\/em> of the gameworld  looks like. It&#8217;s all the levels I&#8217;ve visited in the past. If I hit quicksave, then it saves a snapshot of the current level and player data into \/quickslot0 or whatever. At the same time, it takes all those files from <code>\/temp<\/code> and copies them into <code>\/quickslot0<\/code>. That way <code>\/quickslot0<\/code> has a full image of the whole gameworld. If I go to another level, play for three hours, and then load some other save, then the contents of that save directory will be copied into <code>\/temp<\/code>.<\/p>\n<p>This is just conjecture on my part, but it seems a likely explanation.<\/p>\n<h3>The Problem<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/prey2017_intro3.jpg' width=100% alt='In one of its many nods to classic Looking Glass games, Prey has Stephen Russell (voice of Thief&apos;s Garret) as Dr. Bellamy.' title='In one of its many nods to classic Looking Glass games, Prey has Stephen Russell (voice of Thief&apos;s Garret) as Dr. Bellamy.'\/><\/div><div class='mouseover-alt'>In one of its many nods to classic Looking Glass games, Prey has Stephen Russell (voice of Thief&apos;s Garret) as Dr. Bellamy.<\/div><\/p>\n<p>Looking at my save game folder, I saw that some files clearly didn&#8217;t belong. For example, there was an <code>arboretum.level<\/code> in a game where I hadn&#8217;t visited the arboretum yet. Even more suspicious was that the timestamp on that file was three days old, even though I began the playthrough the day before!<\/p>\n<p>I deleted the suspect files and fired up the game to find out it was still broken. I looked in the saves directory to see the files had mysteriously re-appeared. Steam cloud save had noticed these files were &#8220;missing&#8221;, and helpfully restored them from backup.<\/p>\n<p>Here is what happened to me, which should also work as repro instructions<span class='snote' title='12'>&#8221;How to reproduce a problem.&#8221;<\/span> if by some chance this is read by someone who can solve it:<\/p>\n<ol>\n<li>Begin a game. Play through more than one area. Exit game so that Steam cloud takes a snapshot of the save folder.\n<li>Begin a new game in the same slot as before.\n<li>Before catching up to the previous game, hard reboot the computer without exiting the game. Just turn the power off or whatever. (My PC actually crashed.) This means Steam Cloud won&#8217;t be updated properly.\n<li>After rebooting, run the game again. Steam cloud should make a mess of things. It won&#8217;t overwrite your new saves, but it will &#8220;restore&#8221; those unwanted files from the first playthrough.\n<li>Continue to play. Eventually you should progress into the levels already cleared in the first playthrough and everything will break.\n<\/ol>\n<p>You probably don&#8217;t need to start over the way I did. Simply reverting to an earlier save might be enough to trigger this. <\/p>\n<p>While Steam Cloud is involved in the crime, I don&#8217;t think it&#8217;s the guilty party. Other games can survive these sorts of mishaps without suffering from save-file madness. Steam is smart enough to <em>not<\/em> clobber new saves with older ones from the cloud. But Prey&#8217;s saves span multiple files, which means Steam cloud <em>will<\/em> restore missing files from the cloud, even if they&#8217;re supposed to be missing. Having said that, I don&#8217;t understand the rules of Steam cloud saves well enough to understand what Prey should be doing differently.<\/p>\n<p>Maybe the problem is that Steam is restoring unwanted files to <code>\/temp<\/code>, or maybe it&#8217;s restoring the files to <code>\/quickslot0<\/code> and <code>\/temp<\/code> has nothing to do with it. I didn&#8217;t do the Steam integration of <a href=\"?p=31452\">Good Robot<\/a>, so I don&#8217;t know how you&#8217;re supposed to handle this. Maybe there&#8217;s a way to tell Steam, &#8220;No seriously, this file is gone on purpose, forget it&#8221;. Maybe you should have some kind of playthrough-unique ID<span class='snote' title='13'>Like the timestamp of when the player began this particular run.<\/span> added to those level files and ignore files with mismatched IDs so different playthroughs can&#8217;t be mixed together like this. Or maybe just use the file timestamps to weed out ones that don&#8217;t belong.<\/p>\n<p>For me the solution was to turn off cloud saves and delete all files older than the start of the game. This seems to have fixed the problem. I played all the way through to Deep Storage and the game seems to be behaving itself so far.<\/p>\n<p>This not only explains my problem, it might also explain some of the strange broken quests people are reporting. In most games a buggy quest means that lots of people will have the game break at the same point. But if Prey is mishandling cloud saves in unexpected edge-cases (like if Steam is closed without properly uploading saves after a game session) then it could cause the more distributed chaos we&#8217;re seeing where no two people have exactly the same problem.<\/p>\n<p>That&#8217;s my theory anyway. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>You might remember my complaint from yesterday, where I talked about a bug that killed my Prey playthrough. I managed to solve the problem. What I found might also help all the other people experiencing strange broken quests triggersAt least on the PC. If you&#8217;re playing on a console you&#8217;re on your own. Sorry.. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[120],"tags":[],"class_list":["post-38662","post","type-post","status-publish","format-standard","hentry","category-videogames"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/38662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=38662"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/38662\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=38662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=38662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=38662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}