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 /
This question was closed Sep 01, 2017 at 03:34 PM by NoseKills for the following reason:

Too subjective and argumentative. Big questions that require a conversation like this are better suited for the forums.

avatar image
0
Question by Pablomon · Sep 01, 2017 at 12:16 PM · architecturetoolsdesign-patternsgeneraltips

How do you bring your ideas to real code?

Hi everybody! I guess this is a question for the most experienced devs. Can please give good advice on methods or steps that you take to design the clases of your game? I find it's easy for me to imagine what needs to be happening in the game but have a hard time implementing it. Usually the way objects communicate with each other change along the way.

Do you use diagrams in a particular fashion? When you prototype do you completely forget about code correctness and start from scratch when the prototype is done? or rather reuse most of it? What is your take on layers vs tags? Do you use scriptable objects? Do you use singleton approach? how many classes do you consider ok implementing singleton? Any other approach that is important in any other aspect?

Thank you kindly!

Comment
Add comment
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

1 Reply

  • Sort: 
avatar image
2

Answer by cgarossi · Sep 01, 2017 at 01:04 PM

This is a big subject, but I will add my comments.

I am a software developer by trade. I only write games for a hobby as I love programming.

When I approach a problem, lets say a new game, I always break it down into distinct objects in my mind. Then I separate those out into responsibility.

To keep organised, it's all down to appropriate levels of abstraction and keep responsibility separate.

For example, if I walk into McDonalds and I order a Big Mac. To get a Big Mac certain levels of process have to be co-ordinated but they do not require knowledge of each other.

So, the areas of responsibility are:

  1. Me - I am requesting the BigMac

  2. The Server - He is accepting the request and turning that request into something that...

  3. The Kitchen - ...can understand.

I am not responsible for creating the BigMac, neither is The Server, the components (kitchen staff) in The Kitchen are.

So when approaching a game (or any other software), the same is true. If I have a Spaceship that a player controls I must work out what areas are responsible for what.

I could create an Engine class which is responsible for movement. I can create a Weapon class which is responsible for firing Projectile classes which in turn are responsible for dealing damage.

Finding distinct areas of responsibility is key to not ending up with a complete mess. Analyse what actual objects will exist in your game and work out how they are going to interact with each other.

In another thread a guy had a problem with a Shotgun class in which is shot multiple bullets. The problem is, he was processing the damage by reading bullets that hit his player. In this instance, the responsibility can be delegated to the individual bullet, because in real life, if I am shot, my body does not work out how much damage I receive, the bullet applies it for me! (Unfortunately).

So getting this down early and correctly is essential imo.

Singletons and class Factories are useful tool in a very big box of tools that you will be using. I always create resource managers for instantiating objects (again, responsibility) and I have Singleton factories within that should I require them.

Hope this helps you.

Comment
Add comment · Show 1 · 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
avatar image Pablomon · Sep 01, 2017 at 03:42 PM 0
Share

thanks for a quick answer. I will post in the forum, which seems more appropiate.

Follow this Question

Answers Answers and Comments

71 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 avatar image avatar image

Related Questions

Unity architecture 3 Answers

Is it a good idea to use static classes? 0 Answers

How to avoid one engine class controlling the game flow getting too large 3 Answers

Decoupling state & graphics, while sequentially executing graphic updates 1 Answer

Is it good practice to have GameManager singleton in charge of highest level things? 1 Answer


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