Architecture, Performance, and Games


1. In your words, what is software architecture, and how do you think about it in relation to making a game in Unity?

Software architecture is the design of the code, it focuses mainly on organization of that code. This is extremely important in game creation as many assets and scripts are needed in a game, having a readable and organized base to work from can increase production and minimize confusion.

2. What is your primary goal when prototyping, and how does that conflict with "best practices" for software architecture?

Prototyping is fast coding, that is most of the time very messy and usually in one single script. This is counter to the idea of 'best practices' software architecture because there often isn't enough time to revise, edit, or modularize code.

3. What is decoupling, and why is it essential to software architecture?

Decoupling is seperating code that doesn't need to be together into separate scripts or seperate functions. This is essential because it allows for easy editing, faster understanding, and a better way of storing code for later problems in the software.

4. Present an example of your own code and explain how you could apply one of the concepts found in the chapter (decoupling, flexibility, simplicity, abstraction, etc.)

In this code I could have decoupled the gameObject from the rest of the script. I could have also decoupled the audio source from the script as it's not linked to the camera switching. 

public Camera camera1;
public Camera camera2;
public Camera camera3;
public Camera camera4;
public AudioSource music;
public GameObject holder;
// Use this for initialization
void Start ()
{   camera1.enabled = true;   camera2.enabled = false;   camera3.enabled = false;   camera4.enabled = false;
}
// Update is called once per frame
void Update () {   if (Input.GetKeyDown(KeyCode.Space))   {      Destroy(holder);      music.Play();   }   if (Input.GetKeyUp(KeyCode.Alpha1))   {      camera1.enabled = true;      camera2.enabled = false;      camera3.enabled = false;      camera4.enabled = false;   }
   if (Input.GetKeyUp(KeyCode.Alpha2))   {      camera1.enabled = false;      camera2.enabled = true;      camera3.enabled = false;      camera4.enabled = false;   }
   if (Input.GetKeyUp(KeyCode.Alpha3))   {      camera1.enabled = false;      camera2.enabled = false;      camera3.enabled = true;      camera4.enabled = false;   }   if (Input.GetKeyUp(KeyCode.Alpha4))   {      camera1.enabled = false;      camera2.enabled = false;      camera3.enabled = false;      camera4.enabled = true;   }
}

Comments

Log in with your itch.io account to leave a comment.

👍