Resolving build issues for UWP packages with Unity

If you are building games and projects in Unity and targeting the Universal Windows Platform (UWP), you may have noticed than in the recent Unity releases this was actually broken. What you end up seeing in your build UWP project in visual studio is the following error:

If you dig further, you may also expose the underlying error code here:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at UnityEditor.Scripting.Compilers.NuGetPackageResolver.Resolve()
at Unity.NuGetAssemblyResolver..ctor(String projectLockFile)
at usw.Weaver.ReaderParameters(String assemblyPath, ConversionOptions options)
at usw.Weaver.Weave()
at usw.Program.RunProgram(ConversionOptions options)
at usw.Program.Main(String[] args)

This prevents you building / updating projects from Unity to the UWP Platform.

Once discovered, both Unity and Microsoft worked closely together to resolve the issues and updated their respective parts as quickly as possible.

Fixing the problem

The fix for this problem is fairly easy. However, it is a little time consuming (unless you have a mega fast download connection) as mostly it requires updating to the latest Unity and Visual Studio patch releases.

1: Install Unity 2017.1p5or 2017.2.0f3

The first step, is to simply update your installation of Unity:

If you are on Unity 2017, then this is2017.1p5(or newer)

If you are on Unity 2017.2, then this is2017.2.0f3(or newer)

For the 5.x cycle, just update to the latest patch (although I haven’t tested this)

This will update both Unity and your install of the Visual Studio Tools for Unity

2: Update VS 2017 to15.3.3

Once Unity is up to date, you will need to update your installation of Visual Studio. If you are still on VS 2015, then there is no action but you won’t be able to build UWP packages targeting the newer Creators update and won’t be able to build Mixed Reality platform.

I highly recommend updating to 2017, even the free Community edition of 2017 (which is free) if you are doing UWP development. It’s just better.

To update Visual Studio 2017, simple close all open instances of Visual Studio and launch theVisual Studio Installer

Once it’s running (the first step may be to update the installer first), simply hit “Update” on your specific instance of Visual Studio (the installer will happily update ALL installed instances if you wish) and once it’s complete you will be on the latest version.

Open Visual Studio to verify, click “Help –> About Visual Studio” in the menu and you should be running15.3.3(or newer). If not, check your internet connection and try running the installer again.

3: (Optional)Set player settings for project to .NET & .NET4.6
(NOT IL2CPP, XBL project does not have support for IL2CPP, yet)

Not strictly required but highly recommended for UWP projects, is to update the.NET ApiCompatibilityLevelthat is used in your built project. This allows you to use more modern C# 6 functionality if you wish without causing errors when you build it in Unity.

To update this, open the Player Settings window in the editor using either “Edit –> Project Settings –> Player” in the editor menu, or using the“Player Settings” buttonon the “Build Settings” build window. In the Other section on this configuration page you will find the following settings.

Not to be confused with the “Scripting Runtime Version”, which I’m told breaks UWP project builds using Xbox Live (although I haven’t personally tested yet)

Quote

*Note, I'm not saying don't use IL2CPP (which is required for some Unity features, such as the new Post Processing stack) as it is a cleaner build. It's just NOT compatible with the Xbox-Live-Unity plugin at present.

4: Build project targeting UWP SDK 14393 or higher

To build for Modern UWP, you need to be targeting a minimum API level of 14393 (Anniversary Edition), For Mixed Reality builds you will need a minimum API level of 15063 (Creators Update). Either will work but you need to ensure you select the version that is right for your target. The current advice with new builds is to always target the latest but that is completely up to you.

You will find the SDK selection on the “Build Settings” screen when you have the “Universal Windows Platform” target selected:

5: Open project in VS

Once you have built your project, open it in Visual Studio to continue.

6:UPDATE NETCore NuGetpackage to 5.4+ <- without this, it still doesn’t work

In testing I have found this is critical still for existing projects or when you build your first (ever) UWP project, you need to have thelatest NETCore NuGet packagedownloaded and available else it will fail. you don’t have to update the other NuGet packages if you don’t want to (UWP Packages come bundled with the Application Insights NuGets for Windows Store integration for example), just the NETCore package.

When writing this article, I tried to replicate the error (after fixing it) and couldn’t generate the error even with new projects. This step may not actually be needed but I still Highly Recommend updating any and all NuGet packages in your built project.

If you are unsure as to what NuGet is,you can read all about it here. Basically, NuGet is a dependency manager for .NET solutions, allowing you to disconnect your project from the source of a dependency. It can then be updated independently without affecting your project (unless the API changes). You will find most modern .NET packages from Microsoft (like the .NET Framework) are now NuGet packages so they can more rapidly update the framework without having to build and distribute new MSI packages.

