Giter Site home page Giter Site logo

packtpublishing / game-development-patterns-with-unity-2021-second-edition Goto Github PK

View Code? Open in Web Editor NEW
161.0 11.0 71.0 59.32 MB

Game Development Patterns with Unity 2021 - Second Edition, published by Packt

License: MIT License

C# 67.24% ShaderLab 28.78% HLSL 3.98%

game-development-patterns-with-unity-2021-second-edition's Introduction

Game Development Patterns with Unity 2021-Second Edition

Game Development Patterns with Unity 2021

This is the code repository for Game Development Patterns with Unity 2021-Second Edition, published by Packt.

Explore practical game development using industry design patterns and best practices in Unity and C#

What is this book about?

Unity has a particular coding model and architecture that requires knowledge of common software design patterns. This means that to be able to optimally code a game in Unity in the same way you do in other engines, you'll have to adapt to programming techniques including design patterns.

This book covers the following exciting features:

  • Structure your Unity code using industry-standard development patterns to make it look professional
  • Identify the right patterns for implementing specific game mechanics or features
  • Develop configurable core game mechanics and ingredients that can be modified without writing a single line of code
  • Review practical OOP techniques and learn how they're used in the context of a Unity project
  • Build unique game development systems such as a level editor

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

All of the code is organized into folders. For example, Chapter05.

The code will look like the following:

using UnityEngine;

namespace Chapter.State
{
    public class BikeStopState : MonoBehaviour, IBikeState
    {
        private BikeController _bikeController; 
        
        public void Handle(BikeController bikeController)
        {
            if (!_bikeController)
                _bikeController = bikeController;

            _bikeController.CurrentSpeed = 0;
        }
    }
}

Following is what you need for this book: This book is for intermediate-level Unity game developers who are looking to figure out industry standards in building Unity games. The book assumes knowledge of the game engine and programming in the C# language. This book won't be suitable for you if you're only just starting your journey toward becoming a professional game programmer.

With the following software and hardware list you can run all code files present in the book (Chapter 1-16).

Software and Hardware List

Chapter Software required OS required
1-16 Unity 2021.2.0 Windows, Mac OS X, and Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Code in Action

Click on the following link to see the Code in Action:

YouTube

Related products

Get to Know the Author

David Baron is a game developer with over 15 years of experience in the industry. He has worked for some of the top AAA, mobile, and indie game studios in Montreal, Canada. He has a skill set that includes programming, design, and 3D art. As a programmer, he has worked on a multitude of games for various platforms, including virtual reality, mobile, and consoles

Other books by the author

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781800200814

game-development-patterns-with-unity-2021-second-edition's People

Contributors

dbaron-gamedev avatar divyavijayan123 avatar nerdtron avatar packt-itservice avatar packtutkarshr avatar saurabhk710 avatar tacman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

game-development-patterns-with-unity-2021-second-edition's Issues

Two event managers in scene

When running FPP, I'm getting the error below (opened in 2021.3). I'll see if I can fix and submit a PR.

There can be only one active Event System.
UnityEngine.Object:Instantiate (UnityEngine.Object)
FPP.Scripts.Ingredients.Bike.BikeController:InitBikeComponents () (at Assets/FPP/Scripts/Ingredients/Bike/BikeController.cs:108)
FPP.Scripts.Ingredients.Bike.BikeController:Awake () (at Assets/FPP/Scripts/Ingredients/Bike/BikeController.cs:46)
UnityEngine.Object:Instantiate (UnityEngine.Object)
FPP.Scripts.Controllers.TrackController:SpawnTrack () (at Assets/FPP/Scripts/Controllers/TrackController.cs:104)
FPP.Scripts.Controllers.TrackController:SpawnTrack (int,bool) (at Assets/FPP/Scripts/Controllers/TrackController.cs:90)
FPP.Scripts.Controllers.RaceController:EndRace () (at Assets/FPP/Scripts/Controllers/RaceController.cs:75)
UnityEngine.Events.UnityEvent:Invoke ()
FPP.Scripts.Patterns.RaceEventBus:Publish (FPP.Scripts.Enums.RaceEventType) (at Assets/FPP/Scripts/Patterns/RaceEventBus.cs:41)
FPP.Scripts.UI.HUD.HUDController:EndRace () (at Assets/FPP/Scripts/UI/HUD/HUDController.cs:139)
UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/[email protected]/Runtime/EventSystem/EventSystem.cs:501)

There are 2 event systems in the scene. Please ensure there is always exactly one event system in the scene
UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/[email protected]/Runtime/EventSystem/EventSystem.cs:514)

Intention is not clear!?

Hi David,

I'm quite confused on something I have seen in the Chapter 7 where Replay system is implemented using Command Pattern.
the Replay function has a line where it reverses the SortedList.
Since it's already sorted in an ascending order and we try to replay the actions instead of rewinding, shouldn't we use the list as it is, I mean without reversing?

If we really want to reverse the sort order, then we need to assign the reversed list to a new variable, because it's a pure method and existing line has no effect on the current sorted list.

public void Replay()

{
            _replayTime = 0.0f;

            _isReplaying = true;

            if (_recordedCommands.Count <= 0)
                Debug.LogError("No commands to replay!");

            _recordedCommands.Reverse();
        }

Question/Comment about the BikeStopState.cs and BikeTurnState.cs

I noticed the private BikeController _bikeController in both of those classes goes unused. It small but there is the check and assignment of the _bikeController on every call to the Handle function, just feels a little wasteful. Is it there just in case later on something needs to happen outside the Handle ?

Please make 2022 edition layman friendly!

Hi,

I really loved the concepts in this book, but the only thin which stopped me from using it was creating a one big game rather than small chunks of games which use these patterns, as well if possible, please remove the namespaces it confuses newcomers alot.

Could this be updated in upcoming 2022 edition ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.