Skip to content
Snippets Groups Projects

README

This is a document to explain some basic things about the usage of git but also how to use the code Lisa and Meike made for the Bachelor Group Project of 2018.

Content Table:

  • Version control
    • which version of which program we use
  • Git
    • Basic Commands
    • Branch Commands
    • What to do if you have a problem
  • Visual Studio & Unity
    • Good Links to test and learn your C#-Skills
    • Information about specific parts of our code
    • some Basics
    • our Asset
    • how to use the Asset with VS and Unity

Version control

Our unity version is 2018.3.0f2. You can get this version on the unity site in their download archives.

As an idle we use Visual Studio Code 2017.

GIT

Git is an excellent tool to work on the same project with a group. It is remarkable for the version control but makes it also possible to be in different locations while working on the same project. Important for a good workflow between different versions but also between different work spaces is the usage of branches. Please use the great branch system of GIT to make everyone's workflow easier.

If you have further questions, here are some links:

Git in general (link provided by Andrea) https://rogerdudler.github.io/git-guide/index.de.html

Git on Windows https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

Git on Mac http://guides.beanstalkapp.com/version-control/git-on-mac.html

Don't panic if something does not work on the first try - you can find via google solutions for your problems.

Important BASIC Git commands (when you want to use the cmd of your OS)

  • git status -- checks what the current status of your local repository is
  • git pull -- if someone changed files or data on the server you download those changes with git pull directly in your path from your repository
  • git add -A -- if you changed something locally but want to commit it you need to add it first so GIT can find it. The -A stands for all. If you want to commit only specific files that you changed, you can use for example: Adds content from all *.txt files under Documentation directory and its subdirectories: $ git add Documentation/*.txt Note that the asterisk * is quoted from the shell in this example; this lets the command include the files from subdirectories of Documentation/ directory. After you used git add, you can check again with git status if git added every file that you wanted to commit
  • git commit -m "" -- after you added every file you now have to form a commit with those files. The -m "" is for the commit message. Every commit NEEDS a message. You can not commit without a message. You can describe in a few words what you added/changed/deleted from the repository. Some Examples: git commit -m "This is a Test commit"
  • git push -- After you finished your commit, you can now "push it up" to the server. The server will automatically change the old versions of the changed files to your version. On this part you can get a lot of error messages. Please search on google for more information about the specific error message you got. Important BRANCH Git command
  • git branch --list -- Shows you all existing branches. The branch you are working on will be highlighted
  • git branch --show-current -- Prints your current branch out into your cmd
  • git branch -- creates a new branch but does not checkout the new formed branch
  • git branch -d -- "Soft" delete
  • git branch -D -- If you want to delete everything even your unmerged files

If you created a Branch you also need to check it out. This means that everything that you will commit will be uploaded onto your branch. And your branch only. Because of this system it is not possible to not merge. It is hard work, but if we can get a rythmn into merging it will be easier to do version control. A good tutorial about using branches is: https://www.atlassian.com/git/tutorials/using-branches

If you do not want to use the cmd, you can use following tools:

  • smartGit

Visual Studio & Unity

As our code idle we decided on Visual Studio 2017- It is easy to use and beginner friendly. As of now, you can also use Visual Studio Code 19 becaue i did not saw any changes or problems between Visual Studio and Unity.

If you want to see our current script just follow this path in our git project:

Greta/greta/Greta/Assets/PAC Engine/Scripts

Here you can just edit the code without opening Unity. But sometimes it is important to work with both programs together to see if your code worked the way you wanted it to work.

More information about c#:

https://docs.microsoft.com/en-us/dotnet/csharp/

Information about our code

Basics

We work in our project with a 3rd Party developed Plugin which was bought specifically for this project. More information:

file:///D:/Greta/greta/Greta/Assets/PAC%20Engine/PAC%20Engine%20Doc.pdf

It is important to understand how the Plugin works to create good code. Especially if you want to create code with which you want to get more than basic stuff done in the game. Important is the Database. At the beginning it will seem a little bit confusing, but it gets better. Just for example, I created a chart with two examples for the Database. The first is a simple one with the background sounds. The second is more complicated than I could show in this basic flowchart. It describes the pure and easiest way how the database and an random entity works together.

If you want to use the progress of the game an important factor with the game play you will need to use the database. After you understand how it works it is quite handy to use it for simple tasks, e.g. changing the scenery (Our ChangeScenery.cs for example) or also to make workarounds possible.

Now I want to show what I mean.

    if (Database.core.entities[SupportFunctions.core.findEntityIndexById(entityID)].entityStageId == stage)
    {
        oldSprite.GetComponent<SpriteRenderer>().enabled = false;
        neueSprite.GetComponent<SpriteRenderer>().enabled = true;


        if (DestroyOnChange == true)
        {
            Destroy(oldSprite);
        }

    }

In this snippet of code, you see how the script will enter the Database and uses the SupportFunctions with which it is quite easy to make an if-statement for such easy scripts.

Here is a list with good scripts you kinda have to understand to work with the game and it's code core.

  1. Database, it is getting old, but it is still very important because it is everywhere - from Music, Voices to Quests.
  2. SupportFunctions. This in combination with our Database is a quick and quite safe way to find the information you want. It does not matter if you only want to know which Entity is in which stage, but also if you want to find out if item X is currently in the possesion of our player or if he finished quest Y.
  3. ItemAction. Here we store everything that is possible to achieve with usage of specific items. It can get quite long and the current code is ugly, but it works and honestly I did not found a way to make the code cleaner and easier. Especially because each case is quite different and only works with specific GameObjects.

And last, this plugin was only updated once. Lisa and I saw some of its shortcomings. If we want to customize our game more and more we have to create our own code and can not rely to much on the Plugin. It is just the base for the rest of our code.

To find more information about Unity and how the basics work, click here: https://docs.unity3d.com/2018.3/Documentation/Manual/UnityManual.html