To check and update the versions of the NuGet packages,right-clickon the “Solution” in the “Solution Explorer” within Visual Studio and select “Manage NuGet Packages for Solution…”

Alternatively, you can also simply right-Clickthe “References” branch in your projects structure, also in the “Solution Explorer” in VS, this however will only show/update the NuGet’s installed in that single project and not the entire solution:

Once the NuGet manager is open you will see the installed NuGet packages, with a notification if any updates are available (provided you have an internet connection).

Simply select the NuGet package to update, NETCore in this case, select the version to update to on the right and click “Install”. You will then be walked through a set of screens to accept the license for that package (if one exists) and then a final “get out of jail free” accept or reject screen. Once complete, all the required references included in that package will be updated.

7: Build and Run for x64 only (x86 or Arm is a no go still)

With everything in place, all that is left is to build your project. By default, Unity still insists on selecting the ARM platform as the default (don’t know why but I guess it’s too small a thing to want to change), so you will need to update this to the x64 platform (don’t use x86 unless you really need it, most UWP systems all target x64 now). After that, you can build.

If you are unsure about which Solution Configuration to select (read, Build Type), remember what they are there for:

Debug

Used obviously for debugging, enables extra debugging information to be sent to an attached instance of Visual Studio (whether you run it from Visual Studio or just “attach” to it later). Will cause a performance hit when running but this is needed so you can walk through the code if there are any issues. It will also enable the debug window inside Unity to report errors to the screen should they occur.

Release

Builds the project but without all the debugging stuff. just runs your project. With Unity however, it’s keen to note you are still running your entire project with all the superfluous code that Unity has in a project. DO NOT SHIP THIS!!!

Master

This is a special Solution Configuration (just for Unity) that also runs code in Unity to strip mine unnecessary code / services and packages everything together neatly. This makes your Unity project run as fast as it can. <- SHIP/PUBLISH THIS!!!

All well and good

With everything in this article, you should have no further issues building your UWP projects and once you have gone through it at least once (I’ve found) you need not do it again (apart from updating NuGets, you should always do that)

User Feedback

In response to Tautvydas Zilys comments (who is an awesome member of the Unity team!)

1. I wouldn't recommend saying "no to IL2CPP" right away, especially if you haven't tried it. It is the future of scripting on UWP in Unity, and it is the default scripting backend for UWP in Unity 2017.2. We have no known issues with Xbox Live on IL2CPP, and there have been multiple games that shipped with IL2CPP and Xbox Live functionality. It also enables you to port your game to UWP much quicker compared to using .NET scripting backend, since you have exact same C# API surface on IL2CPP as other Unity platforms. On .NET, you only get a small "Microsoft blessed" subset of APIs.

(SJ) Updated article to highlight this only relates to IL2CPP use with the Xbox Live Unity plugin. There are many great features with IL2CPP that are worth exploring.

2. 2017.2p9 doesn't exist. I assume you meant 2017.2.0b9?

(SJ) I stand corrected. Also updated since 2017.2 is now released

3. "Not to be confused with the “Scripting Runtime Version”, which I’m told breaks UWP project builds" - that sounds like something that should be reported to us and addressed. I haven't heard anyone complain about this.

(SJ) Tested myself with the Xbox Live Unity plugin and it doesn't work. In fact any build attempting to use the Unity.Tasks DLL breaks using that build and makes Async inaccessible

4. There is only one reason to target Windows SDK 14393 or newer: if you want to use APIs added to that SDK. Using any SDK is perfectly valid for shipping a UWP game.

(SJ) Incorrect. Xbox LIVE is only supported from 14393 onwards. This article was solely about Xbox Live UWP support, not general UPWP support (which yes, you can use any build that meets your criteria)

Similar Content

For some gamers out there, platformer games can be the main deciding factor when considering which console to buy (when buying all of them is not a realistic option). Personally, I have been playing Playstation consoles my entire life, dabbling in other consoles and portable gaming platforms, yet I always seem to return to Playstation because of the exclusive games only available through their platforms. The Last of Us is an award-winning 3D action platformer game available only on Playstation consoles.
The single player campaign opens in the midst of a zombie virus outbreak among the entire world. The narrative follows two characters Joel, a father to a recently deceased daughter due to the outbreak, and Ellie a teenager who is believed to hold the cure to the virus in her immune system. Joel encounters a militia group, known as the Fireflies, that formed after the outbreak and is quickly tasked with the mission of delivering Ellie to other members of the militia outside the quarantined zone. Due to the initial conflict set up by the narrative and the undercover nature of the main mission, the suggested way to play the game is by remaining out of sight as much as possible and engaging enemies in a sly manner. However, games are places people flock to when looking for an escape from reality, a place with no rules or direction in some cases. For this reason, gamers approach games from different perspectives, causing them to play the game using different strategies.

