Difference between revisions of "Coding"

From Space Station 13 Wiki
Jump to navigation Jump to search
(expands a bit more on using git for stuff, more to come in a bit)
(talks about making new branches with git, branch conventions, adds disclaimer that this guide is pretty much just for terminal git)
Line 7: Line 7:


'''The first thing you're gonna want to do, is get the Goonstation 2016 code and set up a branch.'''
'''The first thing you're gonna want to do, is get the Goonstation 2016 code and set up a branch.'''
<b>This guide is for terminal git! There might be more guides coming soon for other git interfaces, or you can ask for help in #imcoder regarding other git interfaces, setting them up, and using them!</b>


# You're going to need git, so download and install it from [https://git-scm.com/download/win here]
# You're going to need git, so download and install it from [https://git-scm.com/download/win here]
Line 14: Line 15:
# The code should begin to download, and you should see a new folder on your desktop called "goonstation-2016"
# The code should begin to download, and you should see a new folder on your desktop called "goonstation-2016"
# Now you'll want to get the terminal open in that folder (either by right clicking inside of the folder and clicking the "open terminal here" option, or using the cd command in the terminal to navigate to that directory).
# Now you'll want to get the terminal open in that folder (either by right clicking inside of the folder and clicking the "open terminal here" option, or using the cd command in the terminal to navigate to that directory).
# Let me quick explain a few things about using git. So, there's four possible (afaik) file statuses. There's added, unadded, unmodified, and untracked. Currently (if you haven't touched any files since cloning) every single file in the goonstation directory is <b>unmodified</b>. As soon as you modify a file in any way, that file will become <b>unadded</b> and lose its unmodified status. If you type <syntaxhighlight line='none' enclose='none'>git status</syntaxhighlight> (git status will show you all added, unadded and untracked files in the branch you're working in, and the name f the branch you're working in), you'll see that file in an unadded files category with the file path in red text. Now, if you type <syntaxhighlight line='none' enclose='none'>git add your/file/path/yourfilename</syntaxhighlight>, your file will become <b>added</b>, and it'll be added to the list of files that will be committed. I'll talk about committing a bit later. If you (or byond) creates a new file in your goonstation directory, it'll be added as an <b>untracked</b> file. Both untracked and unadded files will persist between branches and commits. This is useful for some things, like editing config/admins.txt to include yourself as a host for testing purposes and then never adding the file so you'll always have an admin rank anytime you test, but it can also be problematic so make sure you're not leaving anything untracked or unadded that should either be committed or reverted.  
# Let me quick explain a few things about using git. So, there's four possible (afaik) file statuses. There's added, unadded, unmodified, and untracked. Currently (if you haven't touched any files since cloning) every single file in the goonstation directory is <b>unmodified</b>. As soon as you modify a file in any way, that file will become <b>unadded</b> and lose its unmodified status. If you type <syntaxhighlight line='none' enclose='none'>git status</syntaxhighlight> (git status will show you all added, unadded and untracked files in the branch you're working in, and the name f the branch you're working in), you'll see that file in an unadded files category with the file path in red text. Now, if you type <syntaxhighlight line='none' enclose='none'>git add your/file/path/yourfilename</syntaxhighlight>, your file will become <b>added</b>, and it'll be added to the list of files that will be committed. I'll talk about committing a bit later. If you (or byond) creates a new file in your goonstation directory, it'll be added as an <b>untracked</b> file. Both untracked and unadded files will persist between branches and commits. This is useful for some things, like editing config/admins.txt to include yourself as a host for testing purposes and then never adding the file so you'll always have an admin rank anytime you test, but it can also be problematic so make sure you're not leaving anything untracked or unadded that should either be committed or reverted.
# Now, you'll want to make a new branch for your feature that you're coding (or your map/setpiece that you're making, or your clothes you're spriting). You'll want to make sure you're on the master branch. If you're not, type <syntaxhighlight line='none' enclose='none'>git checkout master</syntaxhighlight> to get there. I suggest using prefixes for the different type of stuff you're working on, like feature/, map/ or  sprite/, and using either dashes "-" or underscores "_" to seperate words, <i>but not both!</i> This'll make it easier to sort and switch branches without having as much guesswork.
#To make your new branch, type <syntaxhighlight line='none' enclose='none'>git checkout -b feature/crime-time-usa</syntaxhighlight>. Git will do a bit of work, and then you'll be pumped into your new branch!
#To list all of your branches, type <syntaxhighlight line='none' enclose='none'>git branch</syntaxhighlight>. If your list of branches is taller than your terminal window, use the arrow keys to navigate down the list. When you get to the bottom, press q to exit the weird no-typey mode so you can continue to do commands. 


