How to livestream to Twitch and YouTube at the same time using ffmpeg and OBS Studio on a single Windows or Linux computer

I'm a big fan of OBS Studio, and I've recently started learning how to use ffmpeg for transcoding and remuxing my videos. One thing that has bugged me is that current versions of OBS Studio can only stream to one streaming service at a time (one RTMP server). There are services like restream.io that get around this, but you're basically paying them for a little bit of CPU/GPU time and some added latency to your stream, and maybe only getting combined chat in return.

Well, it just so happens that with a single ffmpeg command line invocation, you can output to multiple files and streaming services at once with very little overhead. Another benefit of ffmpeg over OBS Studio is that it supports more encoders such as hevc_amf which is the hardware H.265 encoder for AMD video cards. OBS Studio currently only supports h264_amf via the Advanced output mode. Strangely, OBS Studio has an included version of ffmpeg but the list of encoders it has does not include any AMD encoders, only NVidia's encoders, and OBS Studio also provides a really limited interface to its included ffmpeg.

If you have multiple computers - one for recording with OBS Studio and another for encoding with ffmpeg - there are already guides for how to do that, such as this one which suggests sending and receiving over UDP. However, as far as I can tell, this is only possible with at least two computers - it is impossible to send and receive on the same computer without doing weird networking hacks. This was a dead end for me for a long time. I was looking up the possibility of named pipes or other IPC between the ffmpeg inside OBS Studio and the separate ffmpeg on my system.

Finally, I found this reddit post and suddenly everything fell into place. Basically, you just host your own minimal RTMP server on your own system, stream to it from OBS Studio, and then use it as an input to ffmpeg. Heck, if you don't need to re-encode the stream at all, you can literally use just the RTMP server to rebroadcast to Twitch and YouTube simultaneously without needing ffmpeg at all.

You should be able to follow along in order to set up your copy of nginx on either Linux or Windows. For Windows specifically, I've found that the "nginx Gryphon.zip" version works and includes RTMP support, though it is rather outdated coming from 2015 and I would discourage you from opening it up to the internet in any capacity. If you're more experienced you could try building the latest and most secure versions of everything yourself.

If you plan to just use nginx to restream to both Twitch and YouTube without using ffmpeg, be sure to adjust your streaming bitrate and such in OBS Studio - Twitch is the main limiting factor as YouTube will happily accept anything your upload speed can handle. If you'll be using ffmpeg however, I recommend configuring OBS Studio to stream lossless with fast encoding time, and then we'll be doing the actual lossy encoding in ffmpeg (this way you don't double-encode lossy video). You can use a software or hardware encoder in OBS Studio for this purpose, whichever works best for you.

Once you've installed nginx and added the minimum test configuration for the RTMP server, all you have to do is stream to it from OBS Studio as documented and then you're all set to use it as an input to ffmpeg. Here's an example command line to test it out without actually streaming anywhere so you can get an idea of the quality:

ffmpeg -i "rtmp://" -c:v h264_amf -usage lowlatency -rc cbr -b:v 4000k -c:a copy twitch-recording.flv -c:v h264_amf -usage lowlatency -rc cbr -b:v 7500k -c:a copy youtube-recording.flv -c:v hevc_amf -rc cqp -qp_p 20 -qp_i 20 -c:a copy local-recrding.mkv -c:v copy -c:a copy raw-recording.mkv

In that command line there is one input (the RTMP stream from nginx) and four outputs (all saved to files with different encoding settings so you can compare the quality of each). Obviously when you are actually streaming you'd only need two or three outputs depending on whether you want to record locally or not. The audio is just copied from OBS Studio as-is, since it is already fine for Twitch and YouTube. The h264_amf and hevc_amf encoders for AMD graphics cards can be swapped out for h264_nvenc and hevc_nvenc for NVidia graphics cards. If you want to use Intel graphics for some reason, you can use h264_qsv. Be sure to use "ffmpeg -h full" and search for the encoder you are using to make sure you specify the correct options, as they differ from encoder to encoder.

If you can run the above command and your system doesn't catch fire, you should be more than ready when it comes time to actually stream. It is very important to note that you should always stop ffmpeg first before stopping the stream in OBS Studio. You can do so by pressing q or Ctrl+C (once) in the command prompt window or terminal where you are running ffmpeg. Then you can stop streaming in OBS Studio. If you want to shutdown nginx, run "nginx -s stop" in the directory with the executable.

To actually stream to Twitch and YouTube using your stream keys, you'll want to use a command like this:

ffmpeg -i "rtmp://" -c:v h264_amf -usage lowlatency -rc cbr -b:v 4000k -c:a copy -f flv "rtmp://live.twitch.tv/app/YOUR-TWITCH-KEY-HERE" -c:v h264_amf -usage lowlatency -rc cbr -b:v 7500k -c:a copy -f flv "rtmp://a.rtmp.youtube.com/live2/YOUR-YOUTUBE-KEY-HERE"

This will take your stream and send 4000kb/s to Twitch and 7500kb/s to YouTube. It won't create a local recording, but that's easy enough to figure out from the earlier command. Again, you can substitute the encoders for NVidia or Intel's encoders. It's also possible to use software encoding with an encoder like libx264 but that will take a lot of CPU usage, which is why I recommend the hardware encoders instead. Also keep in mind you are likely to have better driver support on Windows.

By the way, if you're new to YouTube streaming, I recommend that you DON'T use the "Stream Now" beta - it's still quite buggy and your stream archive will end up several pages back in your video manager making it hard to find. Instead, create a scheduled event - this has several advantages: firstly, subscribers will see the stream notification like any other video in their subscription feed, letting them click "Set Reminder", and when they visit the stream URL they will see a countdown (so you don't have to do a countdown yourself). Secondly, if you stop your stream for any reason (system crash, power loss, internet outage, etc), the stream will not actually end until you click the Stop button on YouTube's livestream dashboard. You can literally stop streaming for an hour to eat, and then start again, and it will pick up like nothing happened. There will be no gap in the stream archive, just an instant cut. Just remember to always stop ffmpeg before you stop OBS Studio or bad things happen. If your internet goes out, stop ffmpeg and let OBS Studio keep streaming to nginx, then when you have internet again you cam start ffmpeg again.