Some player types such as the Killer player type defined by the Bartle player dichotomy the would prefer to take tactical approach to the task at hand, rather than a strategic one. For these type players, the combat they seek would include more face-to-face and traditional battles. For a strategic player, playing the game as if they themselves were in the shoes of the character, it is more appealing to remain as hidden as possible. The Last of Us also does a nice job of including both perspectives in specific instances. Players do not have to actively seek out or play intentionally with a certain strategy, the elements that Killers and Achievers enjoy most are built into the narrative at some main turning points, whereas most minor engagements are left up to the choice of the player.

In addition to the two polarizing player types mentioned previously, The Last of Us elegantly includes elements favored by the scavenger and artisan player types as well. Above the main mission of transporting Ellie to the Fireflies, there is obviously a larger responsibility to remain alive. There are several mechanics contained within the game that players can use to increase their chances of survival. Some of these mechanics include looting and crafting. It is possible to “loot” in virtually every scene of the game, although it is entirely the player’s choice whether to spend time looting or continue on with the main story line. Looted items can be used to craft items to boost health, melee weapons, and throwable items such as Molotov cocktails and nail bombs. These items are crafted with smaller parts players find by looting abandoned place and of course, classic to most Naughty Dog games, some of the better items require more exploring. Although all players must use items and crafting to some degree in order to play through the game successfully, the game will reward players more who spend more time searching for these items. This is also a positive feedback mechanism because players who are excelling in the game will be given opportunities to make the game easier through the use of the items they are able to craft. Crafting can also allow players to make improvements to Joel’s abilities and, at certain work benches found throughout the story, his firearms. Dylan Richmond

The craft-able items also introduce a variety of combat techniques that appeal to the wide array of player types. Certain enemies require some sort of tactic or craft-able item in order to defeat. A “clicker” is a type of enemy players encounter who uses its sense of hearing to detect players, making it easier for players to sneak around in plain sight, however players cannot engage this enemy without a weapon of some sort, or they will instantly die. This encourages players to come up with a clever and stealthy way to defeat this type of enemy. One option is to sneak up behind a clicker and use a craft-able item called a shiv in order to defeat the enemy. This is designed for rational players because this technique requires a great deal of thought and concentration in order to prevent the clicker from noticing the player. Aggressive players might ignore the clicker’s abilities of enhanced hearing and strength and face the clicker straight on with a gun or a melee weapon, such as a crowbar. Casual players may attempt to defeat the enemy from afar with one of the easiest methods, a Molotov cocktail. This item will attract the clicker to its flames and if the clicker has been standing in the flames for long enough, it will be defeated. This method is also best for defeating large hoards of zombies or clickers and might be chosen by a strategic or tactical player.

People have all sorts of play styles, approaches, and ways of enjoying video games, many beyond the scope of merely one game. Including these alternative pathways throughout video games increase their appeal to a greater number of people, which is ultimately the goal in creating a video game, yet having these various routes also increases the overall enjoyment of the game for everyone. For any player type, it is reassuring to know that if one of the options are situationally unavailable, another option is always at hand. The Last of Us artfully combines its narrative and combat mechanics with a multitude of viable player types. It’s the cross between elements and approaches from these player types that keeps The Last of Us fresh with every new engagement. Keeping a single consistent play style throughout the entire game is not an easy task for most, often times players must use a combination of strategies, abilities, and interact with various features in order to successfully complete The Last of Us.

Hi everybody
I post like
For announced my soon new concept,
I look again with PEGI for the aggrement
But same no that i believe is belive it.

In well, my first and new project, like chance to be able to the mentality
Able to fe the able
Of the dead haha
...
Eumh,
I don't wont to allong in de subject.
The Mentality is thing for that
Will be see if one of all
Of alll for that
The think is the know
To one/off a programming myself console.

Ability power without forget ergonomie
I'm new in the liaroom, and i espere can approve a lot in the chat room

Eumh...
Enterprise still to make video game
I'm only for the moment and would to stay
But i still to propose collaboration with some personal but about the concepte and only one.
The specianal if the some question,
,I tought to try work for a week .
I don't have specialisatial one the mind on one my main
Would just to say if somebody was interessed to devlopp on them if somebody is interessested.
Don't won't to like to be able i accept collaboration uniquement française
For amarican im sorry but not wasn't time
Without be able i aggremenr for the no pertinence and want to say a abin journey of possible...
For the follow the like or the dislike
I postbe all the work site with log out for flywings aways.
For/Pour
Pour ceux qui continu,e qui aimerais serais ou voudrais,
En claire,
Toute interessé par la création de jeu sur la machine et possible mais a ma discution avant toute chose et vous ne serez pas rémunéré
Sur regard après avancé,
,Chose consevable mais sans plus
Voilà en gro j'ai un project de boîte, entreprise/industrie j'epsère que vous serez mis au courant.
,Maj topics to soon ;
*anything but more some the gameprogramming pls
Twitter : none annouced,
Game dev :
https://www.gamedev.net/forums/forum/22-production-and-management/?do=add,
BLogg : none annouced,
Timeslines* :
The life is strong, the life is long,
I'have been fixed a little time to work with a pi programmation an slot for anything
But the life uncrepers '~'
*****Laste notice my disctely is the nimigim

