Browse Source

Change sample project to HelloModdingWorld

master
NGnius 4 years ago
parent
commit
f7adaa1b99
1 changed files with 14 additions and 12 deletions
  1. +14
    -12
      site/guides/first.html

+ 14
- 12
site/guides/first.html View File

@@ -28,7 +28,8 @@
I've tried to make the setup as easy as possible, so that you can get straight to the interesting part: modding.
But before we get started, you've got some waiting around to do; time to install some software and download some stuff.</p>
<p>To get the ball rolling, you'll need to download <a href="https://visualstudio.microsoft.com/vs/community/">Visual Studio Community Edition</a>, the <a href="https://dotnet.microsoft.com/download/dotnet-framework/net48">.NET 4.8 Developper pack</a> and <a href="https://git.exmods.org/modtainers/GCIPA/releases">GCIPA's latest release</a> for this guide (and for Gamecraft modding).
I'm sorry in advance to the smart devs who don't use Windows; <a href="https://www.monodevelop.com/">monodevelop</a> may work, but I haven't had any success.
To any smart devs who don't use Windows; <a href="https://www.monodevelop.com/">monodevelop</a> does work, but you'll need to use .NET 4.7.* when building.
The process is quite similar for every IDE, but I'll focus on VS because it's popular.
You'll also need Gamecraft (and Steam) installed on your computer, unless you're magic or something.
Since Visual Studio is a Microsoft product, it'll take a while to install, so while you're waiting for that to do it's thing, let's patch Gamecraft.</p>
<p>The latest release of GCIPA that you just downloaded is for patching Gamecraft.
@@ -40,31 +41,32 @@
Congratulations! Here's your certificate: <a href="http://pre06.deviantart.net/23ca/th/pre/f/2016/306/0/9/hackerman_by_shiiftyshift-dan31sc.png">(Certification of hacking that I stole off the internet)</a>.
(NOTE: you'll need to re-patch the game everytime Steam updates Gamecraft)</p>
<p>I'm willing to bet Visual Studio is still downloading (thanks MS), so wait until that's done and then continue.
Using Visual Studio, clone the <a href="https://git.exmods.org/modtainers/TestMod">TestMod git repository</a> into a folder (NOT into Gamecraft's install location) and switch to the "base" branch.
The base branch of TestMod provides a starter project for creating your own GCIPA-based mod (called a "plugin").
Using Visual Studio, clone the <a href="https://git.exmods.org/modtainers/HelloModdingWorld">HelloModdingWorld git repository</a> into a folder (NOT into Gamecraft's install location) and switch to the "base" branch.
The base branch of HelloModdingWorld provides a starter project for creating your own GCIPA-based mod (called a "plugin").
Before you make any changes, though, you'll want to create your own git repository to store your mod (unless you're that one guy in my office who dislikes open-source).
Feel free to use <a href="https://git.exmods.org/">Exmods' Git server</a> (hosted by me!) to make your mod accessible to other modders and Gamecraft players.
For the purpose of this guide the git repository name I'm using is "MyFirstMod".
Clone your new git repository using Visual Studio, then copy the files (except the .git folder, if you can see it) from TestMod into MyFirstMod's folder.
Clone your new git repository using Visual Studio, then copy the files (except the .git folder, if you can see it) from HelloModdingWorld into MyFirstMod's folder.
Now you've got your first mod ready to go.
It won't build though, since the project has no idea where Gamecraft is.</p>
<p>To point the Visual Studio project to the right Gamecraft dependencies, you've got two options:
copy the contents of [Gamecraft install location]/Gamecraft_Data/Managed into a new folder called "ref" in MyFirstMod, or <a href="https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/">create a symlink to Managed called ref</a>.
copy the contents of your Gamecraft install location into a new folder called "ref" in MyFirstMod, or <a href="https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/">create a symlink to Gamecraft's main folder</a>.
The disadvantage to the former option is that you'll have to re-copy the files everytime there's a Gamecraft update.
This step is explained in HelloModdingWorld's <a href="https://git.exmods.org/modtainers/HelloModdingWorld/src/branch/no-api/README.md">README</a> as well.
No matter which you choose, if you've done everything correctly the project should now build successfully (CTRL+SHIFT+B or Build > Build Solution).
In MyFirstMod's TestMod/bin/net48 folder copy TestMod (TestMod.dll) into Gamecraft's new Plugins folder and your first mod is installed.</p>
In MyFirstMod's HelloModdingWorld/bin/net48 folder copy HelloModdingWorld (HelloModdingWorld.dll) into Gamecraft's new Plugins folder and your first mod is installed.</p>
<h3>Modifying Your Mod</h3>
<h5>Blood in the cut</h5>
<p>Your mod is installed, but it doesn't do anything yet. Let's fix that.
In Visual Studio, open TestPlugin.cs and take a look at it.
This is the main <a href="https://github.com/Eusth/IPA">Plugin</a> file, which is the interface between Unity and IPA.
In Visual Studio, open MyPlugin.cs and take a look at it.
This is the main <a href="https://git.exmods.org/modtainers/GCIPA">Plugin</a> file, which is the interface between Unity and IPA.
It's very similar to a <a href="https://docs.unity3d.com/ScriptReference/MonoBehaviour.html">Unity MonoBehaviour</a>, but with some sprinkles.
As the first modification, let's do something simple: In the OnUpdate() method, add (or uncomment) "Debug.Log("Print this to log every frame");" (without quotes) and then save and build the project.
Once again, copy TestMod (TestMod.dll) into Gamecraft's Plugins folder. Now start Gamecraft.
When you open Gamecraft's Player.log file (found in something like %appdata%/../LocalLow/FreeJam/Gamecraft), you should see some wonderful spam of "Print this to log every frame".
As the first modification, let's do something simple: In the OnUpdate() method, add "Debug.Log("Print this to log every frame");" (without quotes) and then save and build the project.
Once again, copy HelloModdingWorld (HelloModdingWorld.dll) into Gamecraft's Plugins folder. Now start Gamecraft.
If you open Gamecraft's Player.log file (found in something like %appdata%/../LocalLow/FreeJam/Gamecraft), you should see some wonderful spam of "Print this to log every frame".
You did that! You've modified your first mod!</p>
<p>For more advanced stuff, I'd recommend using a C# decompiler like <a href="https://github.com/0xd4d/dnSpy/releases">dnSpy</a> to read Gamecraft code and figure out what you need to modify.
Also read about <a href="https://github.com/pardeike/Harmony/wiki">Harmony</a> (included in the TestMod base configuration; see TestPatch.cs) for patching existing methods.</p>
Also read about <a href="https://github.com/pardeike/Harmony/wiki">Harmony</a> (included in the HelloModdingWorld base configuration; see HelloModdingWorld.csproj) for patching existing methods.</p>
<h3>Gamecraft Architecture<h3>
<h5>Do I wanna know</h5>
<p>Gamecraft modding uses a few new ideas in game development which can be quite different from common software engineering practices.


Loading…
Cancel
Save