Unfortunately Twitch isn't so kind, any interruption of your stream that lasts more than a few seconds will split your Twitch stream in half, making two separate archives. Viewers on Twitch also won't be able to rewind the stream and catch up to live at 1.5x/2x speed like they can on YouTube with YouTube DVR. Additionally, if you are a Twitch affiliate or partner, you are not allowed to use any streaming service other than Twitch, meaning you read this whole article for nothing. YouTube doesn't have such an exclusivity clause.

It's a shame, because Twitch and YouTube are pretty similar as far as features for streamers go: they both offer monthly paid subscriptions ("Subscribe" on Twitch and "Sponsor" on YouTube) and they also both offer paid chat messages ("bits" on Twitch and "Super Chats" on YouTube). Another thing to consider is that Twitch allows you to upload videos just like you would to YouTube, so you can upload to both just like you stream to both. Unfortunately, Twitch Uploads can't be monetized unless you're an affiliate or partner, which would prevent you from streaming on YouTube. Thankfully, the YouTube "Sponsor" feature is still available whether you stream on YouTube or not.

And no, this isn't a paid post, I'm just making sure newcomers are fully aware of the ins and outs of each platform, since this article is about streaming to both after all.

If you have any questions or trouble getting things set up, feel free to comment and ask - I prefer public communication so that others with the same problem can see that and get an answer too. If you need help learning to use OBS Studio, here's a great tutorial series. If you need help using ffmpeg, I'd recommend lots of Google searches, reading the wiki, reading the help, reading the documentation, etc. If you need help using nginx, I'm not sure what you did wrong but I wish you luck in fixing it.


Why I prefer minimalist art styles in games