So here's a quick background: I now have the fantastic opportunity to put my Wild West RPG (I know, odd timing for a Wild West game) on the [redacted] platform and have a second chance to possibly find the audience that I was unable to find on Steam. In order to maximize my chances of this, I am taking great care to improve the storefront/box art of the game. Unfortunately, I'm not a great artist and have little sense of visual design. Now I wanted to post this in the "Business" forum because the point here is not just to make a great piece of art, ultimately it has to achieve it's purpose - does it attract the right people who would be interested in my product?
Speaking of said product, here you can find it on Steam and here's some images from my website.
Originally, I tried very hard and came up with this - which, while very good for me, is not so good by actual game box art standards.

(Click for actual size)
I didn't get a lot of specific feedback on that. I heard things like "badly drawn" and mostly "there's too much going on" and "the eye doesn't know where to look." See? I just don't get visual design.
So the [redacted] Storefront needs images at 1000x1000 px so I made these four new versions:
Version A: This uses the same concept but I increased some of the saturation and made it even more colorful and moved a few things around. The focal point of the image is more concentrated on the fire.

(Click for actual size)
Version B: So then I was thinking... maybe there is too much going on. I looked at other examples of storefront art and realized that they usually just have a single thing happening. So I removed the characters, which aren't that well drawn anyway, and just have the fire. Maybe this adds some mystery so people will be more likely to visit the storefront when they see this image?

(Click for actual size)

Version 😄 Here I'm starting to think, this is a pixel art RPG, so why hide from that? Why not show that to people up front so the audience that is interested in such things can identify it more easily? This one has the same campfire concept, but now I'm using the pixel art.

(Click for actual size)
Version 😧 I thought that maybe that last one was too dark and wanted to try something else. This one just has a sunset over a cemetery with a couple of the characters while still showing the observer, yes this game is pixel art.

(Click for actual size)
Version E: This one is similar to the last although the logo is featured more prominently and there are no character sprites. Somehow the colors look better here to me.

(Click for actual size)

Version F: Version E which is not pictured here, is the option that says "None of these four would be good enough box art, instead pay an actual artist to make new box art." If it's the best way to maximize this games potential I'm happy to go with this option.
Version G: This suggestion says "Your concept is good, but there are too many artistic flaws. You should pay an actual artist to improve upon what you have and/or clean up the uglier bits that they can point out." If you vote for this option, please also pick which version (A, B, C, D or E) is your preferred concept.

So please vote below for Version A, B, C, D, E, F or G and add your feedback in the replies blow. I really appreciate all your feedback. I'm flying solo here so I don't often get it!
Version H: Here's a new version I made after posting this from suggestions another artist gave me. It's zoomed in just two characters and some colors and shading are different. The fire is smaller to distract less.

Hi GameDev!
Magical Game Studio is excited to present an opportunity to the gamedev community that we’re passionate about. The game we’re working on is a throw-back to one of our favorites, Legend of Zelda: A Link to the Past, and we’re looking to create a similar 2D, top-down adventure game with more of a painterly art style and faster-paced gameplay. We are currently developing for Nintendo Switch and PC platforms (we’re Nintendo dev partners with Switch access).
A bit about our own experience: we have signed contracts with three publishers across four previous games, ranging in funding from $400K to $5M. As a team, we have shipped over 22 game titles in the past, and we’ve shipped both AAA and indie projects alike. This specific project is in current negotiations with several notable publishers who want to see our First Playable demo. This job posting refers to work that needs done for that First Playable milestone.
Our studio is comprised of 3 full-time and 13 part-time members. Several of us are currently employed full time in director or senior-level roles at other game companies, but this is our passion project that we’re looking to get funded so that we can quit our day jobs and establish our own studio.
We’re currently looking for a Gameplay / AI Engineer who is capable of taking our animated NPCs/creatures and implementing their movement and combat mechanics. We're also looking for someone who can implement gameplay events and event sequences, such as "the boss plays an entrance sequence when the player steps on a floor tile, then the fight begins after the sequence" (random example of our definition of an event sequence). We have most of our core gameplay elements at the "80% functional" stage and are currently undergoing adjustments and polishing passes. We are specifically looking for engineers who have a strong desire to not only implement a basic feature, but iterate until that feature is fully polished and worthy of showing to a crowd of gamers and game media outlets.
This position is remote and royalty-based until we secure publisher funding, in which we will pay salary/benefits + royalty.
If you’re interested in hearing more, we have documented a full breakdown with more detail on the game itself (and us as a team) and we’d love to discuss it with you via Discord. We also have a small game demo we can send you to test the game. Simply email me at zach@riseofthemakers.com with your portfolio or examples of work and I’ll reply promptly.
You can view our latest screenshots and concept art here: https://imgur.com/a/WRyzC
I've attached a few images from that link for the lazy.

