Changes

Jump to navigation Jump to search
expand & rewrite
Line 1: Line 1:  
{{/header}}
 
{{/header}}
   −
Do you want to create SMAPI mods for Stardew Valley? This guide is for you! '''For using mods, see [[Modding:Player Guide]].'''
+
Do you want to create SMAPI mods for Stardew Valley? This guide is for you!
 +
 
 +
''This guide is about creating SMAPI mods. '''For using mods, see [[Modding:Player Guide]].''' For XNB mods, see [[Modding:Editing XNB files]]. For content packs, see the documentation for the mod you're creating it for.''
    
==Intro==
 
==Intro==
* '''What is SMAPI?'''
+
===What is a SMAPI mod?===
*: A SMAPI mod uses the [https://smapi.io/ SMAPI] modding API to extend the game logic. You can run code when something happens (e.g. mouse clicked or menu opened), or periodically (e.g. once per game tick). SMAPI mods are written in C# using the .NET Framework. Stardew Valley also uses XNA (on Windows) or MonoGame (on Linux and Mac) for the fundamental game logic (drawing to the screen, user input, etc).
+
A SMAPI mod uses the [https://smapi.io/ SMAPI] modding API to extend the game logic. SMAPI provides events so mods can respond when something happens (like when an object is placed in the world), or periodically (like once per update tick).
   −
* '''Can I make a mod?'''
+
SMAPI mods are written in C# using the .NET Framework, and Stardew Valley uses XNA/MonoGame for the game logic (drawing to the screen, user input, etc).
*: The next few sections will walk you through creating a very simple mod. If you follow along, you'll have created a mod! All that will be left is making it do what you want.
  −
*:* <p>'''Scenario A: you're new to programming.'''<br />Many mod developers start with little or no programming experience. You can certainly learn along the way if you're determined, but you should be prepared for a steep learning curve. Don't be too ambitious at first; it's better to start with a small mod when you're figuring it out. It's easy to become overwhelmed at first and give up. The modding community is very welcoming, so don't be afraid to ask questions!</p><p>Since mods are written in C#, it's a good idea to get acquainted with it first. Some good resources are [https://docs.microsoft.com/en-us/dotnet/csharp/quick-starts/ ''C# Quickstarts''] and [https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169 ''C# Fundamentals for Absolute Beginners''], will walk you through the basics of C# needed to write SMAPI mods, from the basic concepts to event-driven programming (which is what SMAPI mods use).</p>
  −
*:* '''Scenario B: you already have programming experience.'''<br />You should be fine. Programming experience in C# or Java will make things easier, but it isn't critical. If you're unfamiliar with C#, you can skim through [https://docs.microsoft.com/en-us/dotnet/csharp/quick-starts/ C# Quickstarts] and [https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169 ''C# Fundamentals for Absolute Beginners''] to fill in any gaps.
     −
* '''<span id="help">Where can I get help?</span>'''
+
===Why do mods use SMAPI?===
*: The Stardew Valley modding community is very welcoming; feel free to [[Modding:Community|ask the community]] for help.
+
SMAPI does a lot for you! For example, SMAPI will...
   −
==Requirements==
+
# Load your mod into the game. Code mods aren't possible without SMAPI to load them.
 +
# Provide APIs and events which let you interact with the game in ways you otherwise couldn't. There are simplified APIs for game asset/data changes, player configuration, translation, reflection, etc. These are covered later in the guide.
 +
# Rewrite your mod for crossplatform compatibility when it's loaded. That lets you write mod code without worrying about the differences between the Linux/Mac/Windows versions of the game.
 +
# Rewrite your mod to update it. SMAPI detects and fixes mod code broken by a game update in common cases.
 +
# Intercept errors. If your mod crashes or causes an error, SMAPI will intercept the error, show the error details in the console window, and in most cases automatically recovers the game. This means your mod won't accidentally crash the game, and makes it much easier to troubleshoot errors.
 +
# Provide update checks. SMAPI automatically alerts players when a new version of your mod is available.
 +
# Provide compatibility checks. SMAPI automatically detects when your mod is incompatible and disables it before it causes problems, so players aren't left with broken games.
 +
 
 +
===Can I make a mod?===
 +
Yes! This guide will help you create a simple mod step-by-step. If you follow along, you'll have created a mod! Then you'll just need to make it do what you want.
 +
 
 +
; If you're new to programming&#58;
 +
: Many mod developers start with little or no programming experience. You can certainly learn along the way if you're determined, but you should be prepared for a steep learning curve. Don't be too ambitious at first; it's better to start with a small mod when you're figuring it out. It's easy to become overwhelmed at first and give up. The modding community is very welcoming, so don't be afraid to ask questions!
 +
 
 +
; If you already have programming experience&#58;
 +
: You should be fine. Programming experience in C# or Java will make things easier, but it isn't critical. If you're unfamiliar with C#, you can skim through the ''Learning C#'' references below to fill in any gaps.
 +
 
 +
===Where can I get help?===
 +
<span id="help"></span>The Stardew Valley modding community is very welcoming. Feel free to ask for help in [[Modding:Community#Discord|#modding on the Stardew Valley Discord]].
 +
 
 +
==Getting started==
 +
===Learning C#===
 +
Since mods are written in C#, it's a good idea to get acquainted with it first. You don't need to memorise everything, but a grasp of the basics (like fields, methods, variables, and objects) will make everything else much easier.
 +
 
 +
Some useful resources:
 +
* [https://docs.microsoft.com/en-us/dotnet/csharp/quick-starts/ ''C# Quickstarts''] teaches the basics of C# with interactive examples.
 +
* [https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169 ''C# Fundamentals for Absolute Beginners''] is a video guide which will walk you through C#, from the basic concepts to event-driven programming (which is what SMAPI mods mostly use).
 +
 
 +
===Requirements===
 
Before you start:
 
Before you start:
<ol>
+
# Read the [[Modding:Player Guide]]. This guide assumes you're already familiar with using mods.
<li>Read the [[Modding:Player FAQs|player FAQs]] which answer common questions about Stardew Valley mods and troubleshooting.</li>
+
# Install Stardew Valley.
<li>Install Stardew Valley.</li>
+
# Install [[Modding:Installing SMAPI|SMAPI]].
<li>Install [[Modding:Installing SMAPI|SMAPI]].</li>
+
# Install the IDE (''integrated development environment'').
<li>Install the IDE (''integrated development environment''):
+
#* On Linux: install [http://www.monodevelop.com/ MonoDevelop].
{| class="wikitable"
+
#* On Mac: install [https://www.visualstudio.com/vs/visual-studio-mac/ Visual Studio 2017 for Mac]. (This is a rebranded MonoDevelop.)
|-
+
#* On Windows: install [https://www.visualstudio.com/vs/community/ Visual Studio 2017 Community]. When the installer asks about workloads, enable ''.NET Desktop Development''.  
! OS
+
 
! what to install
+
If you're not familiar with Visual Studio 2017 (on Windows/Mac) or MonoDevelop (on Linux), [[Modding:IDE reference]] explains how to do the important stuff you need for this guide.
! notes
  −
|-
  −
| Linux
  −
| [http://www.monodevelop.com/ MonoDevelop]
  −
|
  −
|-
  −
| Mac
  −
| [https://www.visualstudio.com/vs/visual-studio-mac/ Visual Studio 2017 for Mac]
  −
| This is essentially MonoDevelop, don't be confused by the labeling.
  −
|-
  −
| Windows
  −
| [https://www.visualstudio.com/vs/community/ Visual Studio 2017 Community]
  −
| When the installer asks about workloads, enable ''.NET Desktop Development''.  
  −
|}
  −
If you're not familiar with Visual Studio 2017 (on Windows/Mac) or MonoDevelop (on Linux), [[Modding:IDE reference]] explains how to do the important stuff you need for this guide.</li>
  −
</ol>
 
translators
8,447

edits

Navigation menu