I'm a big fan of minimalist art styles in games - simple lines and shapes, dashes of color, the occasional complex geometry, etc. I like the way it looks, but there's more to an art style than just the way it looks.
Mini Metro. Image from official press kit. Check out the GDC talk.
Games have had a long history of trying to mimic reality, especially big-budget games made by large companies for mass audiences. It can be impressive to see how far technology has come, but basing games in realistic worlds runs counter to game design. Real life has a lot of limitations, and games based on real life have to devote a lot of effort to explaining why you can do things that can't be done in real life, or they blatantly ignore such conflicts and go for the "it's just game logic" option. Whether or not you care about immersion, this is a problem that wouldn't exist if the game wasn't based in reality.
Rise of the Tomb Raider. Image from vg247.com. The player is expected to believe this is real life, but rapid healing is never explained.
Some games are quite clever with how they dodge bullets - they set themselves in futuristic settings, or make magic real. While this typically works for the story, it doesn't always work for the gameplay. At the end of the day, someone has to play the game, and ideally they have to enjoy it. It's hard to fully enjoy a game when you know it's being held back by the pseudo-real laws of reality the designers trapped themselves in.
ECHO. Image from the official press kit. The game is set in the far future within a planet-sized palace with highly advanced technology.
Reality lends itself well to stories because it's been the setting of an overwhelming number of stories for thousands of years. However, many of those stories have also bent reality under the guise of dreams or exaggerated tales. Walking simulators are a great example - while their gameplay is lacking, their stories can be quite fascinating, alternating between reality and imagination as if the player was supposed to know all along that the world didn't follow the same rules as real life. I don't personally enjoy the act of playing such interactive media, but watching others play is as enjoyable as watching a good movie.
What Remains of Edith Finch. Image from PlayStation store page. The game takes place in real life but frequently shifts into tall tales.
But what if you want better gameplay and don't care too much about reality? Games with colorful art styles have far fewer chains holding them back - they can break more rules because they don't look like reality, therefore people don't assume they follow the same rules as reality. Every unexpected element is just a part of how this fictional reality works, and that's okay because the game is the only reference you have for that kind of reality, and it sets the rules for you. There's still a tendency to compare many aspects to real life, but the suspension of disbelief is much easier to maintain.
The Witness. Image screenshotted by me. The nature suggests reality but the technology is all for show.
But art styles other than photorealism can still restrict the gameplay. Whatever art style a game chooses inherently limits the game to what makes sense in that art style. Some art styles are more restrictive than others, such as photorealism and whatever Nintendo is doing to Paper Mario: Color Splash. The presentation of the game sets the bar for what the player is willing to believe can happen in the game, and mismatching the art style with the game's reality often doesn't work. It can leave players wondering if they even understand the art style.
Duskers. Image screenshotted by me. The game convinces you you're a drone operator looking at staticy live feeds on computer screens, but then you can still see drone feeds when your screen is supposedly broken and stopping you from seeing the ship layout, thus the story and art style contradict the gameplay and experience.
At some point along the spectrum of art styles, you end up on the opposite end from photorealism: minimalism. In minimalist art styles, you use the bare minimum of shapes and colors to convey the game's world to the player, leaving the gameplay as the focus. Instead of having to come up with contrived reasons for why the player has to do something or why the player cannot do something, you just tell the player outright and the accept it. There is no preconceived ruleset for how the world should function, and what the game says is law.
Antichamber. Image screenshotted by me. The game is focused on learning the rules of the world in order to explore. It is very clearly not set in reality.
This affords so much more freedom for a game to explore its gameplay mechanics in whatever combinations it pleases. It also maintains a permanent suspension of disbelief because the player believes everything they see, having no reference to find inconsistencies with. Games with minimalist art styles need only teach the player what everything means and how it works, and then the game can challenge the player to test that knowledge. As you would expect, minimalism lends itself well to puzzle games, but it can also work well for other types of games, such as those featuring combat.
SUPERHOT. Image from official press kit. While the environments look like they could be in the real world, they merely serve as creative obstacles.
Unfortunately, many games with minimalist art styles often fail to explore their full potential, probably because developers are used to working within the limited confines of other art styles closer to photorealism. The sky isn't the limit because there need not be a sky, only your ability to convey information to the player limits what you can do. Compared to the noisy environments of photorealistic games that players have to learn to ignore 90% of, minimalism offers an unprecedented lack of distractions. Because of this, players can take in much more relevant information from a scene and remain much more observant. The use of simple shapes and colors makes it easy for people of all ages and backgrounds to pick up and play a game with a minimalist art style, and leaves a lot of room on the table for challenging more advanced players.
Disoriented. Image from Steam store page. Extremely disappointing as the puzzles never get more challenging, just more tedious.
Some common criticisms that I often see of games with minimalist art styles is that they are lazy, and that they all look the same (or more recently, that they all look like Antichamber). While developers often intentionally choose an art style that they have the ability to pull off, it isn't always out of laziness. There will always be developers who take the lazy approach, but the point of a minimalist art style isn't to look impressive, it's to focus on the gameplay. If the gameplay is lazy, then yes, the art style is probably lazy too. But if the gameplay, experience, or story is great, the minimalist art style can suit it, lazy or not.
LIMBO. Image from official press kit. While the gameplay and story are nothing to write home about, the experience lends itself well to the minimalist art style.
As for many minimalist games looking the same, I could say the same about photorealism, animated movies, traditional movies, etc. A game's identity isn't supposed to be its art style. The gameplay, the experience, and/or the story should serve as the identity, while the art style merely serves the needs of those three. Make the game first, and then pick the art style that best suits the game afterward. Picking the art style first can box you into a corner and cause you to waste time if you change your mind. I feel that many games would be much better if they were in a different art style - not because changing the art style magically makes the game better, but because it allows (or disallows) different possibilities as needed. Minimalism is actually best suited to a focus on gameplay, and shouldn't be used if you want to focus on the experience or story of a game instead.
Watch this if you're confused by my use of the word 'experience'.