The problem of difficulty in games has been debated to great depths for a long time. Various alternatives to the traditional approach with different difficulty modes at the beginning of a particular game have been proposed, analyzed and implemented. And yet, as much as they patch up the errors of the traditional approach, within them arise numerous inherent problems and difficulties. As such, I would like to propose another alternative–not so much a mechanical solution that requires implementation, but rather a different approach to difficulty design.
One thing I’d like to stress is that, this has been applied in various games quite successfully before, and I’ll mention them later on, but not to the extent to which it can deservedly become a central design philosophy, in my opinion. This I presume is due to a lack of a rather clear and deliberate approach to difficulty design.
But first, let me attempt to briefly summarize a few popular criticisms of the traditional difficulty modes approach and its alternative.
Problems with Difficulty Modes
Picture yourself coming into a brand new game, only to be asked to choose a difficulty mode that’s suitable for yourself, and presented with a number of different menu options. And frankly, they don’t do that good of a job at giving you sufficient information to make such an important decision. This is how many games in our history have done difficulty, and it continues to be fairly prevalent among modern games.

Here are its common criticisms:
Asking the player to make such a decision right at the beginning is not exactly a good idea. To select a difficulty mode before the game even starts is to make a major commitment based on very little information available (e.g. a short description). Once the player has selected a difficulty, they are probably going to live with it for the entire playthrough.
Even if the game allows the player to change the difficulty mode later on, it is, in itself, still not a very good idea. For one, explicitly selecting a difficulty mode in a menu-based manner is certainly not an interesting choice that games strive to offer their players. They do not have to weigh anything against anything. They do not have to analyze the risks and rewards coming as a result of each option. And generally speaking, players are not going to be good at weighting short-term convenience against long-term enjoyment. They just do not know the game enough.
Such approach would defeat the entire point of progression through unlocking higher and better tools to enhance and assist with gameplay. It would go against the intended gameplay experience from the game designer. And most importantly, it would make the player feel judged for not choosing a higher difficulty.
There have been several solutions to negate these issues, of which Mark Brown has gone into depths in one of his videos. However, not one of them was able to solve them all and still maintain immersion.
Dynamic Difficulty Adjustment
The idea of Dynamic Difficulty Adjustment (or DDA) hinges on the theory of the player’s Flow State, in which the player is completely immersed, and the game’s difficulty feels just right. Any more difficulty will cause frustration and break immersion. Any less difficulty and the player will quickly find boredom, and you guessed it, lose immersion. Therefore, as designer Andrew Glassner put it in his book Interactive Storytelling, games “should not ask players to select a difficulty level. Games should adapt themselves during gameplay to offer the player a consistent degree of challenge based on his changing abilities at different tasks.” Or in other words, games should be implemented with a performance evaluation system as well as a dynamic difficulty adjustment system in order to adjust itself to accommodate the infinitely different and ever-changing characteristics of players. More on the technical details of DDA can be found in Robin Hunicke’s 2005 paper The Case for Dynamic Difficulty Adjustment in Games.

However, while the Flow State theory admittedly has its merits, the DDA approach doesn’t go without its numerous downsides:
Some players, when they find out about DDA, hate it. Especially when DDA cannot be turned off, the player ends up feeling patronized, and not respected by the game as an adult, capable of taking on challenges and improving him/herself.
Players can, and will, learn to exploit DDA by pretending to be worse at playing than they actually are. And oftentimes, a DDA system will require some sort of break time in order to avoid revealing itself to the player, thus not able to quickly adapt itself to the player’s ostensible skill level.
DDA inhibits the player’s ability to learn and improve. As soon as the player improves, the difficulty ramps up to match their skill level, thus eliminating the possibility of positive results. If the player cannot see some sort of feedback from the game regarding their performance, they cannot know whether any changes in their approach to gameplay were effective.
DDA may create absurdities. One of the popular example of DDA going awry is the rubber-band effect in racing games, where opponents speed up and slow down seemingly for no reason in order to adapt to the player’s performance.
DDA is incompatible with some forms of challenge. If the challenge in question is numerically-based, then DDA can work easily. However, when the challenge is symbolical, with pre-designed elements that are nakedly visible to the player, often having only one or a few intended solutions, then DDA cannot work.
There are many interesting and nuanced approaches to DDA that I won’t mention since that’s beyond the scope of this segment. While I imagine there are going to be a lot of way to make DDA functional and sufficiently inscrutable through clever algorithms and implementation, I am rather discussing the fundamentals.
Organic Difficulty in Games
There seems to be a number of different terms to address this approach, but just for this article I’m going to use the term “Organic Difficulty.” This is something that has been tossed around in the last decade or so.
The basic idea of Organic Difficulty is that the game does not ask the players to select or adjust their preferred difficulty via GUI-based commands, nor does it automatically adapt itself to match with the player’s performance and progress. But rather, the game allows the player to interact with it in certain ways to make it easier, or harder, for themselves. These take the form of tools, approaches, strategies, input sequences or methods, etc. which should often come with some sort of trade-off.
This is something that has been implemented in a number of games including From Software’s Dark Souls, which Extra Credits has dedicated an entire episode to, and which everyone should take a look.

