Giter Club home page Giter Club logo

Comments (3)

myko avatar myko commented on September 21, 2024

Even if you instantiate the Health assets and assign the references at runtime it's still more modular and decoupled than before. This is because the HealthBar component is depending not on a player or an enemy component, but on a FloatVariable/Reference. This means that the HealthBar component is reusable in any other project as long as you have a FloatVariable to reference. HealthBar has no idea that it's the health of a player, enemy etc.

from unite2017.

andrueandersoncs avatar andrueandersoncs commented on September 21, 2024

@prodigga is correct, you do end up having to make instantiated copies if you intend to reuse any of the scriptable objects you make. This pattern works as a replacement for static classes but not as a means by which to create a game.

While making a "model" or "data structure" for data you need to model DOES allow modularity, it is not significantly different than the model/view separation in MVC

from unite2017.

roboryantron avatar roboryantron commented on September 21, 2024

Player Health as a variable is not always the best solution for all game types. For multiplayer, it can be used for a handle to local player's health for use in UI. If you have local multiplayer with a reasonably finite max players (like 4) it could still be useful to have it in a variable, with each player pointing to a different one and each health bar doing the same.

In the case of enemies, that just isn't a place where I would use this since there often is not a centralized feedback system for a single active enemy. There are cases where it makes sense to use on enemies, though. We just shipped a one-on-one vr fighting game where the enemy health was in a variable. You can also picture certain game types that have special HP meters for a boss.

Games often have plenty of candidates for a variable of this sort of global nature. Time spent in a level, quality settings options, analytics data, difficulty setting, etc. HP works out for some games and not for others.

What it comes down to is that this is another tool at your disposal to solve problems. It is still up to the user to be smart about how and when to use it.

from unite2017.

Related Issues (11)

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.