Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by RobbyT15 · Jul 26, 2017 at 03:25 PM · gamecontroller

Help with understanding how the gamecontroller script works

I'm trying to understand the concept of game controllers and what all they're used for in different types of games. Are they mainly to control how the game operates? For instance, if I had an RPG that had a questing system, would it be the game controller that manages that? So what all should I consider when building a game controller? Is it everything that doesn't involve user input? Can anyone explain this to me, or at least point me in the direction to find this information?

To clarify, I'm not talking about physical game controllers, I'm talking about the game manager script you add to your game attached as a game object.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Insurikai_ · Jul 26, 2017 at 03:32 PM 1
Share

It's a game by game sort of thing, but I usually use multiple to handle different types of things, so in an game like Pokemon there might be one that handles wild encounters, one that tracks player progress, and one that handles battle mechanics (I.$$anonymous$$ Fire deals 2x dmg to Grass Types), but i'm also new to game development so take what i say with a grain of salt.

avatar image RobbyT15 Insurikai_ · Jul 26, 2017 at 03:37 PM 0
Share

I think I understand. So basically, everything that the game would manage, like respawning killed enemies or characters or resources if you have a crafting system? Things like that?

avatar image Insurikai_ RobbyT15 · Jul 26, 2017 at 04:31 PM 0
Share

Yes but like @$$anonymous$$okV said you might want to separate them into smaller managers so that it is easier for you to manage

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by EnokV · Jul 26, 2017 at 04:26 PM

I would avoid something as generic as a "Game Controller" or a "Game Manager" all together. It might be tempting to have a big container which controls the flow of your entire game, I would however consider having multiple "manager-classes" that each have one job.

A GameStateManager could be tasked to raise and respond to various events all related to the current state of the game. The states could be:

Loading, Playing, Paused, Quitting

I would then consider having a separate QuestStateManager which is tasked with updating various flags based on certain events that the player (or other objects) trigger.

Depending on the size of your game, I would go so far to have separate classes for each quest, which in term implements the means to raise events which the QuestStateManager subscribe to. Each quest would keep its own internal state related to tasks and so on..

An InputManager class could be tasked with routing action messages to say the Player or the UI based on the current gamestate, etc etc.

Often when I have seen "Game Managers", they've contained everything ranging from references to player / enemy objects to keep track of health and update the UI, to generating terrain to saving and loading. The result is an unmanageable cluster of spaghetticode and all it does is contribute to headaches. The truth is, the term "Game Manager" or "Game Controller" is so incredibly vague and thus easy to abuse.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

69 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do you add player lives and end the game? 0 Answers

Control Player Altitude 0 Answers

UCE0001 even though i got the semicolon right (i think) 1 Answer

Teleporting MainCamera and GameController 1 Answer

Checking variables in GameController from a gameobject? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges