Everytime I've read about people asking whether they should write their game in C++ or Unity, Unity is usually the default answer, unless they want to go through the hassle of creating an engine by themselves when Unity already does everything for you. If that's the case is there ever a case where writing a game in C++, Java, Rust etc... is better than using Unity? If so what are these cases?
You need to write a game without an engine when you have a game with very unique technical challenges which are not sufficiently covered by general-purpose game engines.
General purpose game engines like Unreal, Unity or Godot are optimized for running any kind of game people can come up with. But a one-size-fits-all solution often has problems with handling unusual edge cases. When your game idea is such an unusual edge case (most are not), then you might have to create your own engine in order to perform the low-level optimizations you need in order to run your game with satisfying performance.
A couple games which would not have been possible (or at least very difficult) with a general purpose game engine are:
- Minecraft, with its millions of blocks in a single scene. Which runs so well on low-budget hardware due to the simplistic graphics and well-chosen data-structures.
- Factorio, which does a lot of micro- and macro-optimization to make sure it can process a huge amount of entities (their development blog is a treasure trove of interesting programming tricks).
- Flappy Bird. Yes, I am serious. What, you say you could do that in your favorite game engine in a couple hours? Sure, but could you squeeze it into an APK of under a MB? Game engines tend to add runtimes which are several MB in size to every game. Which hardly matters for a large project but seems pretty excessive for a tiny one. Filesize is also an important factor for web-based games, where every additional second of loading time will cause you to lose a couple players.
However, game engines do keep developing and become able to cover more specialized use-cases they couldn't before. Like Unity's DOTS initiative which allows to create games which require highly optimized game systems and its scriptable render pipelines which can be used to optimize for unusual render performance requirements.
The main reasons I can come up with are:
- the challenge / bragging rights / language practice. Some people just get bored when things get too easy, or they want to see what is possible without an engine.
- not knowing any better - most people are guilty of doing that at least once.
- not being dependant on an engine. That's a very ambitious thing and most of the time it's attempted by companies that want to make their own engines... either to save the money in the long run, or to make something very specialized for games they are making
- making a game for very specific environment, like certain machines that might not be able to run common engines. I think that doesn't happen very often lately though.