'''Next, the Dream Maker'''
'''Next, the Dream Maker'''

Revision as of 18:45, 12 November 2019

So you want to wicky wangy diddly dangy learn how to code SS13?

Well you've come to the right place. This page is dedicated to helping you learn the ins and outs of writing SS13 code. I'll assume you have an above average knowledge of computers. If you ever need help with any of this, feel free to visit the #imcoder channel in the goonstation discord! There's a bunch of helpful people in there who would love to help you learn or help you with any errors you're getting <3


The first thing you're gonna want to do, is get the Goonstation 2016 code and set up a branch. This guide is for terminal git! There might be more guides coming soon for other git interfaces, or you can ask for help in #imcoder regarding other git interfaces, setting them up, and using them!

  1. You're going to need git, so download and install it from here
  2. Once you've installed that, open command prompt (win+r, type 'cmd', enter)
  3. In that terminal type <syntaxhighlight line='none' enclose='none'>cd %UserProfile%\Desktop</syntaxhighlight> to move to your desktop (then enter)
  4. Then in that terminal type <syntaxhighlight line='none' enclose='none'>git clone https://github.com/goonstation/goonstation-2016</syntaxhighlight> and press enter
  5. The code should begin to download, and you should see a new folder on your desktop called "goonstation-2016"
  6. Now you'll want to get the terminal open in that folder (either by right clicking inside of the folder and clicking the "open terminal here" option, or using the cd command in the terminal to navigate to that directory).
  7. Let me quick explain a few things about using git. So, there's four possible (afaik) file statuses. There's added, unadded, unmodified, and untracked. Currently (if you haven't touched any files since cloning) every single file in the goonstation directory is unmodified. As soon as you modify a file in any way, that file will become unadded and lose its unmodified status. If you type <syntaxhighlight line='none' enclose='none'>git status</syntaxhighlight> (git status will show you all added, unadded and untracked files in the branch you're working in, and the name f the branch you're working in), you'll see that file in an unadded files category with the file path in red text. Now, if you type <syntaxhighlight line='none' enclose='none'>git add your/file/path/yourfilename</syntaxhighlight>, your file will become added, and it'll be added to the list of files that will be committed. I'll talk about committing a bit later. If you (or byond) creates a new file in your goonstation directory, it'll be added as an untracked file. Both untracked and unadded files will persist between branches and commits. This is useful for some things, like editing config/admins.txt to include yourself as a host for testing purposes and then never adding the file so you'll always have an admin rank anytime you test, but it can also be problematic so make sure you're not leaving anything untracked or unadded that should either be committed or reverted.
  8. Now, you'll want to make a new branch for your feature that you're coding (or your map/setpiece that you're making, or your clothes you're spriting). You'll want to make sure you're on the master branch. If you're not, type <syntaxhighlight line='none' enclose='none'>git checkout master</syntaxhighlight> to get there. I suggest using prefixes for the different type of stuff you're working on, like feature/, map/ or sprite/, and using either dashes "-" or underscores "_" to seperate words, but not both! This'll make it easier to sort and switch branches without having as much guesswork.
  9. To make your new branch, type <syntaxhighlight line='none' enclose='none'>git checkout -b feature/crime-time-usa</syntaxhighlight>. Git will do a bit of work, and then you'll be pumped into your new branch!
  10. To list all of your branches, type <syntaxhighlight line='none' enclose='none'>git branch</syntaxhighlight>. If your list of branches is taller than your terminal window, use the arrow keys to navigate down the list. When you get to the bottom, press q to exit the weird no-typey mode so you can continue to do commands.

Next, the Dream Maker

Now I'm going to show you how to edit, compile, and run code, using DreamMaker.

To open DreamMaker, open byond. Then navigate to the setting menu and click Open DreamMaker

Opendm.png

Supplementary Video