At the end of the day, I like the potential that minimalism offers over other art styles, but I also just like the way it looks. Despite many minimalist games not reaching their full potential, I still get excited when I see a new game featuring simple shapes and lines. You never know when a developer will finally realize that they can do everything and more with minimalism. One day I hope to even create a couple minimalist games myself, but I'm totally not a ninja, so that'll totally never happen.


How I ended up with 1.5 Google accounts

I'm fuzzy on some details, but this is the best I can remember about how it happened.

Fun fact, this was actually the first console game I ever played, and after playing at a friend's house, I convinced my parents to buy a Wii.
A long time ago, there was this cool video sharing platform called YouTube. I was pretty young, playing some random game called Super Mario Galaxy 2, when I discovered a couple interesting quirks of the game's gravity mechanics and recorded them with my sister's camera on my family's tripod. I had to ask my parents' permission to create a YouTube channel so I could upload the videos.

This is probably what I saw, but it's been so long I don't really remember.
On October 18, 2010, I created the YouTube channel LB725C. My online alias at the time was LB, but many sites (YouTube included) imposed a 3 character minimum. Not content to add an underscore, I came up with the clever idea to somehow use 1337 in my username, but in a subtle way. It just so happens that 1337 degrees Fahrenheit is approximately equal to 725 degrees Celsius. Thus, LB725C was born as my YouTube username. Back then, usernames were also display names. I think the email address I used was my old Yahoo email address.

You should really migrate your email from Yahoo to some other service.
At some point I had associated my Yahoo email address with my Google account. At some other point, YouTube's parent company (which wasn't Alphabet at the time) started linking YouTube accounts with Google accounts by email address. At some later point, some random social media platform operated by YouTube's parent company seemed to be destined to insert its tendrils into every other service run by the parent company.

One fateful day, I visited YouTube to look for more videos of glitches in my favorite Nintendo games, only to be greeted by a dialog, asking me to make a choice that some would find very difficult. I could continue to use my existing channel name of LB725C, or I could use my real name. But there was also a third option: I could write in whatever name I wanted. So of course, I picked that and tried to enter LB. To my surprise, it worked! I was pretty happy about that, but I didn't think much of it afterward. My channel's custom URL was still LB725C, which I was disappointed about, but I understood why I couldn't change it.

Eventually, I noticed that when I clicked my avatar in the top right of YouTube, there was another channel with my real name. A channel I had never created but which nonetheless existed, having 0 subscribers and 0 of everything else as well. Curious, I looked into everything and made a lot of discoveries. I was now logged into YouTube via Google. My Google account had a Google+ page with my real name, and this page was considered a "real person" and was permanently associated with my Google account. My "real person" Google+ page had a YouTube channel automatically created for it. But, I also had another Google+ page - this one was called LB. It also had a YouTube channel. Both existed under the same account.

This URL doesn't exist anymore, and changed several times before it was removed. I pulled this screenshot from an old forum thread where I made a very misguided attempt at defending Google+.
As I discovered these facts, I started customizing everything, changing settings and adding information. I noticed there was a way to set a password on the Google+ settings page for LB - how curious, what might that be for?

This isn't what it originally looked like, though, nor is it the original URL.
So, I tried it, and was told it had been set successfully. What? What is this password for? Apparently, it's for managers of brand accounts to use. What's a brand account? How would managers use this password? These support articles sort of explain it:

My LB Google+ page also had a randomly generated email address that I assumed was only used as a hack for Google services that needed an email address to understand the world. So, I opened another browser (or rather, created a new user profile in Chrome) and used the weird email address and the password I just set to log in. I could use YouTube just as I always could, no surprises there, but I had used the same login process for normal Google accounts, so I wondered what other services would work like this?

The first thing I tried was GMail. It directed me to a page about upgrading to GMail, which was when I found out that GMail hadn't always existed at the same time as Google accounts. It let me pick my own email address, but I've always been bad at deciding such things, so I used my channel's custom URL. Surprise! I now had a second GMail account, owned by the LB Google+ page, which was also owned by my personal Google+ page. Most other Google services worked too, including an extra 15GB of free Google Drive space.