In Metal Gear Solid V, for every mission the player has completed, there’s a score rating system which provides a rough overview of the player’s performance based on a number of factors such as stealth, lethality, accuracy, completion speed, whether the player has completed any mission tasks, and what tools they used. While the player does get minus points for mistakes such as getting detected, raising enemy alert, taking hits, etc. some other factors are not as clear-cut as to how they constitute minus points aside from narrative reasons. The player can always go on a lethal rampage, tossing grenades at everybody in sight, or calling a support helicopter to airstrike the entire enemy base. The player is provided the tools to do exactly all of those, and they’re always just a few buttons away, and the worst they get is a C rank, provided they completed the mission, and a slight dip in their earnings.

Another example of this can be found XCOM: Enemy Within. There's a "cheesy" tactic in the game that can almost ensure victory, which is to have a unit with the Mimetic Skin ability to safely spot the enemies, thus enabling a squadsight-sniper from across the entire map to pick them off one-by-one safely without any real repercussion. This strategy is extremely effective in virtually every mechanical aspect of combat, with the only risk being that the spotter must not be flanked for they would instantly lose invisibility. The actual problem with this strategy is that it’s incredibly boring: your snipers just simply shoot every turn, and you can only take a few shots every turn, not to mention reloading. This strategy is best suited for beginners and people who have made mistakes and want to get out of the downward spiral. While on the other end of the spectrum, there are players who understand how the game and the AI of every alien unit in the game work, so they are more confident about moving up close and personal with enemies with minimal armor. Because for them, it's not about defending against the enemies, but about manipulating, "nudging" the enemies into behaving the way these players want them to (e.g. nobody needs armor when enemies are only going to attack the tank; nobody needs to take good cover when enemies are too scared to move to flank in front of an Opportunist-overwatch unit; etc.)

The above examples seem to imply a few important points regarding difficulty:
Difficulty should not only be designed around the mechanics of a game. It should also take into account the aesthetics or elegance of those very mechanics.
Punishment does not always have to be tangible or significant, as long as it is enough to indicate to players that they are straying off the intended experience. A good analogy would be physical pain. The pain itself is not what’s causing harm to your body. The physical wound is. Pain is merely a bodily signal to let you know that what’s happening right now is pretty bad and you probably shouldn’t let what just happened happen again. But remember, the choice is ultimately yours!
It may not be a good idea to put people on the linear graph of "gaming skill" where some people are simply "softcore, not-so-good at video games" and some other are "hardcore and always challenge-seeking." The idea alone is absurd, because players on such a graph would move up and down constantly, even during a single playthrough. Some people pick things up faster than a game can predict with its tutorials' pacing. Some people due to real life reasons have to abandon the game for some time, and they lose a bit of their touch when they come back to it.
Instead of judging the player’s skill and trying to accommodate every possibility, games should be judging player interactions instead, using a spectrum between Effectiveness and Aesthetics of Play (or what I shall humbly name Ludoaesthetics).
The Effectiveness-Ludoaesthetics Spectrum (ELS)
On the Effectiveness-Ludoaesthetics Spectrum (ELS), difficulty exists only at the lowest technical level. Each end of the ELS represents what each player wants at a certain point in the game with certain conditions. On this spectrum, games are designed with the player’s interactions, approaches and strategies in mind, each with its own degree of effectiveness and ludoaesthetics. These are not solely defined by mechanics or the player’s skill level, but rather the way in which they are experienced and perceived by the player.

