This is a valid RSS feed.
This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
line 40, column 0: (54 occurrences) [help]
<p><div id="attachment_2524" style="width: 138px" class="wp-caption aligncen ...
line 40, column 0: (60 occurrences) [help]
<p><div id="attachment_2524" style="width: 138px" class="wp-caption aligncen ...
<p>Does it work with ARM-based Macs? I don’t know since I don’t ...
<style type="text/css">
line 96, column 0: (3 occurrences) [help]
<p><div id="attachment_2550" style="width: 310px" class="wp-caption aligncen ...
line 96, column 0: (57 occurrences) [help]
<p><div id="attachment_2550" style="width: 310px" class="wp-caption aligncen ...
line 107, column 0: (55 occurrences) [help]
<p><div id="attachment_2668" style="width: 303px" class="wp-caption aligncen ...
<p><div id="attachment_2380" style="width: 110px" class="wp-caption aligncen ...
<p>Some old-school arcade games such as <a href="https://www.arcade-museum.c ...
line 690, column 3: (11 occurrences) [help]
]]></content:encoded>
^
<div style="width: 640px; margin: 1em auto;"><iframe loading="lazy" width="6 ...
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" > <channel> <title>asmaloney.com</title> <atom:link href="https://asmaloney.com/feed/" rel="self" type="application/rss+xml" /> <link>https://asmaloney.com</link> <description>Things 'n Stuff</description> <lastBuildDate>Sat, 29 Jul 2023 18:44:21 +0000</lastBuildDate> <language>en-CA</language> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> <item> <title>Running Guild Wars 2 With DX11 On macOS Using Wine</title> <link>https://asmaloney.com/2022/07/howto/running-guild-wars-2-with-dx11-on-macos-using-wine/</link> <comments>https://asmaloney.com/2022/07/howto/running-guild-wars-2-with-dx11-on-macos-using-wine/#comments</comments> <dc:creator><![CDATA[Andy Maloney]]></dc:creator> <pubDate>Sat, 23 Jul 2022 17:54:19 +0000</pubDate> <category><![CDATA[Games]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[games]]></category> <category><![CDATA[Guild Wars 2]]></category> <category><![CDATA[GW2]]></category> <category><![CDATA[macOS]]></category> <category><![CDATA[wine]]></category> <guid isPermaLink="false">https://asmaloney.com/?p=2645</guid> <description><![CDATA[At the beginning of 2021, ArenaNet announced that they would no longer be supporting the macOS client for Guild Wars 2. At that time I worked out a way to set up and use Wine to run it. Since then, the Wine set up and capabilities have changed. So this post is an update to […]]]></description> <content:encoded><![CDATA[<p>At the beginning of 2021, <a href="https://en-forum.guildwars2.com/discussion/121605/an-update-on-mac-support-for-guild-wars-2">ArenaNet announced</a> that they would no longer be supporting the macOS client for Guild Wars 2. At that time I worked out a way to <a href="https://asmaloney.com/2021/04/howto/running-guild-wars-2-on-macos-using-wine/">set up and use Wine to run it</a>.</p><p><div id="attachment_2524" style="width: 138px" class="wp-caption aligncenter"><a href="https://www.guildwars2.com/"><img aria-describedby="caption-attachment-2524" decoding="async" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-Icon.png" alt="Guild Wars 2 Icon" width="128" height="128" class="size-full wp-image-2524" /><p id="caption-attachment-2524" class="wp-caption-text">Guild Wars 2</a></p></div></p><p>Since then, the <a href="https://www.winehq.org/">Wine</a> set up and capabilities have changed. So this post is an update to my <a href="https://asmaloney.com/2021/04/howto/running-guild-wars-2-on-macos-using-wine/">previous one</a> to simplify the process and enable DX11 which is what Guild Wars 2 now uses.</p><p><span id="more-2645"></span></p><p><i>(Click the images for larger versions.)</i></p><h2>Requirements</h2><p>We need to download two things:</p><ol><li>the 64-bit version of the Guild Wars 2 Windows installer <a href="https://account.arena.net/welcome">from ArenaNet</a></li><li>the latest <a href="https://github.com/Gcenx/WineskinServer">WineskinServer</a> (v1.8.4.2 at the time of writing – there’s a link under “Manual installation” or if you use <a href="https://brew.sh/">homebrew</a> you can install using that)</li></ol><h2>ARM-Based Macs</h2><p>Does it work with ARM-based Macs? I don’t know since I don’t have one. If you want me to test it you can <a href="https://asmaloney.com/contact/">contact me and send me a machine</a> <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f603.png" alt="😃" class="wp-smiley" style="height: 1em; max-height: 1em;" />. Otherwise you can try it and let me know in the comments below.</p><h2>macOS Version</h2><div class="asm-note asm-smaller">Added 17 September 2022</div><p>When I wrote this I was using macOS 10.14.6. I have since updated to 12.6, but I want to note that I had a problem with 10.15.5. It would crash when trying to enter the game.</p><style type="text/css">.tg {border-collapse:collapse;border-spacing:0;margin:0px auto;}.tg td{padding:10px 5px;}.tg th{border:1px solid grey;padding:10px 5px;}.tg .tg-viqs{color:#fe0000;text-align:left;vertical-align:top}.tg .tg-amwm{font-weight:500;text-align:center;vertical-align:top}.tg .tg-0lax{text-align:left;vertical-align:top}.tg .tg-yi9q{color:#009901;text-align:left;vertical-align:top}</style><table class="tg"><thead><tr><th class="tg-amwm">macOS Version<br></th><th class="tg-amwm">Result</th></tr></thead><tbody><tr><td class="tg-0lax">10.14.6</td><td class="tg-yi9q">runs great</td></tr><tr><td class="tg-0lax">10.15.5</td><td class="tg-viqs">crashes</td></tr><tr><td class="tg-0lax">12.6</td><td class="tg-yi9q">runs great</td></tr></tbody></table><h2>Troubleshooting</h2><div class="asm-note asm-smaller">Added 17 March 2023</div><p>It’s difficult to troubleshoot using the comment section in WordPress, so I set up a <a href="https://github.com/asmaloney/GuildWars2-macOS">GitHub repository</a> to track issues. I understand it may be a hassle because you may need to sign up for another site to troubleshoot, but it’s the best way for me to manage any issues right now.</p><p>So if you run into problems and need to troubleshoot them, please first check if the problem has <a href="https://github.com/asmaloney/GuildWars2-macOS/issues?q=is%3Aissue">already been addressed</a>. If not, you can <a href="https://github.com/asmaloney/GW2-macOS/issues">create a new issue</a>.</p><h2>Fixing “-usecoherent” In An Existing Installation (Previously: Tweaking Config)</h2><p>If you are doing a fresh install, you can skip this section.</p><div class="asm-note asm-smaller">Added 20 July 2023</div><p>With the <strong>18 July 2023</strong> patch, the launcher broke again because <i>-usecoherent</i> stopped working.</p><p>Thanks to <a href="https://github.com/Gcenx">Dean Greer</a>, we have a way to get up and running running again. If you have an existing application that has stopped working, you can do the following to get going:</p><p>Open the Wineskin for your application.</p><p><div id="attachment_2550" style="width: 310px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2550" decoding="async" fetchpriority="high" src="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg" alt="Wineskin - Main Window" width="300" height="216" class="size-medium wp-image-2550" srcset="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Main-Window.jpg 561w" sizes="(max-width: 300px) 100vw, 300px" /><p id="caption-attachment-2550" class="wp-caption-text">Wineskin – Main Window</p></div></p><p>Click <b>Advanced</b>.</p><p>Go to the <b>Tools</b> tab and click <b>Config Utility (winecfg)</b>.</p><p>Go to the <b>Libraries</b> tab, find <b>dxgi</b>.</p><p>Click <strong>Edit</strong> and set to <strong>Builtin (Wine)</strong>, click <strong>OK</strong>, click <strong>Apply</strong>, and click <strong>OK</strong>.</p><p>Wait for it to finish (see the spinner in the upper-left corner of the window).</p><p>You should be able to play now! (And you can remove the <i>-coherent</i> switch since it doesn’t do anything anymore.)</p><h2>Generate The Wineskin Wrapper</h2><p>Decompress the <em>Wineskin.Winery.txz</em> file we just downloaded by double-clicking it, right-click the <strong>Wineskin Winery.app</strong>, and select <em>Open</em>. You’ll probably get a dialog complaining about something and you’ll have to click another button that says <i>Open</i>.</p><p><div id="attachment_2499" style="width: 193px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Main.jpg"><img aria-describedby="caption-attachment-2499" decoding="async" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Main-183x300.jpg" alt="Wineskin Winery - Main" width="183" height="300" class="size-medium wp-image-2499" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Main-183x300.jpg 183w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Main-427x700.jpg 427w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Main.jpg 614w" sizes="(max-width: 183px) 100vw, 183px" /></a><p id="caption-attachment-2499" class="wp-caption-text">Wineskin Winery – Main</p></div></p><p>Click the “+” to add a new engine.</p><p><div id="attachment_2668" style="width: 303px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Winery-Add-Engine.jpg"><img aria-describedby="caption-attachment-2668" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Winery-Add-Engine-293x300.jpg" alt="Wineskin Winery - Add Engine" width="293" height="300" class="size-medium wp-image-2668" srcset="https://asmaloney.com/images/2022/07/Wineskin-Winery-Add-Engine-293x300.jpg 293w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Add-Engine.jpg 638w" sizes="(max-width: 293px) 100vw, 293px" /></a><p id="caption-attachment-2668" class="wp-caption-text">Wineskin Winery – Add Engine</p></div></p><p>Select <b>WS11WineCX64Bit22.0.1-2</b> (or the latest one) and click <b>Download and Install</b>.</p><p><div id="attachment_2671" style="width: 189px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Winery-Engine-Added.jpg"><img aria-describedby="caption-attachment-2671" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Winery-Engine-Added-179x300.jpg" alt="Wineskin Winery - Engine Added" width="179" height="300" class="size-medium wp-image-2671" srcset="https://asmaloney.com/images/2022/07/Wineskin-Winery-Engine-Added-179x300.jpg 179w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Engine-Added-418x700.jpg 418w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Engine-Added.jpg 574w" sizes="(max-width: 179px) 100vw, 179px" /></a><p id="caption-attachment-2671" class="wp-caption-text">Wineskin Winery – Engine Added</p></div></p><p>When that’s complete, it will show up in the list in the main window. Next we need a wrapper, so click the <b>Update</b> button in the <i>Wrapper Version</i> section.</p><p><div id="attachment_2673" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Winery-Update-Wrapper.jpg"><img aria-describedby="caption-attachment-2673" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Winery-Update-Wrapper-300x169.jpg" alt="Wineskin Winery - Update Wrapper" width="300" height="169" class="size-medium wp-image-2673" srcset="https://asmaloney.com/images/2022/07/Wineskin-Winery-Update-Wrapper-300x169.jpg 300w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Update-Wrapper.jpg 524w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2673" class="wp-caption-text">Wineskin Winery – Update Wrapper</p></div></p><p>Click <b>OK</b> to download and install the latest one (<strong>2.9.1.1</strong> is likely out of date by now).</p><p>Back in the main window, click the <b>Create New Blank Wrapper</b> button at the bottom of the window.</p><p><div id="attachment_2669" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Winery-Create-Wrapper.jpg"><img aria-describedby="caption-attachment-2669" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Winery-Create-Wrapper-300x220.jpg" alt="Wineskin Winery - Create Wrapper" width="300" height="220" class="size-medium wp-image-2669" srcset="https://asmaloney.com/images/2022/07/Wineskin-Winery-Create-Wrapper-300x220.jpg 300w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Create-Wrapper.jpg 596w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2669" class="wp-caption-text">Wineskin Winery – Create Wrapper</p></div></p><p>Give it a name like <b>GW2</b> and click <b>OK</b>.</p><p>Once it has finished, it will show you this window. Click <b>View Wrapper in Finder</b> to show the new application.</p><p><div id="attachment_2501" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created.jpg"><img aria-describedby="caption-attachment-2501" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created-300x126.jpg" alt="Wineskin Winery - Wrapper Created" width="300" height="126" class="size-medium wp-image-2501" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created-300x126.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created-700x293.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created.jpg 869w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2501" class="wp-caption-text">Wineskin Winery – Wrapper Created</p></div></p><p>The application will be in your home directory’s <em>Applications</em> folder. Once we’ve completed all the setup and installation, this is what you will run when you want to play Guild Wars 2.</p><p>You can then close <b>Wineskin Winery</b> as we no longer need it.</p><h2>Installing Guild Wars 2</h2><p>Next, we need to install Guild Wars 2.</p><p>When you run new application (<strong>GW2.app</strong>) for the first time, you will be presented with the Wineskin main window to finish your setup.</p><p><div id="attachment_2550" style="width: 310px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2550" decoding="async" fetchpriority="high" src="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg" alt="Wineskin - Main Window" width="300" height="216" class="size-medium wp-image-2550" srcset="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Main-Window.jpg 561w" sizes="(max-width: 300px) 100vw, 300px" /><p id="caption-attachment-2550" class="wp-caption-text">Wineskin – Main Window</p></div></p><p>Click <b>Advanced</b>.</p><p>Click the <b>Install Software</b> button at the bottom of the window.</p><p><div id="attachment_2549" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2549" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-1024x594.jpg" alt="Wineskin - Install Executable" width="700" height="406" class="size-large wp-image-2549" srcset="https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-1024x594.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-300x174.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-700x406.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Install-Executable.jpg 1269w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2549" class="wp-caption-text">Wineskin – Install Executable</p></div></p><p>Click the <b>Choose Setup Executable</b> button and select the Windows Guild Wars 2 installer you downloaded earlier.</p><p>The first thing it will do is a bunch of downloading and updating…</p><p><div id="attachment_2518" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself.jpg"><img aria-describedby="caption-attachment-2518" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself-300x195.jpg" alt="Guild Wars 2 - Updating Itself" width="300" height="195" class="size-medium wp-image-2518" srcset="https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself-300x195.jpg 300w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself-700x456.jpg 700w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2518" class="wp-caption-text">Guild Wars 2 – Updating Itself</p></div></p><p>Once it’s finished with that, you will be at the main Guild Wars 2 window with a bright <b>INSTALL</b> button. Click that. This will pop up a save dialog which should be set to the correct location: <strong>C:\Program Files\Guild Wars 2</strong>.</p><p><div id="attachment_2660" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Guild-Wars-2-Install.jpg"><img aria-describedby="caption-attachment-2660" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Guild-Wars-2-Install-1024x693.jpg" alt="Guild Wars 2 - Install" width="700" height="474" class="size-large wp-image-2660" srcset="https://asmaloney.com/images/2022/07/Guild-Wars-2-Install-1024x693.jpg 1024w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Install-300x203.jpg 300w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Install-1536x1039.jpg 1536w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Install-2048x1385.jpg 2048w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Install-700x474.jpg 700w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2660" class="wp-caption-text">Guild Wars 2 – Install</p></div></p><p>Now it will begin the main install process.</p><p>Wait until it gets to the login screen and starts downloading data:</p><p><div id="attachment_2661" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Guild-Wars-2-Login-Screen.jpg"><img aria-describedby="caption-attachment-2661" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Guild-Wars-2-Login-Screen-1024x696.jpg" alt="Guild Wars 2 - Login Screen" width="700" height="476" class="size-large wp-image-2661" srcset="https://asmaloney.com/images/2022/07/Guild-Wars-2-Login-Screen-1024x696.jpg 1024w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Login-Screen-300x204.jpg 300w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Login-Screen-1536x1044.jpg 1536w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Login-Screen-2048x1392.jpg 2048w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Login-Screen-700x476.jpg 700w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2661" class="wp-caption-text">Guild Wars 2 – Login Screen</p></div></p><p>If you already have the GW2 data from a previous install and don’t want to re-download the ~60 GB of data, you can close the window with the “x” in the top-right and copy over the data file (see optional section below).</p><p>When the installation is complete, (or you interrupt it to copy over the data file), you will be asked to set the executable for this wrapper. Choose the <strong>Gw2-64.exe</strong> we just installed.</p><p><div id="attachment_2548" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2548" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-1024x355.jpg" alt="Wineskin - Choose Executable" width="700" height="243" class="size-large wp-image-2548" srcset="https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-1024x355.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-300x104.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-700x243.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable.jpg 1223w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2548" class="wp-caption-text">Wineskin – Choose Executable</p></div></p><h3>Copying The Data File From An Old Installation (optional)</h3><p>If you have an old installation of Guild Wars 2 and don’t want to re-download the ~60 GB of data, you can copy over the data file.</p><p>To get to the file, you need to right-click the <strong>Guild Wars 2 64-bit.app</strong> file and choose <b>Show Package Contents</b>. This is where the data file is on the old (official) macOS client: </p><p><div id="attachment_2662" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Guild-Wars-2-macOS-Data-File.jpg"><img aria-describedby="caption-attachment-2662" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Guild-Wars-2-macOS-Data-File-1024x197.jpg" alt="Guild Wars 2 - macOS Data File" width="700" height="135" class="size-large wp-image-2662" srcset="https://asmaloney.com/images/2022/07/Guild-Wars-2-macOS-Data-File-1024x197.jpg 1024w, https://asmaloney.com/images/2022/07/Guild-Wars-2-macOS-Data-File-300x58.jpg 300w, https://asmaloney.com/images/2022/07/Guild-Wars-2-macOS-Data-File-700x135.jpg 700w, https://asmaloney.com/images/2022/07/Guild-Wars-2-macOS-Data-File.jpg 1225w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2662" class="wp-caption-text">Guild Wars 2 – macOS Data File</p></div></p><p>Find the <em>Gw2.dat</em> file and copy/move it to the wine installation we just created. To find the right location, go to <em>your home</em> <strong>Applications/Wineskin/GW2.app</strong>, right-click it and choose <b>Show Package Contents</b>. (Note this is not the system Applications folder – it’s in your home directory.)</p><p>The file we want to replace is here:</p><p><div id="attachment_2535" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2535" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-1024x219.jpg" alt="Wineskin - Guild Wars 2 Data Location" width="700" height="150" class="size-large wp-image-2535" srcset="https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-1024x219.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-300x64.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-1536x329.jpg 1536w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-700x150.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location.jpg 1626w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2535" class="wp-caption-text">Wineskin – Guild Wars 2 Data Location</p></div></p><h2>Setting Up The Environment</h2><p>When you run new application (<strong>GW2.app</strong>) for the first time, you will be presented with the Wineskin main window to finish your setup.</p><p><div id="attachment_2550" style="width: 310px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2550" decoding="async" fetchpriority="high" src="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg" alt="Wineskin - Main Window" width="300" height="216" class="size-medium wp-image-2550" srcset="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Main-Window.jpg 561w" sizes="(max-width: 300px) 100vw, 300px" /><p id="caption-attachment-2550" class="wp-caption-text">Wineskin – Main Window</p></div></p><p>Click <b>Advanced</b>.</p><p><div id="attachment_2765" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2023/05/Wineskin-Advanced-Settings-2.jpg"><img aria-describedby="caption-attachment-2765" decoding="async" loading="lazy" src="https://asmaloney.com/images/2023/05/Wineskin-Advanced-Settings-2-1024x552.jpg" alt="Wineskin - Advanced Settings" width="700" height="377" class="size-large wp-image-2765" srcset="https://asmaloney.com/images/2023/05/Wineskin-Advanced-Settings-2-1024x552.jpg 1024w, https://asmaloney.com/images/2023/05/Wineskin-Advanced-Settings-2-300x162.jpg 300w, https://asmaloney.com/images/2023/05/Wineskin-Advanced-Settings-2-700x377.jpg 700w, https://asmaloney.com/images/2023/05/Wineskin-Advanced-Settings-2.jpg 1370w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2765" class="wp-caption-text">Wineskin – Advanced Settings</p></div></p><div class="asm-note asm-smaller">Added 07 May 2023</div><p><strike>First we need to work around a problem with the latest GW2 version.</p><p>The Guild Wars 2 <a href="https://en-forum.guildwars2.com/topic/129939-game-update-notes-april-18-2023/">update from 18 April</a> turned on the <a href="https://en.wikipedia.org/wiki/Chromium_Embedded_Framework">Chromium Embedded Framework</a> (CEF) as a replacement for the <i>Coherent UI</i> – which is what they use for various parts of the interface including the storefront. This broke things for those of us using WINE since CEF fails to run. This results in being stuck on “Initializing” in the loading screen.</p><p>Thankfully there is a way to work around it (for now!) by using a <a href="https://wiki.guildwars2.com/wiki/Command_line_arguments">command line argument</a> to force GW2 to use the older Coherent UI. To do this, add <i>-usecoherent</i> to the command line where <b>Windows app</b> is set as in the image above.</strike></p><div class="asm-note asm-smaller">Added 20 July 2023</div><p>Since the patch from 18 July 2023 broke the <i>-usecoherent</i> switch, it is no longer necessary. This problem has been worked around above in the <b>Tweaking Config</b> section.</p><p>Next we’ll install some winetricks to add DX11 capabilities. Go to the <b>Tools</b> tab.</p><p><div id="attachment_2665" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Tools.jpg"><img aria-describedby="caption-attachment-2665" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Tools-1024x543.jpg" alt="Wineskin - Tools" width="700" height="371" class="size-large wp-image-2665" srcset="https://asmaloney.com/images/2022/07/Wineskin-Tools-1024x543.jpg 1024w, https://asmaloney.com/images/2022/07/Wineskin-Tools-300x159.jpg 300w, https://asmaloney.com/images/2022/07/Wineskin-Tools-700x371.jpg 700w, https://asmaloney.com/images/2022/07/Wineskin-Tools.jpg 1370w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2665" class="wp-caption-text">Wineskin – Tools</p></div></p><p>Click the <strong>Winetricks</strong> button in the <em>Utilities</em> section in the middle. Winetricks is a tool used to easily set some configuration and install other libraries and programs.</p><p><div id="attachment_2554" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2554" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winetricks-1024x922.jpg" alt="Wineskin - Winetricks" width="700" height="630" class="size-large wp-image-2554" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winetricks-1024x922.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-300x270.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-1536x1384.jpg 1536w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-700x631.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks.jpg 1664w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2554" class="wp-caption-text">Wineskin – Winetricks</p></div></p><p>Next we need to update winetricks to the latest version. Click the <b>Update Winetricks</b> button in the lower-left and let it update.</p><p><div id="attachment_2667" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Update.jpg"><img aria-describedby="caption-attachment-2667" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Update-300x150.jpg" alt="Wineskin - Winetricks Update" width="300" height="150" class="size-medium wp-image-2667" srcset="https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Update-300x150.jpg 300w, https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Update-700x350.jpg 700w, https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Update.jpg 840w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2667" class="wp-caption-text">Wineskin – Winetricks Update</p></div></p><p>Next we are going to install the <i>dxvk</i> library (which enables DX11), and change the wrapper to Windows 10.</p><p>Under the <em>dlls</em> section, select <strong>dxvk1102_macOS</strong> (or a more recent version if available).</p><p>Under the <em>settings</em> section, choose <strong>win10</strong>.</p><p>Click the <b>Run</b> button and you should get a confirmation dialog.</p><p><div id="attachment_2666" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Install.jpg"><img aria-describedby="caption-attachment-2666" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Install-300x108.jpg" alt="Wineskin - Winetricks Install" width="300" height="108" class="size-medium wp-image-2666" srcset="https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Install-300x108.jpg 300w, https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Install-700x252.jpg 700w, https://asmaloney.com/images/2022/07/Wineskin-Winetricks-Install.jpg 840w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2666" class="wp-caption-text">Wineskin – Winetricks Install</p></div></p><p>Click <b>Yes</b>, wait for it to install and set everything up, and close the window.</p><p>Finally we will turn off folder mapping from macOS to Windows. This is not strictly necessary, but it keeps the installation cleaner and can help prevent accidents…</p><p>Go to the <b>Options</b> tab and deselect the <i>Map User Mac OS X folders in wrapper</i> option.</p><p><div id="attachment_2670" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Winery-Do-Not-Map-Folders.jpg"><img aria-describedby="caption-attachment-2670" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Winery-Do-Not-Map-Folders-1024x543.jpg" alt="Wineskin Winery - Do Not Map Folders" width="700" height="371" class="size-large wp-image-2670" srcset="https://asmaloney.com/images/2022/07/Wineskin-Winery-Do-Not-Map-Folders-1024x543.jpg 1024w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Do-Not-Map-Folders-300x159.jpg 300w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Do-Not-Map-Folders-700x371.jpg 700w, https://asmaloney.com/images/2022/07/Wineskin-Winery-Do-Not-Map-Folders.jpg 1370w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2670" class="wp-caption-text">Wineskin Winery – Do Not Map Folders</p></div></p><p>Now you can quit Wineskin. To run Guild Wars 2 from now on, you just need to run your <b>GW2.app</b>.</p><h3>Play!</h3><p>Once it’s all installed, you should be able to play!</p><p>For reference, I am running a 2019 iMac with:</p><ul><li>macOS 12.6.7</li><li>3.6 GHz Intel Core i9</li><li>32 GB 2667 MHz DDR4</li><li>Radeon Pro 580X 8 GB</li></ul><p>These are the graphics settings I have been using:</p><p><div id="attachment_2659" style="width: 253px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Guild-Wars-2-Graphics-Settings.jpg"><img aria-describedby="caption-attachment-2659" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Guild-Wars-2-Graphics-Settings-243x300.jpg" alt="Guild Wars 2 - Graphics Settings" width="243" height="300" class="size-medium wp-image-2659" srcset="https://asmaloney.com/images/2022/07/Guild-Wars-2-Graphics-Settings-243x300.jpg 243w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Graphics-Settings-830x1024.jpg 830w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Graphics-Settings-568x700.jpg 568w, https://asmaloney.com/images/2022/07/Guild-Wars-2-Graphics-Settings.jpg 1192w" sizes="(max-width: 243px) 100vw, 243px" /></a><p id="caption-attachment-2659" class="wp-caption-text">Guild Wars 2 – Graphics Settings</p></div></p><div class="asm-note asm-smaller">Edited 07 May 2023</div><p><strike><b>Note:</b> Make sure you <b>Enable DX11 Rendering</b> in the graphics settings.</strike></p><p><b>Note:</b> The graphics settings screenshot above is out of date. DX11 is now the default for GW2.</p><p>You will have to play around with your graphics settings to get something that works for you.</p><p>Note that the first time you run it will be even slower than normal as it needs to build & cache the shaders. It gets better given time.</p><h2>Useful Extras</h2><h3>Getting Back To The Wineskin Settings</h3><p>To get back to the Wineskin settings for your <strong>GW2.app</strong> to install new things or to adjust your settings, go to <em>your home</em> <strong>Applications/Wineskin/GW2.app</strong>, right-click it and choose <b>Show Package Contents</b>. Then double-click <strong>Wineskin.app</strong>.</p><h3>Icon</h3><p>An icon isn’t strictly necessary, but it’s nice to see it in the dock when Guild Wars 2 is running. If you have your old macOS installation, you can click the <b>Browse</b> button next to the icon and navigate to<b>/Applications/Guild Wars 2 64-bit.app/Contents/Frameworks/Gw64.framework/Versions/GuildWars2.111959/Resources/app.icns</b></p><div class="asm-note asm-smaller">Edited 02 April 2023</div><p>I’ve added the .icns file to the <a href="https://github.com/asmaloney/GuildWars2-macOS">GitHub repository</a> so it’s easy to access.</p><p><div id="attachment_2664" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2022/07/Wineskin-Ready-To-Roll.jpg"><img aria-describedby="caption-attachment-2664" decoding="async" loading="lazy" src="https://asmaloney.com/images/2022/07/Wineskin-Ready-To-Roll-1024x543.jpg" alt="Wineskin - Ready To Roll" width="700" height="371" class="size-large wp-image-2664" srcset="https://asmaloney.com/images/2022/07/Wineskin-Ready-To-Roll-1024x543.jpg 1024w, https://asmaloney.com/images/2022/07/Wineskin-Ready-To-Roll-300x159.jpg 300w, https://asmaloney.com/images/2022/07/Wineskin-Ready-To-Roll-700x371.jpg 700w, https://asmaloney.com/images/2022/07/Wineskin-Ready-To-Roll.jpg 1370w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2664" class="wp-caption-text">Wineskin – Ready To Roll</p></div></p><h2>Caveats/Bugs</h2><p>So far the DX11 version has been pretty solid – even better than the DX9 version. I think the main problems have to do with shaders and there’s not much we can do about that. The issues I’ve noticed are:</p><ol><li>Loading screens when moving between maps can be quite slow.</li><li>Every time you run it, it has some slowdowns/hitching at the beginning that slowly sort themselves out. I believe this is a shader-related issue with using Vulkan (which is what is being used to emulate DX11).</li><li>Participating in large events can be slow – not too surprising since it used to happen before anyways. It’s definitely slower than the native client was, but it is playable for me. It might not be good enough for competitive PvP or WvW though.</li></ol><h2>Conclusion</h2><p>If you have any feedback on ways to improve this process or ways to improve performance, please leave a comment below.</p><p>That’s it. I hope it works for you and I’ll see you around Tyria!</p><p>Praise Joko!</p><h2>Updates</h2><p><b>20 july 2023</b></p><ul><li>Added <strong>Tweaking Config</strong> section to change the winecfg. This allows us to run CEF using DXVK which in turn lets us launch GW2 again! Thanks to <a href="https://github.com/Gcenx">Dean Greer</a>!</li></ul><p><b>7 May 2023</b></p><ul><li>Reordered GW2 installation & winetricks to avoid problem with CEF introduced in the <a href="https://en-forum.guildwars2.com/topic/129939-game-update-notes-april-18-2023/">18 April 2023</a> update</li><li>Updated commentary on DX9</li><li>Added info on working around the Chromium Embedded Framework (CEF) using <i>-usecoherent</i></ul>]]></content:encoded> <wfw:commentRss>https://asmaloney.com/2022/07/howto/running-guild-wars-2-with-dx11-on-macos-using-wine/feed/</wfw:commentRss> <slash:comments>36</slash:comments> </item> <item> <title>Running Guild Wars 2 On macOS Using Wine</title> <link>https://asmaloney.com/2021/04/howto/running-guild-wars-2-on-macos-using-wine/</link> <comments>https://asmaloney.com/2021/04/howto/running-guild-wars-2-on-macos-using-wine/#comments</comments> <dc:creator><![CDATA[Andy Maloney]]></dc:creator> <pubDate>Mon, 19 Apr 2021 14:57:42 +0000</pubDate> <category><![CDATA[Games]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[games]]></category> <category><![CDATA[Guild Wars 2]]></category> <category><![CDATA[GW2]]></category> <category><![CDATA[macOS]]></category> <category><![CDATA[wine]]></category> <guid isPermaLink="false">https://asmaloney.com/?p=2477</guid> <description><![CDATA[At the beginning of 2021, ArenaNet announced that they would no longer be supporting the macOS client for Guild Wars 2. As a longtime player, I found this… unfortunate. There are several ways to run the Windows client on a Mac including dual-booting Windows with Bootcamp, but that’s not an option for me. Running in […]]]></description> <content:encoded><![CDATA[<p>At the beginning of 2021, <a href="https://en-forum.guildwars2.com/discussion/121605/an-update-on-mac-support-for-guild-wars-2">ArenaNet announced</a> that they would no longer be supporting the macOS client for Guild Wars 2. As a longtime player, I found this… unfortunate.</p><p><div id="attachment_2524" style="width: 138px" class="wp-caption aligncenter"><a href="https://www.guildwars2.com/"><img aria-describedby="caption-attachment-2524" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-Icon.png" alt="Guild Wars 2 Icon" width="128" height="128" class="size-full wp-image-2524" /><p id="caption-attachment-2524" class="wp-caption-text">Guild Wars 2</a></p></div></p><p>There are several ways to run the Windows client on a Mac including dual-booting Windows with Bootcamp, but that’s not an option for me. Running in a virtual machine like VMWare or Parallels is too slow, so that leaves some form of <a href="https://www.winehq.org/">Wine</a> which is a Windows compatibility layer. The old macOS 32-bit Guild Wars 2 client actually used a version of Wine to run. It wasn’t as good as when they released a 64-bit native client, but it worked for a time.</p><p>I tried several ways to run Guild Wars 2 using Wine before finding one that works for me. In this post I’ll explain how to set it up.</p><div class="asm-note"><b>Note (23 July 2022):</b> I have an updated version of this post for <a href="https://asmaloney.com/2022/07/howto/running-guild-wars-2-with-dx11-on-macos-using-wine/">handling DX11</a>.</div><p><span id="more-2477"></span></p><p><i>(Click the images for larger versions.)</i></p><h2>My Machine</h2><p>I am running a 2019 iMac with:</p><ul><li>macOS 10.14.6</li><li>3.6 GHz Intel Core i9</li><li>32 GB 2667 MHz DDR4</li><li>Radeon Pro 580X 8 GB</li></ul><p>So it really <em>should</em> be able to handle this really old game…</p><h2>What I Tried</h2><p>The first thing I tried was <a href="https://www.playonmac.com/en/">PlayOnMac</a> 4.4.1. It worked alright for general PvE, but it was still too slow even on basic graphics settings and the code to install different WINE versions was broken. They fixed the download problem in 4.4.2, but they made that version require macOS 10.15+ for some reason.</p><p>The next thing I tried was a straight Wine build – version 6.5 (wine-devel-6.5-osx64) which I downloaded from <a href="https://github.com/Gcenx/macOS_Wine_builds">here</a>. This worked alright as well, a bit better than the PlayOnMac one, but didn’t have any nice config & install capabilities like some of the wrappers do.</p><p>Then I found <a href="https://github.com/Gcenx/WineskinServer">Gcenx/WineskinServer</a>. This did the trick.</p><p>I’ll step through everything I did to get Guild Wars 2 up-and-running at a reasonable framerate for me.</p><p>This looks like a lot, but I’ve just been incredibly verbose for those that need a bit more direction.</p><h2>Download Stuff</h2><p>We need to download two things:</p><ol><li>the 64-bit version of the Guild Wars 2 Windows installer <a href="https://account.arena.net/welcome">from ArenaNet</a></li><li>the latest <a href="https://github.com/Gcenx/WineskinServer">WineskinServer</a> (v1.8.4.2 at the time of writing – there’s a link under “Manually installation” (sic))</li></ol><h2>Generate The Wineskin Wrapper</h2><p>Decompress the <em>Wineskin.Winery.txz</em> file we just downloaded by double-clicking it, right-click the <strong>Wineskin Winery.app</strong>, and select <em>Open</em>. You’ll probably get a dialog complaining about something and you’ll have to click another button that says <i>Open</i>.</p><p><div id="attachment_2499" style="width: 193px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Main.jpg"><img aria-describedby="caption-attachment-2499" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Main-183x300.jpg" alt="Wineskin Winery - Main" width="183" height="300" class="size-medium wp-image-2499" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Main-183x300.jpg 183w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Main-427x700.jpg 427w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Main.jpg 614w" sizes="(max-width: 183px) 100vw, 183px" /></a><p id="caption-attachment-2499" class="wp-caption-text">Wineskin Winery – Main</p></div></p><p>Click the “+” to add a new engine.</p><p><div id="attachment_2496" style="width: 304px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Add-Engine.jpg"><img aria-describedby="caption-attachment-2496" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Add-Engine-294x300.jpg" alt="Wineskin Winery - Add Engine" width="294" height="300" class="size-medium wp-image-2496" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Add-Engine-294x300.jpg 294w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Add-Engine.jpg 674w" sizes="(max-width: 294px) 100vw, 294px" /></a><p id="caption-attachment-2496" class="wp-caption-text">Wineskin Winery – Add Engine</p></div></p><p>Select <b>WS11WineCX64Bit20.0.2</b> and click <b>Download and Install</b>.</p><p><div id="attachment_2498" style="width: 195px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Engine-Added.jpg"><img aria-describedby="caption-attachment-2498" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Engine-Added-185x300.jpg" alt="Wineskin Winery - Engine Added" width="185" height="300" class="size-medium wp-image-2498" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Engine-Added-185x300.jpg 185w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Engine-Added-432x700.jpg 432w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Engine-Added.jpg 620w" sizes="(max-width: 185px) 100vw, 185px" /></a><p id="caption-attachment-2498" class="wp-caption-text">Wineskin Winery – Engine Added</p></div></p><p>When that’s complete, it will show up in the list in the main window. Next we need a wrapper, so click the <b>Update</b> button in the <i>Wrapper Version</i> section.</p><p><div id="attachment_2500" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Update-Wrapper.jpg"><img aria-describedby="caption-attachment-2500" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Update-Wrapper-300x175.jpg" alt="Wineskin Winery - Update Wrapper" width="300" height="175" class="size-medium wp-image-2500" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Update-Wrapper-300x175.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Update-Wrapper.jpg 550w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2500" class="wp-caption-text">Wineskin Winery – Update Wrapper</p></div></p><p>Click <b>OK</b> to download and install the latest one.</p><p>Back in the main window, click the <b>Create New Blank Wrapper</b> button at the bottom of the window.</p><p><div id="attachment_2566" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Create-Wrapper.jpg"><img aria-describedby="caption-attachment-2566" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Create-Wrapper-300x223.jpg" alt="Wineskin Winery - Create Wrapper" width="300" height="223" class="size-medium wp-image-2566" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Create-Wrapper-300x223.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Create-Wrapper.jpg 616w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2566" class="wp-caption-text">Wineskin Winery – Create Wrapper</p></div></p><p>Give it a name like <b>GW2</b> and click <b>OK</b>.</p><p>As it sets itself up, you will get this window asking about Gecko a couple of times. Just click <b>Cancel</b> to skip it.</p><p><div id="attachment_2495" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wine-Gecko-Installer.jpg"><img aria-describedby="caption-attachment-2495" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wine-Gecko-Installer-300x144.jpg" alt="Wine - Gecko Installer" width="300" height="144" class="size-medium wp-image-2495" srcset="https://asmaloney.com/images/2021/04/Wine-Gecko-Installer-300x144.jpg 300w, https://asmaloney.com/images/2021/04/Wine-Gecko-Installer-700x337.jpg 700w, https://asmaloney.com/images/2021/04/Wine-Gecko-Installer.jpg 814w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2495" class="wp-caption-text">Wine – Gecko Installer</p></div></p><p>Once it has finished, it will show you this window. Click <b>View Wrapper in Finder</b> to show the new application.</p><p><div id="attachment_2501" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created.jpg"><img aria-describedby="caption-attachment-2501" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created-300x126.jpg" alt="Wineskin Winery - Wrapper Created" width="300" height="126" class="size-medium wp-image-2501" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created-300x126.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created-700x293.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Winery-Wrapper-Created.jpg 869w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2501" class="wp-caption-text">Wineskin Winery – Wrapper Created</p></div></p><p>The application will be in your home directory’s <em>Applications</em> folder. Once we’ve completed all the setup and installation, this is what you will run when you want to play Guild Wars 2.</p><h2>Setting Up The Environment</h2><p>When you run new application, <strong>GW2.app</strong>, you will be presented with the Wineskin main window to finish your setup.</p><p><div id="attachment_2550" style="width: 310px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2550" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg" alt="Wineskin - Main Window" width="300" height="216" class="size-medium wp-image-2550" srcset="https://asmaloney.com/images/2021/04/Wineskin-Main-Window-300x216.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Main-Window.jpg 561w" sizes="(max-width: 300px) 100vw, 300px" /><p id="caption-attachment-2550" class="wp-caption-text">Wineskin – Main Window</p></div></p><p>Click the <b>Screen Options</b> button and turn on all the options.</p><p><div id="attachment_2552" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2552" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Screen-Options-1024x488.jpg" alt="Wineskin - Screen Options" width="700" height="334" class="size-large wp-image-2552" srcset="https://asmaloney.com/images/2021/04/Wineskin-Screen-Options-1024x488.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Screen-Options-300x143.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Screen-Options-700x333.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Screen-Options.jpg 1419w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2552" class="wp-caption-text">Wineskin – Screen Options</p></div></p><p><b>Note (16 May 2021):</b> After writing this up I experimented a little. You don’t need to turn on <i>Retina Mode</i>. With it off, the loading window will be a more reasonable size and the resolutions will still work properly when the game is running.</p><p>Go back to the main window and click <b>Advanced</b>.</p><p><div id="attachment_2547" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2547" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Advanced-Settings-1024x557.jpg" alt="Wineskin - Advanced Settings" width="700" height="381" class="size-large wp-image-2547" srcset="https://asmaloney.com/images/2021/04/Wineskin-Advanced-Settings-1024x557.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Advanced-Settings-300x163.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Advanced-Settings-700x381.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Advanced-Settings.jpg 1407w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2547" class="wp-caption-text">Wineskin – Advanced Settings</p></div></p><p>Go to the <b>Tools</b> tab.</p><p><div id="attachment_2553" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2553" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Tools-1024x557.jpg" alt="Wineskin - Tools" width="700" height="381" class="size-large wp-image-2553" srcset="https://asmaloney.com/images/2021/04/Wineskin-Tools-1024x557.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Tools-300x163.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Tools-700x381.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Tools.jpg 1410w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2553" class="wp-caption-text">Wineskin – Tools</p></div></p><p>Click the <strong>Winetricks</strong> button in the <em>Utilities</em> section in the middle. Winetricks is a tool used to easily set some configuration and install other libraries and programs.</p><p><div id="attachment_2554" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2554" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winetricks-1024x922.jpg" alt="Wineskin - Winetricks" width="700" height="630" class="size-large wp-image-2554" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winetricks-1024x922.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-300x270.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-1536x1384.jpg 1536w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-700x631.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks.jpg 1664w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2554" class="wp-caption-text">Wineskin – Winetricks</p></div></p><p>We are going to install an application, several libraries, and change a couple of settings.</p><p>Under the <em>apps</em> section, select <strong>7zip</strong>. (I don’t know if this is strictly necessary for what we’re doing, but I have it installed, so I’m including it here.)</p><p>Under the <em>dlls</em> section, select <strong>d3dcompiler_47</strong> and <strong>d3dx9_43</strong>.</p><p>Under the <em>settings</em> section, choose <strong>fontsmooth=rgb</strong> and <strong>win10</strong>.</p><p>Click the <b>Run</b> button and you should get a confirmation dialog.</p><p><div id="attachment_2556" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-Winetricks-Install.jpg"><img aria-describedby="caption-attachment-2556" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Winetricks-Install-300x118.jpg" alt="Wineskin - Winetricks Install" width="300" height="118" class="size-medium wp-image-2556" srcset="https://asmaloney.com/images/2021/04/Wineskin-Winetricks-Install-300x118.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-Install-700x275.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Winetricks-Install.jpg 865w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2556" class="wp-caption-text">Wineskin – Winetricks Install</p></div></p><p>Click <b>Yes</b>, wait for it to install and set everything up, and close the window.</p><p>Back in the <em>Advanced Settings</em>, choose the <strong>Advanced</strong> tab. If it is not on, turn on the last setting to disable Gecko installation. This will prevent that window we saw earlier from popping up all the time.</p><p><b>Note (25 June 2021):</b> This may already be turned on. It is possible a newer version of the wineskin wrapper does this for you.</p><p><div id="attachment_2546" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2546" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Advanced-Advanced-Settings-1024x557.jpg" alt="Wineskin - Advanced Advanced Settings?" width="700" height="381" class="size-large wp-image-2546" srcset="https://asmaloney.com/images/2021/04/Wineskin-Advanced-Advanced-Settings-1024x557.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Advanced-Advanced-Settings-300x163.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Advanced-Advanced-Settings-700x381.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Advanced-Advanced-Settings.jpg 1414w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2546" class="wp-caption-text">Wineskin – Advanced Advanced Settings?</p></div></p><p>Click the <b>Install Software</b> button at the bottom of the window.</p><p><div id="attachment_2549" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2549" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-1024x594.jpg" alt="Wineskin - Install Executable" width="700" height="406" class="size-large wp-image-2549" srcset="https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-1024x594.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-300x174.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Install-Executable-700x406.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Install-Executable.jpg 1269w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2549" class="wp-caption-text">Wineskin – Install Executable</p></div></p><p>Click the <b>Choose Setup Executable</b> button and select the Windows Guild Wars 2 installer you downloaded earlier.</p><h2>Installing Guild Wars 2</h2><p>The first thing it will do is a bunch of downloading and updating…</p><p><div id="attachment_2518" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself.jpg"><img aria-describedby="caption-attachment-2518" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself-300x195.jpg" alt="Guild Wars 2 - Updating Itself" width="300" height="195" class="size-medium wp-image-2518" srcset="https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself-300x195.jpg 300w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself-700x456.jpg 700w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Updating-Itself.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2518" class="wp-caption-text">Guild Wars 2 – Updating Itself</p></div></p><p>Once it’s finished with that, you will be at the main Guild Wars 2 window with a bright <b>INSTALL</b> button. Click that. This will pop up a save dialog that’s hard to read (because we have the Retina thing on), but it should be installing in the correct location: <strong>C:\Program Files\Guild Wars 2</strong>.</p><p><div id="attachment_2515" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Guild-Wars-2-Install.jpg"><img aria-describedby="caption-attachment-2515" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-Install-300x174.jpg" alt="Guild Wars 2 - Install" width="300" height="174" class="size-medium wp-image-2515" srcset="https://asmaloney.com/images/2021/04/Guild-Wars-2-Install-300x174.jpg 300w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Install-1024x593.jpg 1024w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Install-1536x889.jpg 1536w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Install-700x405.jpg 700w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Install.jpg 2016w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2515" class="wp-caption-text">Guild Wars 2 – Install</p></div></p><p>Now it will begin the main install process.</p><p><div id="attachment_2516" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Guild-Wars-2-Login-Screen.jpg"><img aria-describedby="caption-attachment-2516" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-Login-Screen-300x174.jpg" alt="Guild Wars 2 - Login Screen" width="300" height="174" class="size-medium wp-image-2516" srcset="https://asmaloney.com/images/2021/04/Guild-Wars-2-Login-Screen-300x174.jpg 300w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Login-Screen-1024x594.jpg 1024w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Login-Screen-1536x891.jpg 1536w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Login-Screen-700x406.jpg 700w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Login-Screen.jpg 2015w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2516" class="wp-caption-text">Guild Wars 2 – Login Screen</p></div></p><p>When the install is completed, or you interrupt it to copy over the data file, you will be asked to set the executable for this wrapper. Choose the <strong>Gw2-64.exe</strong> we just installed.</p><p><div id="attachment_2548" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2548" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-1024x355.jpg" alt="Wineskin - Choose Executable" width="700" height="243" class="size-large wp-image-2548" srcset="https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-1024x355.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-300x104.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable-700x243.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Choose-Executable.jpg 1223w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2548" class="wp-caption-text">Wineskin – Choose Executable</p></div></p><h3>Copying The Data File From An Old Installation</h3><p>If you have an old installation of Guild Wars 2 and don’t want to re-download the ~50 GB of data, you can close the window with the “x” in the top-right and copy over the data file.</p><p>This is where the data file is on the macOS client: </p><p><div id="attachment_2517" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2517" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-macOS-Data-File-1024x248.jpg" alt="Guild Wars 2 - macOS Data File" width="700" height="170" class="size-large wp-image-2517" srcset="https://asmaloney.com/images/2021/04/Guild-Wars-2-macOS-Data-File-1024x248.jpg 1024w, https://asmaloney.com/images/2021/04/Guild-Wars-2-macOS-Data-File-300x73.jpg 300w, https://asmaloney.com/images/2021/04/Guild-Wars-2-macOS-Data-File-1536x372.jpg 1536w, https://asmaloney.com/images/2021/04/Guild-Wars-2-macOS-Data-File-700x169.jpg 700w, https://asmaloney.com/images/2021/04/Guild-Wars-2-macOS-Data-File.jpg 1652w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2517" class="wp-caption-text">Guild Wars 2 – macOS Data File</p></div></p><p>You need to right-click the <strong>Guild Wars 2 64-bit.app</strong> file and choose <b>Show Package Contents</b>.</p><p>Find the <em>Gw2.dat</em> file and copy it to the wine installation we just completed. To find that, go to <em>your home</em> <strong>Applications/Wineskin/GW2.app</strong>, right-click it and choose <b>Show Package Contents</b>. (Note this is not the system Applications folder – it’s in your home directory.)</p><p>The file we want to replace is here:</p><p><div id="attachment_2535" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2535" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-1024x219.jpg" alt="Wineskin - Guild Wars 2 Data Location" width="700" height="150" class="size-large wp-image-2535" srcset="https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-1024x219.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-300x64.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-1536x329.jpg 1536w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location-700x150.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Guild-Wars-2-Data-Location.jpg 1626w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2535" class="wp-caption-text">Wineskin – Guild Wars 2 Data Location</p></div></p><h3>Play!</h3><p>Once it’s all installed, you should be able to play! For reference, these are the graphics settings I’ve been using lately:</p><p><div id="attachment_2514" style="width: 258px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Guild-Wars-2-Graphics-Settings.jpg"><img aria-describedby="caption-attachment-2514" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Guild-Wars-2-Graphics-Settings-248x300.jpg" alt="Guild Wars 2 - Graphics Settings" width="248" height="300" class="size-medium wp-image-2514" srcset="https://asmaloney.com/images/2021/04/Guild-Wars-2-Graphics-Settings-248x300.jpg 248w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Graphics-Settings-578x700.jpg 578w, https://asmaloney.com/images/2021/04/Guild-Wars-2-Graphics-Settings.jpg 642w" sizes="(max-width: 248px) 100vw, 248px" /></a><p id="caption-attachment-2514" class="wp-caption-text">Guild Wars 2 – Graphics Settings</p></div></p><p>You will have to play around with your graphics settings to get something that works for you.</p><h2>Useful Extras</h2><h3>Getting Back To The Wineskin Settings</h3><p>To get back to the Wineskin settings for your <strong>GW2.app</strong> to install new things or to adjust your settings, go to <em>your home</em> <strong>Applications/Wineskin/GW2.app</strong>, right-click it and choose <b>Show Package Contents</b>. Then double-click <strong>Wineskin.app</strong>.</p><h3>Icon</h3><p>An icon isn’t strictly necessary, but it’s nice to see it in the dock when Guild Wars 2 is running. If you have your old macOS installation, you can click the <b>Browse</b> button next to the icon and navigate to<b>/Applications/Guild Wars 2 64-bit.app/Contents/Frameworks/Gw64.framework/Versions/GuildWars2.111959/Resources/app.icns</b></p><p><div id="attachment_2551" style="width: 710px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-2551" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-Ready-To-Roll-1024x560.jpg" alt="Wineskin - Ready To Roll" width="700" height="383" class="size-large wp-image-2551" srcset="https://asmaloney.com/images/2021/04/Wineskin-Ready-To-Roll-1024x560.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-Ready-To-Roll-300x164.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-Ready-To-Roll-700x383.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-Ready-To-Roll.jpg 1405w" sizes="(max-width: 700px) 100vw, 700px" /><p id="caption-attachment-2551" class="wp-caption-text">Wineskin – Ready To Roll</p></div></p><h3>Double-Click Speed</h3><p>I found the default double-click speed super annoying. To change it, go to the <strong>Advanced -> Tools</strong> tab and click the <strong>Registry Editor (regedit)</strong> button. This will run the Windows registry editor for your installation. Navigate to the <strong>HKEY_CURRENT_USER/Control Panel/Mouse</strong> section and double click the <strong>DoubleClickSpeed</strong> entry to enter a new value. I use 1000.</p><p><div id="attachment_2519" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/04/Wineskin-regedit.jpg"><img aria-describedby="caption-attachment-2519" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/04/Wineskin-regedit-300x156.jpg" alt="Wineskin - regedit" width="300" height="156" class="size-medium wp-image-2519" srcset="https://asmaloney.com/images/2021/04/Wineskin-regedit-300x156.jpg 300w, https://asmaloney.com/images/2021/04/Wineskin-regedit-1024x533.jpg 1024w, https://asmaloney.com/images/2021/04/Wineskin-regedit-1536x799.jpg 1536w, https://asmaloney.com/images/2021/04/Wineskin-regedit-700x364.jpg 700w, https://asmaloney.com/images/2021/04/Wineskin-regedit.jpg 1929w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2519" class="wp-caption-text">Wineskin – regedit</p></div></p><h2>Caveats/Bugs</h2><p>So far it’s been pretty solid. Things I’ve noticed:</p><ol><li>Because I set <i>Retina Mode</i> on, the main Guild Wars 2 login screen is tiny. Not that big a problem since it handles the resolution properly in-game.</li><li>I get a very occasional crash when switching maps. (Twice in the three weeks I’ve been playing with this version?)</li><li>Sometimes your character ends up mounting inside the ground & it takes a while to resolve itself. It then plays all the events that happened while “paused” and launches you across the map… This used to happen with the old macOS client, but seemed to have been fixed in the native one. Annoying, but not a deal-breaker.</li><li>Participating in large events can be slow – not too surprising since it used to happen before anyways. It’s definitely slower than the native client was, but so far it’s playable for me. It might not be good enough for competitive PvP or WvW though.</li></ol><h2>Conclusion</h2><p>If you have any feedback on ways to improve this process or ways to improve performance, please leave a comment below.</p><p>That’s it. I hope it works for you and I’ll see you around Tyria!</p><p>Praise Joko!</p><p><b>Note (23 July 2022):</b> I have an updated version of this post for <a href="https://asmaloney.com/2022/07/howto/running-guild-wars-2-with-dx11-on-macos-using-wine/">handling DX11</a>.</p>]]></content:encoded> <wfw:commentRss>https://asmaloney.com/2021/04/howto/running-guild-wars-2-on-macos-using-wine/feed/</wfw:commentRss> <slash:comments>41</slash:comments> </item> <item> <title>Vertical Scrolling Parallax Backgrounds in Godot</title> <link>https://asmaloney.com/2021/02/code/vertical-scrolling-parallax-backgrounds-in-godot/</link> <comments>https://asmaloney.com/2021/02/code/vertical-scrolling-parallax-backgrounds-in-godot/#respond</comments> <dc:creator><![CDATA[Andy Maloney]]></dc:creator> <pubDate>Thu, 11 Feb 2021 14:42:58 +0000</pubDate> <category><![CDATA[Code]]></category> <category><![CDATA[Games]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[example]]></category> <category><![CDATA[game engine]]></category> <category><![CDATA[games]]></category> <category><![CDATA[Godot]]></category> <category><![CDATA[Godot Game Engine]]></category> <category><![CDATA[infinite scroll]]></category> <category><![CDATA[parallax background]]></category> <category><![CDATA[vertical scroller]]></category> <guid isPermaLink="false">https://asmaloney.com/?p=2351</guid> <description><![CDATA[One of the fantastic things about game development is that there are a lot of resources available online. Video tutorials, blog posts, forum posts, etc.. Unfortunately the quality varies dramatically and they can end up out-of-date quickly as the game engine changes. So it can be difficult to figure out how to do simple things […]]]></description> <content:encoded><![CDATA[<p>One of the fantastic things about game development is that there are <em>a lot</em> of resources available online. Video tutorials, blog posts, forum posts, etc.. Unfortunately the quality varies dramatically and they can end up out-of-date quickly as the game engine changes.</p><p>So it can be difficult to figure out how to do simple things because either what you find online uses APIs or techniques that no longer exist, or they don’t use an up-to-date technique that may be simpler. Often they don’t even include what version of the engine they used, so that adds an extra challenge.</p><p>There was a simple idea I wanted to play with in <a href="https://godotengine.org/">Godot</a> that led me here…</p><p><div id="attachment_2380" style="width: 110px" class="wp-caption aligncenter"><a href="https://godotengine.org"><img aria-describedby="caption-attachment-2380" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/01/Godot-Icon.svg" alt="Godot game engine icon" width="100" height="100" class="size-thumbnail wp-image-2380" role="img" /></a><p id="caption-attachment-2380" class="wp-caption-text">Godot Game Engine</p></div></p><p>Some old-school arcade games such as <a href="https://www.arcade-museum.com/game_detail.php?game_id=9244"">Raiden</a> and <a href="https://www.arcade-museum.com/game_detail.php?game_id=6766">1942</a>, are top-down, vertical scrollers. In these games, the player is generally restricted to moving left and right (possibly forward and back a little) and the background scrolls past them giving the illusion the player is moving forward. To recreate that style I needed to create a vertical, infinitely scrolling, parallax background.</p><div style="text-align: center;"><div style="display: inline-block; margin-right: 5px; vertical-align: middle;"><div id="attachment_2354" style="width: 234px" class="wp-caption aligncenter"><a href="https://en.wikipedia.org/wiki/Raiden_(video_game)"><img aria-describedby="caption-attachment-2354" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/01/ARC_Raiden.png" alt="Raiden (Arcade Game, 1990)" width="224" height="256" class="size-full wp-image-2354" /></a><p id="caption-attachment-2354" class="wp-caption-text">Raiden (Arcade Game, 1990)<br/>Image from <a href="https://en.wikipedia.org/wiki/Raiden_(video_game)">wikipedia</a></p></div></div><div style="display: inline-block; margin-left: 5px; vertical-align: middle;"><div id="attachment_2353" style="width: 234px" class="wp-caption aligncenter"><a href="https://en.wikipedia.org/wiki/1942_(video_game)"><img aria-describedby="caption-attachment-2353" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/01/ARC_1942.png" alt="1942 (Arcade Game, 1984)" width="224" height="256" class="size-full wp-image-2353" /></a><p id="caption-attachment-2353" class="wp-caption-text">1942 (Arcade Game, 1984)<br/>Image from <a href="https://en.wikipedia.org/wiki/1942_(video_game)">wikipedia</a></p></div></div></div><p>Googling led to some video tutorials on side-scrolling parallax backgrounds (close!), some short answers in some forums (must be for an older version – didn’t work), and some things that were clearly hacks. After a fair amount of time looking around and watching videos, it turns out that it’s incredibly simple.</p><p>The following is a short tutorial will step through setting up a project with a simple player and an infinitely scrolling, parallax background. The complete project may be <a href="https://github.com/asmaloney/SpaceThing">found on GitHub</a>.</p><p><span id="more-2351"></span></p><h2>The Short Version</h2><p>Before I get to the tutorial, here’s the key that solves the problem (in case you don’t want to read my wonderful tutorial).</p><p>With most tutorials about this topic, the presenters are creating a side-scroller with parallax background. In that style of game, the camera follows the player, and Godot’s <a href="https://docs.godotengine.org/en/stable/classes/class_parallaxbackground.html">ParallaxBackground</a> automatically uses this camera to manage its scrolling. So it’s easy to drop in a ParallaxBackground, add a <a href="https://docs.godotengine.org/en/stable/classes/class_parallaxlayer.html">ParallaxLayer</a> and a <a href="https://docs.godotengine.org/en/stable/classes/class_sprite.html">Sprite</a>, and have it work “out-of-the-box”.</p><p>In the type of game we’re looking at (vertical scroller), there isn’t typically a camera following the player. The player is restricted to moving left and right (possibly up and down a little), and the background scrolls past them. So ParallaxBackground may not have a camera to use to work its magic.</p><p>The docs for ParallaxBackground’s <a href="https://docs.godotengine.org/en/stable/classes/class_parallaxbackground.html#class-parallaxbackground-property-scroll-offset">scroll_offest</a> property explain how to make it work:</p><blockquote><p>Calculated automatically when using a Camera2D, but can be used to manually manage scrolling when no camera is present.</p></blockquote><h2>The Tutorial</h2><p>I’m going to step through putting together a very simple project from scratch with a spaceship you can move and a scrolling space background. It assumes no knowledge of Godot, so it should be detailed enough for an absolute beginner.</p><h3>Godot Version</h3><p>I am using Godot version <a href="https://github.com/godotengine/godot/commits/3.2">3.2.4rc</a> at git hash <a href="https://github.com/godotengine/godot/commit/85f92a2463ab39231886a7d7f75afadf1663d08a">85f92a2</a> on macOS 10.14.6.</p><h3>Project Setup</h3><p>After you have created a new project (I called mine “Space Thing”), there are two things we need to set up in the project settings: <em>input</em> so our player can move, and the <em>window’s aspect ratio</em> so it looks more like a vertical scroller.</p><p>Under the <strong>Project</strong> menu, bring up the <strong>Project Settings</strong>.</p><h4>Input</h4><p>We need to add two inputs for moving left and right. Under the <strong>Input Map</strong> tab, add inputs for <em>input_left</em> and <em>input_right</em> by typing the action name in at the top, clicking <strong>Add</strong>, then clicking the plus sign beside the new action and choosing a key. I’ve chosen the standard <kbd>a</kbd> and <kbd>d</kbd> keys.</p><p><div id="attachment_2396" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Input-Setup.png"><img aria-describedby="caption-attachment-2396" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Input-Setup-1024x785.png" alt="Space Thing - Input Setup" width="700" height="537" class="size-large wp-image-2396" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Input-Setup-1024x785.png 1024w, https://asmaloney.com/images/2021/02/Space-Thing-Input-Setup-300x230.png 300w, https://asmaloney.com/images/2021/02/Space-Thing-Input-Setup-700x537.png 700w, https://asmaloney.com/images/2021/02/Space-Thing-Input-Setup.png 1372w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2396" class="wp-caption-text">Space Thing – Input Setup</p></div></p><p>We will use these inputs in the player scripts to move the player.</p><h4>Window</h4><p>We want a vertical aspect ratio, so under the <strong>General</strong> tab, scroll down the list on the left to find the <strong>Display</strong> settings. The <strong>Window</strong> section lets us adjust the project’s window size.</p><p>Here I’ve set it to <em>600×800</em>.</p><p><div id="attachment_2428" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Window-Setup.png"><img aria-describedby="caption-attachment-2428" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Window-Setup-1024x785.png" alt="Space Thing - Window Setup" width="700" height="537" class="size-large wp-image-2428" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Window-Setup-1024x785.png 1024w, https://asmaloney.com/images/2021/02/Space-Thing-Window-Setup-300x230.png 300w, https://asmaloney.com/images/2021/02/Space-Thing-Window-Setup-700x537.png 700w, https://asmaloney.com/images/2021/02/Space-Thing-Window-Setup.png 1372w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2428" class="wp-caption-text">Space Thing – Window Setup</p></div></p><h3>Main Scene</h3><p>We need to set up a main scene to work with. For this we will use a generic <a href="https://docs.godotengine.org/en/stable/classes/class_node.html">Node</a> as a container to hold our other scenes.</p><p>In the scene outline on the left, click <strong>Other Node</strong> and choose a <em>Node</em> type. Change the name of the node by double-clicking it in the scene outline. Call it <strong>Main</strong>. Now save the scene.</p><p>In the example, I have used a specific layout for the project, but you can choose to save your files however you like. In this case, I have created the directory <strong>Scenes/Main</strong> and saved the <em>Main.tscn</em> file in there.</p><p>Here is what things should look like so far:</p><p><div id="attachment_2404" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Main-Scene.png"><img aria-describedby="caption-attachment-2404" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Main-Scene-1024x735.png" alt="Space Thing - Main Scene" width="700" height="502" class="size-large wp-image-2404" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Main-Scene-1024x735.png 1024w, https://asmaloney.com/images/2021/02/Space-Thing-Main-Scene-300x215.png 300w, https://asmaloney.com/images/2021/02/Space-Thing-Main-Scene-1536x1103.png 1536w, https://asmaloney.com/images/2021/02/Space-Thing-Main-Scene-2048x1470.png 2048w, https://asmaloney.com/images/2021/02/Space-Thing-Main-Scene-700x503.png 700w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2404" class="wp-caption-text">Space Thing – Main Scene</p></div></p><h3>Player Scene</h3><p>Next, let’s create the player scene (everything in Godot is a scene!) and get the player to move using the inputs we set up earlier.</p><p>Under the <strong>Scene</strong> menu choose <strong>New Scene</strong>. Click the <strong>Other Node</strong> button in the outline and this time choose a <em>KinematicBody2D</em> node. Rename it <em>Player</em>.</p><p>Save the scene. I saved it in a new <strong>Scenes/Player</strong> directory.</p><p>We are going to need three things for our player: a <a href="https://docs.godotengine.org/en/stable/classes/class_sprite.html">Sprite</a> so we can attach an image, a <a href="https://docs.godotengine.org/en/stable/classes/class_collisionshape2d.html#collisionshape2d">CollisionShape2D</a> so we can check bounds and interact with other objects, and a <a href="https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_basics.html">script</a> to pull everything together.</p><h4>Player Sprite</h4><p>Create a new node for the player scene by clicking the “+” in the scene outline, or right-clicking the <em>Player</em> node and choosing <strong>Add Child Node</strong>. Choose a node of type <em>Sprite</em>.</p><p>A <a href="https://docs.godotengine.org/en/stable/classes/class_sprite.html">Sprite</a> needs an image, so let’s add a spaceship to our project. Again you can put things wherever you like, but I created a <strong>Scenes/Player/assets/images</strong> directory to put the file there. (You can do this easily by right-clicking the directories in the <em>FileSystem</em> tab on the bottom-left of the window and choosing <strong>New Folder…</strong>.)</p><p>I am going to use a clipart <a href="https://clipartix.com/spaceship-clipart-image-30474/">image of a spaceship</a>. I downloaded that one and resized it to 48×89 pixels. You can add the file to the project in several ways, but the easiest is to just drag it into the directory you want in the <strong>FileSystem</strong> tab.</p><p>Now that the image is in the project, we need to tell our Sprite to use it. Select the Player Sprite in the scene outline, then drag the file (Spaceship.png) from the <strong>FileSystem</strong> tab in the lower-left to the <strong>Texture</strong> property in the <strong>Inspector</strong> in the upper-right.</p><p>Things should look like something like this:</p><p><div id="attachment_2409" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Player-Sprite.png"><img aria-describedby="caption-attachment-2409" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Player-Sprite-1024x735.png" alt="Space Thing - Player Sprite" width="700" height="502" class="size-large wp-image-2409" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Player-Sprite-1024x735.png 1024w, https://asmaloney.com/images/2021/02/Space-Thing-Player-Sprite-300x215.png 300w, https://asmaloney.com/images/2021/02/Space-Thing-Player-Sprite-1536x1103.png 1536w, https://asmaloney.com/images/2021/02/Space-Thing-Player-Sprite-2048x1470.png 2048w, https://asmaloney.com/images/2021/02/Space-Thing-Player-Sprite-700x503.png 700w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2409" class="wp-caption-text">Space Thing – Player Sprite</p></div></p><h4>Player Collision</h4><p>In order for us to check that the player stays within the bounds of the screen, we need to add a collision node.</p><p>Create a new node for the player scene by clicking the “+” in the scene outline, or right-clicking the <em>Player</em> node and choosing <strong>Add Child Node</strong>. Choose a node of type <em>CollisionShape2D</em>.</p><p>In the Inspector on the right, beside <strong>Shape</strong>, choose <strong>New RectangleShape2D</strong>. In the editor, use the red handles to adjust the collision rectangle to cover the ship.</p><p><div id="attachment_2411" style="width: 190px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Spaceship-Collision.png"><img aria-describedby="caption-attachment-2411" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Spaceship-Collision-180x300.png" alt="Space Thing - Spaceship Collision" width="180" height="300" class="size-medium wp-image-2411" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Spaceship-Collision-180x300.png 180w, https://asmaloney.com/images/2021/02/Space-Thing-Spaceship-Collision.png 384w" sizes="(max-width: 180px) 100vw, 180px" /></a><p id="caption-attachment-2411" class="wp-caption-text">Space Thing – Spaceship Collision</p></div></p><h4>Player Odds ‘n Ends</h4><p>Finally, let’s turn on a setting so that we can move the player scene as a whole without inadvertently selecting or moving its children. Select the Player scene in the scene outline. In the toolbar at the top of the editor, there’s a button with this icon:</p><p><a href="https://asmaloney.com/images/2021/02/Space-Thing-Selectable-Children.png"><img decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Selectable-Children.png" alt="" width="65" height="61" class="aligncenter size-full wp-image-2415" /></a></p><p>Clicking this makes the Player scene look like a single node when used in the Main scene. You’ll notice that the icon now shows up in the scene outline on the Player node as well.</p><h4>Player Script</h4><p>In order to get the player to actually do anything, we need to write a script. For this example, we’re using <a href="https://docs.godotengine.org/en/stable/getting_started/scripting/gdscript/gdscript_basics.html#">GDScript</a>, but other scripting language options are available.</p><p>You create a script on an object by right-clicking the object in the scene outline and selecting <strong>Attach Script</strong> or selecting the node and clicking the script with the green plus sign at the top. Select the <em>Player</em> node and attach a script, saving it to <strong>Scenes/Player/Player.gd</strong>. You can leave all the settings at the defaults.</p><p>Here’s the script:</p><pre class="crayon-plain-tag">extends KinematicBody2D export var speed: int = 220 onready var _collision_x_extents: int = get_node("CollisionShape2D").shape.extents.xonready var _screen_size: Vector2 = get_viewport_rect().size func _process(delta: float) -> void: var velocity: Vector2 = Vector2() var changed: bool = false if Input.is_action_pressed("input_right"): velocity.x += 1 changed = true if Input.is_action_pressed("input_left"): velocity.x -= 1 changed = true if !changed: return if velocity.length() > 0: velocity = velocity.normalized() * speed position += velocity * delta position.x = clamp(position.x, 0 + _collision_x_extents, _screen_size.x - _collision_x_extents) position.y = clamp(position.y, 0, _screen_size.y)</pre><p></p><p>Line 3 declares <em>speed</em> as an exported variable which means that instances of this scene can override this value. We’ll see that in the next section when we add the player to the scene. This variable controls how fast the player moves left and right.</p><p>The <strong>onready</strong> variables just cache a couple of things so we don’t have to get them every time we run the <em>_process()</em> method.</p><p>In <em>_process()</em>, all we’re doing is checking for input (the input keys we set up earlier) and adjusting our location if it has changed. We use <em>clamp()</em> and our collision’s extents to ensure that we stay within the bounds of the window.</p><p>That’s it!</p><h4>Add Player To Main Scene</h4><p>To add an instance of our player scene to the main one, select our Main scene. Right-click the Main node and choose <strong>Instance Child Scene</strong>. Select our <em>Player.tscn</em>.</p><p>The player shows up in the upper-left of the window, so move it to somewhere more reasonable like the lower-middle of the screen.</p><p>Now we can adjust the speed of our player by changing it in the Inspector on the right. Here I’ve changed it to <em>250</em>.</p><p><div id="attachment_2425" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Add-Player-To-Main-Scene.png"><img aria-describedby="caption-attachment-2425" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Add-Player-To-Main-Scene-1024x735.png" alt="Space Thing - Add Player To Main Scene" width="700" height="502" class="size-large wp-image-2425" /></a><p id="caption-attachment-2425" class="wp-caption-text">Space Thing – Add Player To Main Scene</p></div></p><p>Now we can run the game by clicking the play button at the top (or by using the keyboard shortcut <kbd>⌘</kbd>+<kbd>r</kbd> on macOS – probably <kbd>ctrl</kbd>+<kbd>r</kbd> on Windows?) and you should be able to move left and right with the <kbd>a</kbd> and <kbd>d</kbd> keys.</p><p><div id="attachment_2434" style="width: 285px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Player-Moving.gif"><img aria-describedby="caption-attachment-2434" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Player-Moving.gif" alt="Space Thing - Player Moving" width="275" height="374" class="size-full wp-image-2434" /></a><p id="caption-attachment-2434" class="wp-caption-text">Space Thing – Player Moving</p></div></p><p>Time to add a scrolling background!</p><h3>Background Scene</h3><p>Select <strong>New Scene</strong> from the <strong>Scene</strong> menu, add a <em>ParallaxBackground</em> node, and change the name to <em>Background</em>.</p><p>Create a new node on the Background of type <a href="https://docs.godotengine.org/en/stable/classes/class_parallaxlayer.html">ParallaxLayer</a> and then create a Sprite as a child of it. Rename the node <em>NebulaLayer</em>.</p><p>You should have this set up:</p><p><div id="attachment_2441" style="width: 432px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Background-Setup.png"><img aria-describedby="caption-attachment-2441" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Background-Setup.png" alt="Space Thing - Background Setup" width="422" height="310" class="size-full wp-image-2441" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Background-Setup.png 422w, https://asmaloney.com/images/2021/02/Space-Thing-Background-Setup-300x220.png 300w" sizes="(max-width: 422px) 100vw, 422px" /></a><p id="caption-attachment-2441" class="wp-caption-text">Space Thing – Background Setup</p></div></p><p>Our <em>NebulaLayer</em> is going to scroll slowly in the background from top to bottom which will make it look like the spaceship is moving forward.</p><p>Save the new scene in <strong>Scenes/Background</strong> (you will need to create this directory).</p><p>For the background, I’m going to use an image from the <a href="https://screamingbrainstudios.itch.io/seamless-space-backgrounds">Seamless Space Backgrounds</a> pack from <a href="https://screamingbrainstudios.itch.io/">Screaming Brain Studios</a>. I’m using one of the purple nebulae from the <em>Large 1024×1024</em> pack, but you can use whichever you like.</p><p>Create the <strong>Scenes/Background/assets/images</strong> directory and drag the nebula image to it.</p><p>Now select <em>NebulaLayer</em>‘s Sprite and add the nebula image as its texture by dragging it over from the FileSystem tab in the lower-left. You’ll notice that it is created partially off the viewport, so we need to change it’s location. In <strong>Node2D -> Transform -> Position</strong>, change it to 512, 512 (half the image width and height).</p><p>Here’s what it should look like:</p><p><div id="attachment_2444" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Background.png"><img aria-describedby="caption-attachment-2444" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Background-1024x735.png" alt="Space Thing - Nebula Background" width="700" height="502" class="size-large wp-image-2444" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Background-1024x735.png 1024w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Background-300x215.png 300w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Background-1536x1103.png 1536w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Background-2048x1470.png 2048w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Background-700x503.png 700w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2444" class="wp-caption-text">Space Thing – Nebula Background</p></div></p><h4>Add Background To Main Scene</h4><p>Let’s add the background to the main scene so it shows up when we run the game.</p><p>Go back to your <em>Main</em> scene, right-click the Main node and choose <strong>Instance Child Scene</strong>. Select our <em>Background.tscn</em>. Click and drag it to the top of the list so it comes before Player. Your hierarchy should look like this:</p><p><div id="attachment_2443" style="width: 506px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Main-Final-Setup.png"><img aria-describedby="caption-attachment-2443" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Main-Final-Setup.png" alt="Space Thing - Main Setup" width="496" height="308" class="size-full wp-image-2443" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Main-Final-Setup.png 496w, https://asmaloney.com/images/2021/02/Space-Thing-Main-Final-Setup-300x186.png 300w" sizes="(max-width: 496px) 100vw, 496px" /></a><p id="caption-attachment-2443" class="wp-caption-text">Space Thing – Main Setup</p></div></p><p>You’ll notice if you run the game now, the background shows up, but it’s static.</p><h4>Make it Scroll!</h4><p>Finally, the thing you probably came here for – making the background scroll continuously from top-to-bottom.</p><p>To do this, we need to add a little script to our Background, so go back to the <em>Background</em> scene (by clicking the little clapboard next to the node, by selecting the tab across the top of the main editor, or by double-clicking it in the FileSystem tab).</p><p>Select the <em>Background</em> node and click the scroll with the green plus sign at the top of the scene outline. Save it as <strong>Background/Background.gd</strong>.</p><p>Here’s the script:</p><pre class="crayon-plain-tag">extends ParallaxBackground export var camera_velocity: Vector2 = Vector2( 0, 100 ); func _process(delta: float) -> void: var new_offset: Vector2 = get_scroll_offset() + camera_velocity * delta set_scroll_offset( new_offset )</pre><p></p><p>The export in line 4 will let us set the speed of the scrolling from the editor. It is set by default to scroll only in the y direction.</p><p>In the <em>_process()</em> method, we are simply modifying the scroll_offset property of the ParallaxBackground based on the velocity and the current tick delta.</p><p>If you run the game now, the background scrolls, but it doesn’t repeat, so it just scrolls off the screen!</p><p>To fix this, we need to let our <em>NebulaLayer</em> know how to repeat the texture. Select the NebulaLayer and in the Inspector, expand the <strong>Motion</strong> section. The property we need to set is called <a href="https://docs.godotengine.org/en/stable/classes/class_parallaxlayer.html#class-parallaxlayer-property-motion-mirroring">motion_mirroring</a>.</p><p>Since we aren’t scrolling in the x direction we leave that at 0. In the y direction we need to set this to the height of our texture – 1024. You will notice that the editor reflects this by showing another copy of the texture below the first one.</p><p><div id="attachment_2448" style="width: 710px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Mirroring.png"><img aria-describedby="caption-attachment-2448" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Mirroring-1024x735.png" alt="Space Thing - Nebula Mirroring" width="700" height="502" class="size-large wp-image-2448" srcset="https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Mirroring-1024x735.png 1024w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Mirroring-300x215.png 300w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Mirroring-1536x1103.png 1536w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Mirroring-2048x1470.png 2048w, https://asmaloney.com/images/2021/02/Space-Thing-Nebula-Mirroring-700x503.png 700w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2448" class="wp-caption-text">Space Thing – Nebula Mirroring</p></div></p><p>Now try running the game.</p><p><div id="attachment_2451" style="width: 301px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2021/02/Space-Thing-Final.gif"><img aria-describedby="caption-attachment-2451" decoding="async" loading="lazy" src="https://asmaloney.com/images/2021/02/Space-Thing-Final.gif" alt="Space Thing - Final" width="291" height="400" class="size-full wp-image-2451" /></a><p id="caption-attachment-2451" class="wp-caption-text">Space Thing – Final</p></div></p><p>Voila! A vertical, infinitely scrolling, parallax background suitable for an old-school video game.</p><h3>Where To Go From Here</h3><p>There are lots of things you can play with! Some suggestions:</p><ul><li>add another <a href="https://docs.godotengine.org/en/stable/classes/class_parallaxlayer.html">ParallaxLayer</a> in between the player and the nebula that scrolls at a different speed (a star field perhaps?)</li><li>allow some forward/backward movement and have it affect the background scroll speed</li><li>mirror the background in the x direction as well and when the player hits the edges, scroll in the x direction</li></ul><h3>Conclusion</h3><p>It’s a very simple thing, and this turned out to be quite long, but I wrote it up because it wasn’t easy to find how to do this through all the different videos, hacks, and snippets.</p><p>I hope that this is useful to someone out there in the world. As always, if there are better ways to do any of this, or if I did anything incorrectly, please let me know!</p><p>The complete project may be <a href="https://github.com/asmaloney/SpaceThing">found on GitHub</a>.</p><p>Go forth and create!</p>]]></content:encoded> <wfw:commentRss>https://asmaloney.com/2021/02/code/vertical-scrolling-parallax-backgrounds-in-godot/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item> <title>Notarizing Older Unity Games On macOS</title> <link>https://asmaloney.com/2020/03/howto/notarizing-older-unity-games-on-macos/</link> <comments>https://asmaloney.com/2020/03/howto/notarizing-older-unity-games-on-macos/#comments</comments> <dc:creator><![CDATA[Andy Maloney]]></dc:creator> <pubDate>Mon, 09 Mar 2020 13:19:29 +0000</pubDate> <category><![CDATA[Games]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[game engine]]></category> <category><![CDATA[games]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[hex editor]]></category> <category><![CDATA[macOS]]></category> <category><![CDATA[notarization]]></category> <category><![CDATA[Unity]]></category> <category><![CDATA[Unity Game Engine]]></category> <guid isPermaLink="false">https://asmaloney.com/?p=2211</guid> <description><![CDATA[Over the past couple of months I have been porting an existing Unity game to macOS. It is a shoot-em-up called Blue Rider developed by Ravegan from Córdoba, Argentina. It was originally released on PC (Steam), XBox, Playstation 4, and Switch. I spent quite a lot of time getting it ported and running smoothly only […]]]></description> <content:encoded><![CDATA[<p>Over the past couple of months I have been porting an existing Unity game to macOS. It is a shoot-em-up called <a href="https://ackackgames.com/bluerider/">Blue Rider</a> developed by <a href="https://ravegan.com/">Ravegan</a> from Córdoba, Argentina. It was originally released on <a href="https://store.steampowered.com/app/402340/Blue_Rider/">PC (Steam)</a>, <a href="https://www.microsoft.com/p/blue-rider/c10vstxqh606">XBox</a>, <a href="https://www.playstation.com/games/blue-rider-ps4/">Playstation 4</a>, and <a href="https://www.nintendo.com/games/detail/blue-rider-switch/">Switch</a>.</p><p><a href="/images/2020/01/Blue_Rider_Logo_Square_770x600.jpg"><img decoding="async" loading="lazy" src="/images/2020/01/Blue_Rider_Logo_Square_770x600-300x234.jpg" alt="Blue Rider Logo" width="300" height="234" class="aligncenter size-medium wp-image-2174" srcset="https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600-300x234.jpg 300w, https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600-700x545.jpg 700w, https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600.jpg 770w" sizes="(max-width: 300px) 100vw, 300px" /></a></p><p>I spent quite a lot of time getting it ported and running smoothly only to find that I couldn’t get past Apple’s <a href="https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution">notarization</a> procedure because of the version of Unity I am using (5.6.7f1).</p><blockquote><p>The binary uses an SDK older than the 10.9 SDK.</p></blockquote><p>Notarization is required as of macOS 10.15 to distribute games in the Apple Store and it may become necessary on Steam. It may also be useful to notarize games for standalone distribution to avoid confusing warnings when users try to run your game.</p><p>(I am going to hold off a whole rant about Apple and their BS requirement to do this code signing/notarization at all. And I will try not to rant too much about their incredibly complicated process, documentation, and implementation.)</p><p>In this post I’ll describe the main problem I ran into and how I solved it. Hopefully it will help someone else.</p><p><span id="more-2211"></span></p><h2>Update – 27 December 2020</h2><p>It looks like Unity fixed this in the last 2017 LTS version – <b>2017.4.40f1</b>.</p><p>According to the <a href="https://unity3d.com/unity/qa/lts-releases?version=2017.4">release notes</a>:</p><blockquote><p>macOS: Fixed case where notarization would complain about mono being compiled with a older macOS SDk thus not allowing you to notarize your game.</p></blockquote><p>So if you can, your best bet is to update to that version.</p><h2>Disclaimer</h2><p>While the solution I propose allows a game to pass the notarization process, games based on Unity 5.6.7f1 (and, it seems, games based on Unity 2017.4 LTS) will not pass certification for the Apple Store. </p><p>When run on macOS 10.15, we now get this:</p><p><img decoding="async" loading="lazy" src="https://asmaloney.com/images/2020/03/macOS-Keystroke-Receiving.png" alt="macOS Keystroke Receiving dialog" width="464" height="173" class="aligncenter size-full wp-image-2282" srcset="https://asmaloney.com/images/2020/03/macOS-Keystroke-Receiving.png 464w, https://asmaloney.com/images/2020/03/macOS-Keystroke-Receiving-300x112.png 300w" sizes="(max-width: 464px) 100vw, 464px" /></p><blockquote><p>“Blue Rider” would like to receive keystrokes from any application.</p></blockquote><p>WTF?</p><p>Apparently this is because Unity uses an API that Apple no longer allows in the Apple Store, and Unity has not fixed either the 5.6 or the 2017 LTS version to replace it.</p><p>As far as I can tell right now, there is no way around this other than to update the Unity version but <a href="https://forum.unity.com/threads/mac-build-rejected-due-for-requesting-for-accessibility-access-for-keystrokes.758789/">it is unclear what versions actually work</a>.</p><p>So while the solution in this post doesn’t seem to help with Apple Store certification, it will let you notarize your Unity 5.6.7f1 or Unity 2017.4 LTS based game for Steam or for standalone distribution.</p><h2>The Problem</h2><p>Once I worked my way through all the docs to figure out which certificates I needed for signing (one if you are submitting to the Apple Store, a different one if you are not!), what needed to be signed (the <i>–deep</i> option didn’t actually sign everything?), removing files that messed up signing (apparently <i>*.meta</i> files confuse it!), and then figuring out how to notarize on the command-line (‘<a href="https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow">xcrun altool</a>‘?), I finally got to upload Blue Rider to Apple to try the notarization itself.</p><p>After running <em>altool</em>, waiting for an email to tell me the result (!), running yet another command on the command-line to get a link to the actual error log, then opening that in a browser (why not link directly in the email?), I found I had the following errors:</p><p></p><pre class="crayon-plain-tag">{ "logFormatVersion": 1, "jobId": "4cab0083-8d3e-4b81-81b4-8cc2599154a8", "status": "Invalid", "statusSummary": "Archive contains critical validation errors", "statusCode": 4000, "archiveFilename": "Blue_Rider.zip", "uploadDate": "2020-02-10T13:31:41Z", "sha256": "<sha>", "ticketContents": null, "issues": [ { "severity": "error", "code": null, "path": "Blue Rider.app/Contents/Frameworks/MonoEmbedRuntime/osx/libMonoPosixHelper.dylib", "message": "The binary uses an SDK older than the 10.9 SDK.", "docUrl": null, "architecture": "x86_64" }, { "severity": "error", "code": null, "path": "Blue Rider.app/Contents/Frameworks/MonoEmbedRuntime/osx/libmono.0.dylib", "message": "The binary uses an SDK older than the 10.9 SDK.", "docUrl": null, "architecture": "x86_64" } ]}</pre><p></p><p>These two <a href="https://www.mono-project.com/">Mono</a> libraries are added to the application by the Unity build process. The only “proper” way to update them is to update Unity. When you have a complete, tested game that’s almost ready-to-go, this is not a great option.</p><p>I poked around to see how other people handled this and it turns out Unity’s 2017 LTS (Long Term Support) version will not notarize because of this, and it’s possible the 2018 LTS does not work either. So many people using older versions of Unity are at the mercy of Unity’s support team to fix this problem.</p><p>Apple’s requirements are ridiculous and they don’t tend to respond to developers, and Unity likely won’t fix this—especially for older versions—so we developers are stuck in the middle.</p><p>Maybe we can hack it?</p><h2>The Analysis</h2><p>The first thing was to look at the dynamic library to see what’s up.</p><p></p><pre class="crayon-plain-tag">$ otool -l "Blue Rider.app/Contents/Frameworks/MonoEmbedRuntime/osx/libmono.0.dylib"</pre><p></p><p>Among the output is the following:</p><p></p><pre class="crayon-plain-tag">Load command 8 cmd LC_VERSION_MIN_MACOSX cmdsize 16 version 10.6 sdk 10.6</pre><p></p><p>So these libraries were compiled with a really old SDK, which is fine, but they also set the minimum SDK to 10.6 and this is what’s causing our problem.</p><p>Since Unity is closed-source, we cannot just recompile these libraries with an updated minimum SDK, but maybe we can change the library’s load command to a more recent SDK version?</p><h2>A Solution</h2><p>I pulled out my trusty hex editor – <a href="https://ridiculousfish.com/hexfiend/">Hex Fiend</a>. The number “10.6.0” is stored as the integers “0 6 10” (backwards because of endianness), so I looked for <strong>00060A00</strong> in hex and found where it repeated (“version” and “sdk” in the output of <em>otool</em> above).</p><p><a href="/images/2020/02/mono-Hex-Fiend-1.png"><img decoding="async" loading="lazy" src="/images/2020/02/mono-Hex-Fiend-1-300x209.png" alt="Finding text in mono dylib using Hex Fiend" width="300" height="209" class="aligncenter size-medium wp-image-2236" srcset="https://asmaloney.com/images/2020/02/mono-Hex-Fiend-1-300x209.png 300w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-1-1024x712.png 1024w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-1-1536x1068.png 1536w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-1-700x487.png 700w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-1.png 1858w" sizes="(max-width: 300px) 100vw, 300px" /></a></p><p>Then I edited the second one (the SDK version) to be 10.9 (<strong>00090A00</strong>):</p><p><a href="/images/2020/02/mono-Hex-Fiend-2.png"><img decoding="async" loading="lazy" src="/images/2020/02/mono-Hex-Fiend-2-300x209.png" alt="Replacing Text In Mono dylib Using Hex Fiend" width="300" height="209" class="aligncenter size-medium wp-image-2237" srcset="https://asmaloney.com/images/2020/02/mono-Hex-Fiend-2-300x209.png 300w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-2-1024x712.png 1024w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-2-1536x1068.png 1536w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-2-700x487.png 700w, https://asmaloney.com/images/2020/02/mono-Hex-Fiend-2.png 1858w" sizes="(max-width: 300px) 100vw, 300px" /></a></p><p>After re-signing the application to account for these changes, and re-submitting for notarization, it was successful.</p><p><div id="attachment_2233" style="width: 310px" class="wp-caption aligncenter"><a href="/images/2020/02/macOS-Notarization-Success.png"><img aria-describedby="caption-attachment-2233" decoding="async" loading="lazy" src="/images/2020/02/macOS-Notarization-Success-300x111.png" alt="macOS Notarization Success" width="300" height="111" class="size-medium wp-image-2233" srcset="https://asmaloney.com/images/2020/02/macOS-Notarization-Success-300x111.png 300w, https://asmaloney.com/images/2020/02/macOS-Notarization-Success-1024x377.png 1024w, https://asmaloney.com/images/2020/02/macOS-Notarization-Success-1536x566.png 1536w, https://asmaloney.com/images/2020/02/macOS-Notarization-Success-700x258.png 700w, https://asmaloney.com/images/2020/02/macOS-Notarization-Success.png 1688w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2233" class="wp-caption-text">Success!</p></div></p><h2>Another (Perhaps More Robust) Solution</h2><p>After I’d got it working I looked around to see how else this might be done and I found a <a href="https://gist.github.com/lynnlx/1c15f290383c750abdd9d42e70bd32e4">gist on GitHub</a> that does exactly what we want. (<b>Note 2 June 2020</b>: The gist no longer exists – I have put up a repository with the code <a href="https://github.com/asmaloney/fix_LC_VERSION_MIN_MACOSX">here</a>.)</p><p>This little command-line tool <a href="https://en.wikipedia.org/wiki/Mmap">mmap</a>s the binary, finds the load command in the <a href="https://en.wikipedia.org/wiki/Mach-O">Mach-O</a> header, and updates it to 10.9 if it is less than 10.9.</p><p>To use it, just download the code and compile it like this:</p><p></p><pre class="crayon-plain-tag">gcc fix_LC_VERSION_MIN_MACOSX.c -o fixMonoMinVersion</pre><p></p><p>Then you can run it on the Mono dynamic libraries:</p><p></p><pre class="crayon-plain-tag">fixMonoMinVersion "<My Game>.app/Contents/Frameworks/MonoEmbedRuntime/osx/libmono.0.dylib"fixMonoMinVersion "<My Game>.app/Contents/Frameworks/MonoEmbedRuntime/osx/libMonoPosixHelper.dylib"</pre><p></p><p>This is great because I can add this process to the command-line scripts I use to build, sign, package, and notarize the game – no manual editing involved.</p><h2>Does It Work?</h2><p>So far, I have not found any issues during my testing of the game after these changes.</p><p>I cannot find any info online as to whether this is a “safe” thing to do or not. macOS does not include all previous SDKs, yet older apps run. So I believe that the SDK number here is more of a hint.</p><p>I would love to know more detail about how this works, so if you know anything about it, please comment below or <a href="/contact/">contact me</a>.</p><blockquote><p>Caveat Emptor!</p><p>I assume no responsibility if these changes trash your car, burn down your house, or blow up your computer. </p><p>Use at your own risk and…</p><p>Test, test, test!</p></blockquote><h2>Slight Aside – LSMinimumSystemVersion</h2><p>With macOS applications, it’s proper form to include a minimum version in its <em>Info.plist</em> file. Something like this:</p><p></p><pre class="crayon-plain-tag"><key>LSMinimumSystemVersion</key><string>10.10</string></pre><p></p><p>With this, the application will refuse to run on any older version of the OS.</p><p>The version of Unity I’m using (5.6.7f1) does not include this, though I think later versions might.</p><p>If you are using an old version of Unity, you can use the following command-line to add it:</p><p></p><pre class="crayon-plain-tag">plutil -insert LSMinimumSystemVersion -string "10.10" "<My Game>.app/Contents/info.plist"</pre><p></p><p>(Change “10.10” to whatever minimum you want to support.)</p><p>You will need to do this before you sign the application.</p><p>I have added this as part of my build scripts so it’s done automatically every time I do a build. (* Except that <a href="https://fogbugz.unity3d.com/default.asp?1223966_3ptvrjejn50n12pj">my build scripts no longer work</a> when I try to update to Unity 2017.4 LTS.)</p><h2>Fin</h2><p>If you try this with your project, please let me know how it goes in the comments below or by <a href="/contact/">contacting me</a>.</p><p>If you found this post useful and want to support this project, please sign up for the <a href="https://ackackgames.com/newsletter/">Blue Rider mailing list</a> and consider buying the game when it’s released!</p>]]></content:encoded> <wfw:commentRss>https://asmaloney.com/2020/03/howto/notarizing-older-unity-games-on-macos/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item> <title>Using Unity’s ShaderVariantCollection</title> <link>https://asmaloney.com/2020/01/code/using-unitys-shadervariantcollection/</link> <comments>https://asmaloney.com/2020/01/code/using-unitys-shadervariantcollection/#comments</comments> <dc:creator><![CDATA[Andy Maloney]]></dc:creator> <pubDate>Mon, 27 Jan 2020 19:16:29 +0000</pubDate> <category><![CDATA[Code]]></category> <category><![CDATA[Games]]></category> <category><![CDATA[HowTo]]></category> <category><![CDATA[C++]]></category> <category><![CDATA[game engine]]></category> <category><![CDATA[games]]></category> <category><![CDATA[optimization]]></category> <category><![CDATA[profiling]]></category> <category><![CDATA[Unity]]></category> <category><![CDATA[Unity Game Engine]]></category> <guid isPermaLink="false">https://asmaloney.com/?p=2142</guid> <description><![CDATA[Recently I have been working on porting an existing Unity game to macOS. It is a shoot-em-up called Blue Rider developed by Ravegan from Córdoba, Argentina. It was originally released on PC (Steam), XBox, Playstation 4, and Switch. The main things I needed to work on to bring Blue Rider to macOS were the menu […]]]></description> <content:encoded><![CDATA[<p>Recently I have been working on porting an existing Unity game to macOS. It is a shoot-em-up called <a href="https://ackackgames.com/bluerider/">Blue Rider</a> developed by <a href="https://ravegan.com/">Ravegan</a> from Córdoba, Argentina. It was originally released on <a href="https://store.steampowered.com/app/402340/Blue_Rider/">PC (Steam)</a>, <a href="https://www.microsoft.com/p/blue-rider/c10vstxqh606">XBox</a>, <a href="https://www.playstation.com/games/blue-rider-ps4/">Playstation 4</a>, and <a href="https://www.nintendo.com/games/detail/blue-rider-switch/">Switch</a>.</p><p><a href="https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600.jpg"><img decoding="async" loading="lazy" src="https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600-300x234.jpg" alt="Blue Rider Logo" width="300" height="234" class="aligncenter size-medium wp-image-2174" srcset="https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600-300x234.jpg 300w, https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600-700x545.jpg 700w, https://asmaloney.com/images/2020/01/Blue_Rider_Logo_Square_770x600.jpg 770w" sizes="(max-width: 300px) 100vw, 300px" /></a></p><p>The main things I needed to work on to bring Blue Rider to macOS were the menu system, the resolution handling, the input handling, and some optimizations to achieve a smooth framerate.</p><p>(<strong>Note:</strong> I’m using <em>Unity 5.6.7f1</em> since Blue Rider was written using a 5.x version. I’m not 100% sure, but based on the current documentation, I think what I’m doing here still applies with recent versions.)</p><h2>The Problem</h2><p>One such optimization had to do with shaders. The game was hitching sometimes when an enemy appeared and when it exploded. It only seemed to happen some times and with some enemies.</p><p>I’ll explain what I found when I broke out the profiler and then I’ll provide one possible solution using <em><a href="https://docs.unity3d.com/ScriptReference/ShaderVariantCollection.html">ShaderVariantCollection</a></em>.</p><p><span id="more-2142"></span></p><h2>The Analysis</h2><p>I fired up the profiler and ran through the game until I saw spikes when an enemy appeared and when it died.</p><div style="width: 640px; margin: 1em auto;"><iframe loading="lazy" width="640" height="360" src="https://www.youtube-nocookie.com/embed/R0RgaehyDeY" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div><p>The profiler identified the culprit as <em>Shader.EditorLoadVariant</em>.</p><p><div id="attachment_2179" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant.png"><img aria-describedby="caption-attachment-2179" decoding="async" loading="lazy" src="https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant-300x132.png" alt="Unity Profile - Shader.EditorLoadVariant" width="300" height="132" class="size-medium wp-image-2179" srcset="https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant-300x132.png 300w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant-1024x451.png 1024w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant-1536x677.png 1536w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant-700x309.png 700w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant-1200x529.png 1200w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.EditorLoadVariant.png 1974w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2179" class="wp-caption-text">Unity Profile – Shader.EditorLoadVariant</p></div></p><p>Specifically it’s the compilation of shader variants – <em>Shader.CreateGPUProgram</em>. </p><p><div id="attachment_2178" style="width: 310px" class="wp-caption aligncenter"><a href="https://asmaloney.com/images/2020/01/Unity-Profile-Shader.CreateGPUProgram.png"><img aria-describedby="caption-attachment-2178" decoding="async" loading="lazy" src="https://asmaloney.com/images/2020/01/Unity-Profile-Shader.CreateGPUProgram-300x133.png" alt="Unity Profile - Shader.CreateGPUProgram" width="300" height="133" class="size-medium wp-image-2178" srcset="https://asmaloney.com/images/2020/01/Unity-Profile-Shader.CreateGPUProgram-300x133.png 300w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.CreateGPUProgram-1024x452.png 1024w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.CreateGPUProgram-1536x679.png 1536w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.CreateGPUProgram-700x309.png 700w, https://asmaloney.com/images/2020/01/Unity-Profile-Shader.CreateGPUProgram.png 1974w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-2178" class="wp-caption-text">Unity Profile – Shader.CreateGPUProgram</p></div></p><p>The game is asking to use a variant of a shader that it hasn’t compiled yet, so it compiles it immediately. Because this process is slow it can’t fit into one frame, so the game feels like it pauses and then tries to catch up. This is known as “hitching”.</p><p>This normally happens only the first time a shader variant is compiled. Subsequent uses during the same run are either in memory or are cached. Unfortunately, Unity doesn’t seem to cache these compiled shaders between runs, so it happens every time you run the game.</p><p>After a lot of searching and reading online, there didn’t seem to be any answers to the questions in <a href="https://forum.unity.com/threads/shadervariantcollection-best-practises.455447/">this post</a>.</p><h2>A Solution</h2><p>The game I’m working on has hundreds of objects and many shaders & shader variants, so a per-object solution seemed challenging. The solution I came up with was to use a <em><a href="https://docs.unity3d.com/ScriptReference/ShaderVariantCollection.html">ShaderVariantCollection</a></em> for each of the game’s levels.</p><p>(That seems to be the entire official documentation on these—please let me know if I’ve missed something).</p><h3>Generating The Collections</h3><p>From the docs:</p><blockquote><p>Typical use of ShaderVariantCollection is to record the shader variants used during a play session from the editor (under Graphics Settings), save them out as an asset, and add to the list of preloaded shaders (again in Graphics Settings). Additionally, you could call WarmUp on a ShaderVariantCollection object manually.</p></blockquote><p>I chose to create one shader variant collection per level and then load them & call <em>WarmUp</em> at the beginning of each level. To start with, I created a folder in <em>Assets/Resources</em> to save these files. Putting it in <em>Resources</em> ensures that Unity will include these files in the build. I chose to put them in <strong>Assets/Resources/Shaders/Levels</strong>.</p><p>In the graphics settings, the tools we want are at the very bottom of the panel:</p><p><a href="https://asmaloney.com/images/2020/01/Unity-Graphics-Settings-Shader-Preloading.png"><img decoding="async" loading="lazy" src="https://asmaloney.com/images/2020/01/Unity-Graphics-Settings-Shader-Preloading-300x94.png" alt="Unity Graphics Settings - Shader Preloading" width="300" height="94" class="aligncenter size-medium wp-image-2170" srcset="https://asmaloney.com/images/2020/01/Unity-Graphics-Settings-Shader-Preloading-300x94.png 300w, https://asmaloney.com/images/2020/01/Unity-Graphics-Settings-Shader-Preloading-700x219.png 700w, https://asmaloney.com/images/2020/01/Unity-Graphics-Settings-Shader-Preloading.png 862w" sizes="(max-width: 300px) 100vw, 300px" /></a></p><p>For each level:</p><ol><li>Just before you start your level, click the <strong>Clear</strong> button.</li><li>Play through the level, triggering as many things as you can. You want the game to load all possible shaders & shader variants for the level.</li><li>When you’re done, click the <strong>Save to asset…</strong> button.</li><li>Save the level’s collection to the folder we created above (<em>Assets/Resources/Shaders/Levels</em>) using the level name so we can find it later on. In my project this would be “map_01.shadervariants”, “map_02.shadervariants”, etc..</li></ol><p>Once you’ve done that, you should have one “.shadervariants” file per level.</p><p>Keep in mind that if you change your level, you may need to do this all over again for that level. (This is why, in my opinion, this is a hacky solution. Unity doesn’t provide any real tools for managing these collections more intelligently.)</p><h3>Using The Collections</h3><p>Now that we have the files, we simply have to load them after we have loaded each level.</p><p>On the <a href="https://docs.unity3d.com/ScriptReference/MonoBehaviour.html">MonoBehaviour</a> responsible for loading levels, I created a method called <i>OnSceneFinishedLoading</i> to be called when a scene is finished loading, and added it to the SceneManager’s <a href="https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager-sceneLoaded.html">sceneLoaded</a> event:</p><p></p><pre class="crayon-plain-tag">SceneManager.sceneLoaded += OnSceneFinishedLoading;</pre><p></p><p>Here’s the <i>OnSceneFinishedLoading</i> method:</p><p></p><pre class="crayon-plain-tag">void OnSceneFinishedLoading( Scene scene, LoadSceneMode mode ){ Debug.Log( "Scene loaded: " + scene.name ); var path = "Shaders/Levels/" + scene.name; var collection = Resources.Load<ShaderVariantCollection>( path ); if ( collection != null ) { Debug.Log( "Shaders/variants: " + collection.shaderCount + "/" + collection.variantCount ); collection.WarmUp(); Resources.UnloadAsset( collection ); }}</pre><p></p><p>I’m loading the collection from the Resources based on the name of the level. If the resource is found and is of the correct type, I call <em>WarmUp</em> on the shader variant collection to compile the shader variants. Finally, I unload the collection since we don’t need it anymore.</p><p>Unfortunately, the <em>ShaderVariantCollection</em> class is very basic and doesn’t give us access to the contents in any significant way. We cannot, for example, create a loading bar for it, get a list of the variants it contains, or get the details of the variants to do anything with them. If we had those capabilities it would be possible to build a more intelligent editor tool to work with them.</p><h2>The Result</h2><p>Doing things this way may result in a bit of a delay at the beginning of the level, but it’s less noticeable since we’re doing all the other level loading around the same time; it also prevents hitching during gameplay which is most important.</p><p>This may not be the only solution! As a relative newcomer to Unity and C#, it’s quite possible that I’ve missed something. If you have any suggestions or corrections, please feel free to <a href="/contact/">contact me</a> or comment below.</p>]]></content:encoded> <wfw:commentRss>https://asmaloney.com/2020/01/code/using-unitys-shadervariantcollection/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel></rss> If you would like to create a banner that links to this page (i.e. this validation result), do the following:
Download the "valid RSS" banner.
Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)
Add this HTML to your page (change the image src attribute if necessary):
If you would like to create a text link instead, here is the URL you can use:
http://www.feedvalidator.org/check.cgi?url=http%3A//asmaloney.com/feed/