Week 3: Architecture, Performance, and Games

  1.  What is software architecture, and how do you think about it in relation to making a game in Unity?
    1. Software architecture is the organization and layout of code in a program. I think about software architecture when tying to make my scripts as responsive and simple as possible, so that it handles any changes I make automatically.
  2. What is your primary goal when prototyping, and how does that conflict with "best practices" for software architecture?
    1. When prototyping, I usually try to make sure that a specific task happens. I don't have the time to code this as effectively as I'd want which means that unless I eventually clean it up, any code relating to that specific task could become messy and time consuming.
  3. What is decoupling, and why is it essential to software architecture?
    1. Decoupling is basically making specific parts of code self sufficient, so that they don't require some other part of code to be fixed or changed. This is essential to software architecture because it reduces the need to make multiple adjustments per any change or fix you make to the code.
  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.) 
    1. This code begins the game with "space" but is also in charge of switching cameras throughout. This code changes cameras by checking when the ball collides with certain objects throughout its course.  Because the ball is not present throughout the entire play through, half of the cameras had to be switched independently of the ball. I could have just decoupled all of the cameras since it would have made it more organized since i had to decouple more than half of them.
void Update () {
        if (Input.GetKey(KeyCode.Space)){
            GetComponent<rigidbody>().useGravity = true;
        if (transform.position.y< 90){
            Debug.Log("Should be goign down");
        if (transform.position.x > 30 && cameras[2].enabled){
        if (specialRectangle.transform.rotation.eulerAngles.y > 91 && justOnce){
            cameras[3].enabled = false;
            cameras[4].enabled = true;
            justOnce = false;
        if (bigSphere.transform.position.y < 58 && secondFlag){
            cameras[4].enabled = false;
            cameras[5].enabled = true;
            secondFlag = false;
        if (cameras[4].enabled){
        if (cameras[5].enabled){
        if (bigSphere.transform.position.x < -160 && thirdFlag){
            cameras[5].enabled = true;
            cameras[6].enabled = true;
            thirdFlag = false;
    private void OnCollisionEnter(Collision other){
        if (other.gameObject.CompareTag("Next")){
                cameras[i - 1].enabled = false;
                cameras[i].enabled = true;


Log in with itch.io to leave a comment.

👍 good answers