Stardew Valley, developed by Eric Barone (also known as ConcernedApe), is built on Microsoft's XNA framework. To clarify, the XNA framework is not a game engine but rather a set of tools and a runtime environment provided by Microsoft that facilitates video game development and management for Windows-based platforms.
XNA stands for "Xbox New Architecture" and was designed to be relatively easy to use, aiding independent developers in creating games for Windows and Xbox 360. However, it's worth noting that Microsoft officially discontinued XNA in 2013, and consequently, an open-source implementation of the Microsoft XNA 4 Framework, called MonoGame, has been adopted by many developers to continue support for their games or create new ones.
In the case of Stardew Valley, which began development around 2012, Eric Barone used C# along with the XNA framework to create the game. This choice reflects the period's landscape when XNA was still a current platform. For post-discontinuation updates and ports (like those for iOS, Android, and Switch), Stardew Valley has switched over to using MonoGame, which allows developers to port their games across different platforms while maintaining a single codebase close to the original XNA implementation.
It's important to acknowledge that MonoGame acts as more of a framework than a full-fledged game engine, so a significant amount of custom development would have been involved in creating Stardew Valley, as opposed to using a more integrated game engine like Unity or Unreal Engine where a lot of systems (such as physics, rendering, audio, etc.) are already in place.
Here is a very simplified pseudo-code snippet to show how one might initialize a game loop in XNA:
The above code is a template that the XNA framework provides; it includes methods like
Draw which you override to implement your game functionality. Stardew Valley’s actual code would be far more complex due to the intricacies of gameplay mechanics, rendering, and content management.
Due to its performance and compatibility across platforms, MonoGame is particularly popular among indie developers who want to work with a framework that gives them direct control over the game mechanics and is flexible enough to provide a good starting point without imposing too much structure or overhead.