It used to be that the LB profile would use my avatar, but that functionality broke at some point.
This was a time in my life when I really needed to figure out how to separate school life from goofing around on YouTube, and this weird dual account setup seemed like the perfect way. Back on my personal Chrome user profile, I switched YouTube to the channel with my real name and set it as the default. It was weird to see an empty subscription feed, so I subscribed to some science channels and my college's YouTube channel. I figured I may as well learn stuff if I was gonna use YouTube when I should be using it. Then I would only use the LB channel and user profile for gaming related activities. In a way, it felt like I was maintaining two separate identities, and for the most part that was how I treated it - two sides of the same coin. From each identity, I avoided mentioning the other, except for accounts and places where I had already done such things. To this day, I still have two Chrome user profiles on my computer, and I use one for college (which I'm almost finished with) and the other for gaming. If I need to focus on school, I just close a browser window (since you can have both open at the same time).

I see this robot a lot.

As far as I can tell, the functionality I used to create the LB Google account no longer exists - instead, YouTube and Google+ just have better support for switching between multiple channels/pages owned by a single Google account. I'm not sure how much longer the LB Google account will continue to exist, but so far it's holding up fine.

This used to say LB725C back in the day.
There's one more strange part of this story, though - my YouTube channel now has two custom URLs. The original custom URL, YouTube.com/LB725C still works. But the LB Google+ page also allowed me to create a custom URL, which I thought only applied to Google+. For some reason I didn't want to use LB725C again, and instead went with the even dumber LBStuff-LB. So now I have a second custom URL YouTube.com/c/LBStuff-LB that for some reason is now the default custom URL.

Notice that this page actually shows both custom URLs for some reason.
I think it's now possible to divorce Google+ from YouTube channels and just use YouTube's channel switcher while logged into your primary Google account, but I'm really scared of what sort of damage will happen if I do that. So for now, I'll just keep my 1.5 Google accounts and figure things out as I go. What a weird trip Google+ was.



What makes puzzle platformers challenging? What makes them good?

