3. Get set up with this mod, git, and Stellaris - openly-retro/stellaris-machine-robot-expansion GitHub Wiki

This guide shows how to use git, this repository, and Stellaris to get changes from this mod, and start developing.

If you are brand new to git, I strongly recommend reading and following the steps here, in the Hello world exercise. You might be used to the "Hello world" scenario and sort of roll your eyes a bit, but this is a really basic exercise that teaches the fundamentals of git. Namely, how to pull a branch, make a branch, commit some code, and push your changes. If you want to collaborate with others on mod development in the future, go and do it and power up and then come back ASAP to get started :)

  1. Use the Stellaris launcher to create a new mod, call it "MRE DEV" or something you can remember
  2. Go to the mod folder, using your terminal, and clone the mod's repository there. There are a few ways to clone the repo, see https://github.com/openly-retro/stellaris-machine-robot-expansion

Congrats! you are set up.

Get the latest changes

If you just want to track what's the latest here and try them out in game, do: git checkout main, then git pull

That will put you on that branch. Every so often you can do git pull which will load new code changes automatically.

Make a branch and start contributing

Go to the open issues and look around. Maybe there's something of interest for you to start on. Look at the homepage of this wiki for instructions on how to find something to work on.

  1. Make sure you are on the main branch. (this info might change in the future)
  2. Think of a branch name appropriate for the issue. Type git checkout -b <name_of_the_branch>. Use underscores, don't use spaces. checkout -b means to branch off of wherever the main branch is at.
  3. Make some code changes!

Commit often

What does this mean? It means instead of collecting a huge amount of changes, and then use the git commit command to lock them in, commit smaller change sets. When you have made a commit, you can then send it to the code repository.

BEFORE YOU COMMIT ANYTHING!

  1. Type git status. Make sure you are on the branch you are working on, and not main. If you see output like On branch main when you type git status, switch back to your branch. You do not want to make commits while you are on the main branch.
  2. If you followed the tutorial then you know how to make a commit, and push it.

Rebase

Let's say you check out the main branch and then you do git checkout -b various_gui_fixes. You make some commits, take a break for a week, come back, and you find that the 3.0a alpha branch had a bunch of changes, and you should get your various_gui_fixes branch up to date with the main branch. Maybe someone else did some work and merged it to the main branch. You want to be up to date.

How to rebase:

  1. Know the name of the branch you based your new branch from. In this case it's main
  2. git checkout main
  3. git pull
  4. git checkout various_gui_fixes
  5. git rebase main

Now either things will go fine -- git will say the refs were updated, or you might get a conflict. In which case it's time to ask for help if you are not familiar with this scenario. Also read Resolving Merge conflicts after a rebase

Code tools to help you

I highly recommend VS Code. It is great with search and replace. It also has two game-changing plugins. Go to the Extensions page and look for "CWTools - Paradox Language Services". This is a plugin from the community that will do syntax checking on your Stellaris code. Also get 24's Stellaris YAML Syntax plugin.

VS Code can also help you commit code to your git branches and sync the changes with this repository. It is a nice IDE for working on Stellaris code.

Code style and best practices

It's my humble request that you please do your best to follow the advice in this document: https://github.com/openly-retro/stellaris-machine-robot-expansion/wiki/Dev-notes:-Best-Practices

I will give you reminders in your pull requests if needed.