Effectiveness refers to how well the player can progress and achieve their goals in a game using the set of tools they’re given and the strategies they’re allowed to formulate. How easy those tools are to use, and how good they are at helping the player progress towards the game’s intended goals, primarily constitute Effectiveness. Players who aim towards and stay on this end primarily look for the most effective ways to achieve the intended goals of the game (which of course include playing the game the easy way).
Ludoaesthetics refers to the perceivable aesthetic appeals of the aforementioned set of tools and strategies given to the players. Players who aim towards this end do not necessarily look for the most effective ways to achieve the intended goals. But rather they tend to look for the added intrinsic benefits derived from unconventional play. These benefits include:
Superficial Attractiveness: Visual and auditory appeal of using the subject matter or the subject matter itself. It can be represented by any entity the player can recognize in the game such as a character with great visual design, a badass-looking weapon with satisfying visual and sound effects, etc.
Competitiveness: a.k.a. bragging rights. This is rather self-explanatory. There is always that portion of players who keep seeking greater and greater challenges to prove themselves to the world. They may even go as far as handicapping themselves with arbitrary limitations to heighten the challenge.
Greater sense of satisfaction derived from greater challenges that may go beyond the goals intended by the game. People who have been through heights of overwhelming odds know about, and may expect, the immense amount of satisfaction that comes with them.
Narrative Fantasy: Players may look for things that may not be effective or productive in terms of gameplay because they would align with the narrative better (in games that understandably contain some degree of ludonarrative dissonance), or they would add an extra layer of depth and intensity to the narrative and thereby enhancing it. Essentially, they’re sacrificing gameplay optimality to elevate their narrative fantasy.
Design for Ludoaesthetics
The point of designing for ludoaesthetics is NOT to create increasingly harder challenges in order to accommodate the player’s increasing skills (though that is not to say such approach has no merits whatsoever). But rather, it is actually to encourage players to strive for aesthetics in their gameplay and to lean more towards the right side of the spectrum.
Here are a few suggestions on how to go about it.
Creating more depth
Depth refers to the amount of space the player is allowed to make interesting choices using the set of tools they’re given by a game. For a more detailed explanation of what Depth is in comparison to Complexity, you can take a look at Extra Credits’ episode on Depth vs. Complexity.

Essentially, Complexity is the amount of constituent elements that make up a game, and Depth is the degree of interactivity between those elements. The very nature of ludoaesthetics has to do with the deviation from the default, intended approach (a.k.a. Playing “by-the-book.”) Therefore, the more those elements “talk” to one another, the better chance it is for ludoaesthetics to emerge, because then the player will be able to find more different ways to control or manipulate each element.
[Also read: Design for Theorycrafting]
Depth is pretty much the prerequisite for ludoaesthetics even as a concept to exist. Without a lot of depth, the window of opportunities for ludoaesthetics get significantly lower or completely non-existent.
Creating patterns suggesting the possibility of gameplay aesthetics
Adding more depth is not only about simply adding more stuff in a game and making them as obscure as they possibly can be. It is also about leaving breadcrumbs to suggest that there is more than meets the eye, therefore encouraging players to explore further possibilities. What kind of depth to even add? And how does one go about communicating it?
Below is a conceptual representation of a set of challenges typically found in video games.

Each challenge is represented by a window of failure and a window of success. These windows can be spatial, temporal, symbolic, strategic, or a combination of all. They are the spaces in which the player enters by behaving in a certain expected way. Secondly, the black line represents the player’s interactive maneuvers: where to get across and which direction to turn to next, in order to overcome the set of challenges without stumbling into the windows of failure.
For example, say we have a situation in a 3D platformer game where the player is facing a pit, and across the pit leaning towards the right side there is a narrow platform. In such a scenario, we can assume that the window of failure includes any and all sets of behaviors that lead the player plummeting down the pit, and the window of failure includes those that lead the player to landing on the platform across the pit safely.
Now consider the same representation of challenge above, but this time with a slight deliberate arrangement.

As you can see, the sizes of the windows of failure and the windows of success stay exactly the same, but the positions of the windows of success have been altered so that they align somewhat (but not exactly aligned to the point of being too obvious). You can see that nested within the windows of success is a narrower window where the amount of the player’s maneuvers stays extremely minimal. Stepping into this window offers the opportunity for a non-disrupted gameplay flow, where a deliberate and guided set of behaviors will let the player “breeze” through the challenges seemingly almost with ease. This window is where ludoaesthetics occur.
Of course, the downsides of it are aplenty: it can be extremely difficult to realize such a window exists in a real scenario. And in order to stay inside such a narrow window, the player has to be extremely precise and/or smart in their gameplay. You can think of this window of non-disrupted flow as an intended “weak point” of the challenge, where a single and concentrated attack will break the whole thing apart in one fell swoop. But the process of identifying such a weak point, and delivering the finishing blow with great accuracy may require a lot of trials and errors, and can be extremely tedious and/or difficult.
An Example from Master Spy
A common manifestation of ludoaesthetics comes in the form of speedrunning. Finishing with speed is, for the majority of games, not the primary intended goal. Games are rarely ever designed to be speedrun, and most players do not have to finish any games at high speed in order to not miss anything. So speedrunning has always been a sort of arbitrary self-imposed challenge by those who seek greater sense of enjoyment from their favorite games.
However, there are a few exceptions. And you can find the above mentioned window of non-disrupted flow in levels like this one from Master Spy by Kris Truitt.