I'm a big fan of puzzle platformers - games like Portal 1 and 2, The Talos Principle, The Swapper, etc. - and I've logged many dozens of hours playing such games, mostly due to community-made puzzles. In fact, I've played over 500 community maps for Portal 2, and I've learned quite a bit along the way. Someone asked me an interesting question that really got me thinking:
When do elements that are individually passable become insurmountable or too convoluted when stacked together?
It's a great question, and I think the answer depends on a few factors: how many options plays have at each step, which options players are likely to actually notice, and what players typically think about each option. Every player is different, but that doesn't mean you can't estimate the qualities of a puzzle without players.
How many options does a player standing in the center of the room have?
An 'option' is an action the player can perform to change the state of the puzzle, and it can either have forward progress (they get closer to the solution), negative progress (they create more work for themselves), or no progress (the option isn't part of the puzzle currently). Moving two steps to the left isn't an "option" unless it changes the state of the puzzle (e.g. the player starts or stops being in the way of a light ray, or steps onto or off of a pressure plate). Placing an object at X, and placing an object a centimeter to the left of X aren't separate options unless they have different results. In the above image, the player has two neutral options and one positive option.
Why should the player press the pedestal button on the left at this point?
Knowing what the options are is only half the battle - the player has to actually understand what those options do for them. Players have a natural desire to avoid options that look like they would result in negative progress - you don't typically see players jumping into lava believing that it might advance the story. But sometimes, they do make mistakes, and misjudge options. This is where challenge comes from: looking for options and figuring out if they are good, bad, or neutral at each step of the puzzle.
Should you put the cube on the button, or take it somewhere else first? What's a safer assumption? Why?
There's two ways to solve puzzles: you can plan things out in advance, or you can evaluate your current options and pick the one that looks the best. Generally players use a combination of both tactics, so they start acting before they have the entire solution in their head, or even the entire puzzle. Sometimes it isn't possible to see the entire puzzle without acting, making it a necessity to just start doing things with little planning.
This ramp just leads to a bottomless pit, but it isn't there for decoration or aesthetics.
A puzzle is challenging when it is difficult to distinguish between forward progress options and negative progress options. Challenge does not come from not knowing what the options are, it comes from not knowing whether to even try an option in the first place. Brute force works as long as there are no trapping situations, but experienced players know that brute force is not fun, and thus they evaluate their options to determine which to try. Since every element of a properly designed puzzle will be used at some point, the question is when to choose options - what state does the puzzle need to be in for a normally negative option to be positive?
Quick, use logic to solve this maze on your first try without running into any dead ends or loops!
Easy puzzles make the options easy to distinguish, whereas hard puzzles make the options relatively indistinguishable. An analogy would be that easy puzzles have high contrast and hard puzzles have low contrast. However, there needs to be at least some contrast - otherwise the player is left with brute force. A maze has no contrast because all options look the same. An arrow on the ground telling the player where to go has too much contrast because there is no mental effort required to determine the solution.
Not only does this map present no challenge due to high contrast, it is possible to become trapped.
Challenge is only part of the story, though - puzzles of any challenge level can also be good or bad. It's easy to point to specific problems that make puzzles worse: trapping situations, too many negative options that look positive, lack of negative options, and too much contrast for the player's skill level. A puzzle with only one option at each step is no puzzle at all, nor is a puzzle where all the options result in positive progress, as it makes the player feel like their choices don't matter.
Although this map is logically challenging, it is overly punishing. Here the player needs enough velocity to get to the exit, but the most intuitive way to gain velocity gives the player too much, resulting in their death.
On the other end of the spectrum, tricking the player too frequently with negative options that look positive can be frustrating and even rage inducing. While players should be able to make mistakes, the punishment shouldn't be severe on a regular basis. The map featured in the above image is by far the most punishing map I have played - every mistake the player makes results in having to redo a large majority of the puzzle to get back to where they were and try again.
In this map, the button opens the exit, so naturally the player spends most of their time trying to get a cube into this area to place on the button. But unless they first get blue gel underneath the angled panel and in certain other key locations, getting the cube in this area is just a massive amount of negative progress that the player believes to be positive progress.
It's important to remember that the player has to reconsider all options every time they change the state of the puzzle. Having too many options and/or too many puzzle states can be mentally exhausting, rather than challenging. It's also a bad idea to allow for the player to make considerable negative progress without realizing it - the player should be able to determine that they have made a mistake relatively quickly. The feedback loop should fit within the player's attention span so that they can still remember the moment when they made the mistake. Otherwise the player can feel as though they are wandering around aimlessly trying random things without making any discernable progress. However, it's fine to make it difficult to determine when positive progress has been made - this can make the player feel like they solved something above their skill level.

Having options that never change between puzzle states can make the puzzle feel cluttered. For example, a cube that only needs to be put in one place and then never moved from that position is effectively clutter. Either the cube and its requirement should be removed, or new requirements should be added so that the cube must be used more than once. If the challenge is simply to get the cube there in the first place, then it could probably be replaced with a button for the player to press.
Every time you change the puzzle state in this puzzle, you have to carefully re-evaluate the surprising number of options again, making it difficult to plan ahead at all.
On the other end of the spectrum, having options that change too frequently between puzzle states can make the puzzle feel overwhelming. It's important that some options stay constant for a while as others change, so that the player doesn't have to focus on everything all the time.
In this puzzle, the player is meant to learn that they can travel through portals in both directions, if they haven't already. The design of the puzzle forces the player to exit the pre-placed portal, move their own portal elsewhere, and then re-enter the pre-placed portal.
But what if you want to teach the player something without challenging them, while still making a good puzzle? Good easy puzzles are typically tutorial puzzles that teach the player something new, either by carefully using contrast to highlight the new information, or by reducing the number of options such that the player naturally chooses to use the new information. The puzzle featured above has very few distinct options, even if the player doesn't yet grasp what those options are.
An example of high contrast.
In the above image, there are many more options, but there is high contrast directing the player's attention: the player intuitively understands that each cube belongs on a button, and won't waste time putting the cubes anywhere else once they obtain them. This lets the player quickly rule out options that don't result in forward progress.
Being able to disable the barrier blocking the star requires some extra steps that first-time players wouldn't try.
High contrast can be used in specific instances of more challenging puzzles to reduce the challenge of a particular aspect of the puzzle, and low contrast can be used in easier parts to boost the challenge. This allows for keeping a puzzle feeling consistent, rather than lumpy. Lumpy puzzles have some parts that are either far easier or far harder than the rest of the puzzle, and it can make the puzzle just seem weird - the lumps don't fit naturally with the rest of the puzzle. If you want to hide secrets, however, then lumps are the way to do it, as seen above in The Talos Principle.

Of course, ninjas know that many of these principles apply to more than just puzzle games, but you're totally not a ninja, so I guess you'll never find that out.