Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by Unim21 · Dec 04, 2013 at 08:31 PM · designdesign-patterns

Developing an extensible framework for a video game

I realize that this question may be a little broad, but I'm wondering how experienced game developers here might approach the design and implementation of a framework that allows for extensibility of game mechanics and objects.

For instance, let's say we have a space simulator MMO with a comprehensive system in place for starship mechanics such as a power plant, weapon systems, etc. These systems are interdependent and can be upgraded, such as acquiring more powerful projectile weapons or ship components with enhanced functionality.

Would you simply create a main class called "projectile" that could then be implemented various ways as needed?

Are there any examples out there of such a framework? It doesn't have to be space-related of course.

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 CHPedersen · Dec 04, 2013 at 08:38 PM 1
Share

It's not totally clear what kind of implementation details you expect here (which is why this is a comment and not an answer), but it sounds to me like you're describing normal aspects of object oriented program$$anonymous$$g. I recommend you do some reading up on this field of program$$anonymous$$g; you'll find that it serves the extensibility requirements you have quite nicely. Especially parts on polymorphism / inheritance.

avatar image ThePunisher · Dec 05, 2013 at 12:05 AM 0
Share

I'm on the same boat as CHPedersen. I think what you're asking is outside Unity, even C#, and more on a program$$anonymous$$g practices/design level.

avatar image EX_Darius · Dec 05, 2013 at 12:10 AM 0
Share

So if im correct you want to make a main class for ex: weaponfire then create childs that define the type of bullets/RoF/type etc.

You might want to look into the UT2004 weapon fire system, it uses the same type of structure that youre suggesting.

Heres a link to the files: http://udn.epicgames.com/Two/USCRIPTDownload.html

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by RyanZimmerman87 · Dec 05, 2013 at 12:32 AM

It's all about the way you set up your systems and design your scripts. When I started my project I did the majority of my code specifically for the individual important prefabs with private variables.

Lately I've been trying to write scripts that are easy to work with in the editor using public properties if they are meant to have more broad functionalities which can be used on many different prefabs.

For example I've designed a few systems that allow my artist to work with NPC's directly in the editor with a few of my scripts. So my artist can pretty much set behavior for the NPC's in the editor even though they don't know how to program.

So the NPCs for example can do a wide variety of behaviors/functionalities which are fully customizable in the Unity Editor with the scripts. So my artist can enter strings for text bubbles or animation names. Both of which can be called as desired from other functions which you can assign which number to call from those arrays.

So essentially I created a system that has arrays of strings, bool check boxes, and integers/floats. All of them are public so that whoever is working on them can enter it directly into the editor. These variables control things like:

  • Which animation should play

  • How fast should the animation play

  • How fast is the NPC movement speed

  • Do they Patrol

  • What type of patrol do they use (random, circular, back and forth)

  • When they reach patrol points do they continue or go idle

  • Do they have a random chance to continue or go idle

  • How long will they go idle (min - max Random.Range)

  • Where do they look when Idle

  • Do they display text bubbles?

  • Which text bubble string will they display when idle (desired number, random, next one in array, etc)

  • How long will they display the string, how much of a delay before the string triggers

  • What kind of trigger or event should start the text bubble string (player collision + distance, scene timer, patrol area collision, etc.)

And all of these behaviors can be modified from there original states if the NPC is patrolling and hit a certain collider in their patrol path. So for example they could start with a move speed of 4 but then they hit a collider by some dangerous stuff and you assign new variables for move speed, animation type, next patrol point, etc.

I think you get the point here, just trying to give as good example as I can for setting up something that I think is related to your question.

Essentially the way I look at it now is can someone who doesn't even know how to program set up complex systems in the game using your scripts? If not what public variables and behaviors would they need to have as much control over everything as possible. If you design all your scripts so you could take any new object throw it in the scene and attach a script or two and customize all the behaviors then I think your on the right track.

You might have to do like a tutorial video for someone to know how to use your scripts to assign all the variables correctly for different behavior, but the point is that you can do everything you need without re-writing any code. All the things you need should be available as public variables for easy editing in Unity.

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

20 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

Related Questions

A simple quest system[solved] 0 Answers

Looking for advice about changing levels. 1 Answer

Decoupling with a path-finding algorithm 1 Answer

Unity architecture 3 Answers

Communicate between two separate modules 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