In this game you play the role of the Master Spy, to infiltrate ridiculously well-guarded buildings, palaces and fortresses with a huge number of different enemies, hazards and contraptions standing in your way. And you are given no tools whatsoever but an invisibility cloak that can help you sneak past the eyesight of certain enemies while halving your movement speed.
In the example above, your goal is to retrieve the keycard on the other side of the wall slightly to the right of your starting point, and then to escape through the white door right above your starting point safely. And while your cloak can get you past the eyesight of the guards, it is of no use whatsoever against the dogs, who can smell you even when you’re cloaked and will sprint forwards to attack you at horrendous speed as soon as you’re on the same ground as them.
So what you have to do as a sequence of actions in this level is first to cloak yourself, then drop down from the first ledge past the the first guard, then quickly decloak to regain speed as the cloak is useless against the incoming dogs. Then before the first dog reaches you, move forward to the right, then quickly jump up. Keep jumping to retrieve the keycard while avoiding the second and third dog. Cloak up, then get on the ledge with the three moving guards. Finally, jump to the left to reach your destination.
However, as you can see from the footage above (courtesy of a speedrunner nicknamed Obidobi), as soon as the player reaches the ledge with the three moving guards on the right, the guards turn to the other side and begin moving away from where the player is, effectively freeing the player from having to cloak and having their movement speed halved. And then right before the player reaches for the white door, the guard on the far right is about to touch the wall and thereby turning back to the left. This is such a tiny window of success that should the player not have begun moving right after they start the level and stayed uncloaked at the end, they would have failed. The level is designed in such a way that it can be completely solved without wasting any moment and action.
Is it significantly more difficult to play this way? Yes. Was this arrangement absolutely necessary? Not really. But the designer made the level with the expectation that people are going to speedrun the game and will be looking to optimize their timing with each level. Thus, the levels in Master Spy are designed so that should the player start looking to speedrun the game, they will easily recognize that sweet, sweet window of non-disrupted flow. It is an immensely satisfying experience to discover it.
Ensure Usability
As usual, it is easy to get too extremely logical about design and forget all about the equilibrium, which is almost always what design is about.
In this case, it is important that designers must ensure that whatever tools they’re making for their players to achieve ludoaesthetics, MUST have at least some sort of usability, even if it’s incredibly niche or extremely difficult to pull off. Things that serve nothing and mean nothing are NOT aesthetic. Say you have an RPG, and one of your players goes out of their way in order to build an unconventional character because they see some sort of future potential from this build, only to find out later that when they’re finished with the build, the meta of the game has changed and the window of opportunity for such a build has long passed. This means that the entire amount of depth you added, and the ludoaesthetics you might have intended by allowing that player to go in such away, is utterly useless and entirely wasted. So always remember to ensure usability for everything you add in your game.
Conclusion
Organic Difficulty and the ELS are not only, and not necessarily, an alternative solution to the whole difficulty problem. But rather, they represent an entire paradigm shift away from the idea that games should find more and more complex ways to serve players with different skill levels, and towards a design philosophy where players are given integrated tools within the context of games to set their own difficulty at any point without breaking immersion and perhaps the extra baggage of shame. It is not enough to have your players stay at the same level of difficulty throughout the game, or dynamically adjust the difficulty on the fly to suit them. It is best, in my opinion, to let your players cook to their palate. Just make sure that the process of cooking and the game itself are one and the same.
References
The Designer's Notebook: Difficulty Modes and Dynamic Difficulty Adjustment (2008) by Earnest Adams. Retrieved at https://www.gamasutra.com/view/feature/132061/the_designers_notebook_.php
The case for dynamic difficulty adjustment in games (2005) by Robin Hunicke
Cognitive Flow: The Psychology of Great Game Design (2012) by Sean Baron. Retrieved at http://www.gamasutra.com/view/feature/166972/cognitive_flow_the_psychology_of_.php
Depth vs. Complexity (2013) by Extra Credits. Available at https://www.youtube.com/watch?v=jVL4st0blGU
The True Genius of Dark Souls II (2014) by Extra Credits. Available at https://www.youtube.com/watch?v=MM2dDF4B9a4
What Makes Celeste's Assist Mode Special | Game Maker's Toolkit (2018) by Mark Brown. Available at https://www.youtube.com/watch?v=NInNVEHj_G4