Search Unity

UE4 vs Unity: Pseudo Gameplay Ability System in Unity?

Discussion in 'General Discussion' started by typicalturnip, Feb 7, 2020.

  1. typicalturnip

    typicalturnip

    Joined:
    Aug 10, 2018
    Posts:
    11
    Hello,

    I'm about to start on a new project, but I am at a loss regarding which engine to use.

    While I am not an expert, I have experience in both engines, and I was wondering if there is a similar system to UE4's GAS in Unity.

    One of the big perks of that framework, having worked with it (once it is set up), iteration and implementation of assets, abilities, and other gameplay events is really quick and efficient. I prefer to work in a pseudo modular way, with parent classes acting as a mold and then attaching different modules for behavior to the appropriate children. The Gameplay Ability system has been a nice complement to this workflow.

    For the scale of this game, I am dreading the time to create abilities and add characters/creatures while not being able to leverage the ability to recycle components as I normally do in UE4.

    Am I overthinking the amount of work this would be in Unity, and if possible, am I able to maintain this workflow?

    I guess I could effectively make a bunch of individual component scripts and have a few main ones that call those features, so I can drag and drop them in when needed.
     
  2. typicalturnip

    typicalturnip

    Joined:
    Aug 10, 2018
    Posts:
    11
    Forgot to add this to the first post, but I also heavily utilize excel spreadsheets to be pulling different data from. Can Unity do this?
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
    Only you can decide which engine is more appropriate for your project. If the feature doesn't exist in one of them then your development competency is the limiting factor and maybe you need specific built in features. If that's the case, just pick one and go for it.
     
    vakabaka, Deleted User and Ruberta like this.
  4. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982


    Ive used both engines extensively, Unity for years for my job, and unreal for years training for potential other jobs and now we are training in Unreal at my work.

    To answer your questions: Yes you can use excel, thats nothing to do with unity and more C#, almost anything C# can do unity can.

    On the GAS system, its actually really not that difficult to write your own. Your thinking about unity the wrong way if you dont think you will be able to quickly and efficiently reuse things, thats the core principle that unity is built on; if you use it correctly.

    You probably want to take a look at inheritence and make sure all your abilities inherit from a common base class, this will make it easier to extend, reuse or change behaviours in previous abilities.

    BaseAbility > FireAbility > FireBallAbility etc etc


    You can look into scriptable objects, they are great for authoring architecture like this. You probably also want to look at state machines as they are a nice way to handle transitioning to, updating, and transitioning from abilities (or anything else like animation, movement etc).


    The reason GAS does exist in unity is unlike unreal, unity isnt built around the concept of one or two types of games. Unreal is mainly for first and third person shooters, yes it can make other stuff but as you likely know from using the engine, it mostly excels at this and everything else makes you fight the engine. Unity is much more open, but you may have to write a little more stuff yourself to start with. Dont fret though, there is always some sort of asset or tutorial somewhere to speed up your work.

    If you look at the source code of GAS, its really nothing too complicated, and so you can use the UE4 GAS source to help you design your own GAS in unity.
     
  5. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    A big thing about the UE GAS is that it's designed for networked multiplayer, isn't it?

    So it's not really practical to build a Unity equivalent, as there's no standard way to do client-server MP in Unity.

    (Maybe in the future, in the land of DOTS, approaches to Unity MP may become more standardised?)
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    One should always pick the engine that does what they want, out of the box. If it doesn't then you better be a hobbyist, mad strange person or part of a well funded team.
     
  7. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    Well Unity has been missing its standard assets since 2017 so doing any kind of vehicle, character movement out of the box takes a bit of time! I guess the learn section has scattered starting points.
    Thread: https://forum.unity.com/threads/standard-assets-2018-let-us-know-what-you-think.516595
     
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    Everyone keeps saying these assets are broken. I created a new project in Unity 2019.3, loaded the standard asset pack from the link below, opened the Car scene, fixed two minor bugs (code was trying to use GUIText), and started driving it around. Every other scene worked flawlessly out of the box.

    https://assetstore.unity.com/packages/essentials/asset-packs/standard-assets-for-unity-2017-3-32351
     
    Last edited: Feb 7, 2020
  9. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    EBKAC
     
    pcg and Ryiah like this.
  10. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    Hah! Well I didn't try them recently myself, I had just been reading said thread. There are so many character controller and driving packages on the asset store I thought things must be more broken...

    They could rename it to "Standard Assets (for Unity 2017.3... but mostly works ever since)"
     
    Last edited: Feb 7, 2020
    aer0ace and Ryiah like this.
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    Around Unity 5 was the last time I did anything with the Standard Assets. From the way many beginner threads have been lately I was left with the impression everything was broken and useless but that's clearly not the case at all.
     
  12. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,639
    I imagine that Unity must have some other features that the OP needs if he is considering using Unity rather than Unreal. So the question is which engine has the smaller fit-GAP and how you cover it.
     
    Joe-Censored likes this.
  13. typicalturnip

    typicalturnip

    Joined:
    Aug 10, 2018
    Posts:
    11
    Thank you for the responses everyone.

    The main reason for wanting to go into Unity is mostly because I have yet to make a serious project in it. Figured we'd try something new. Most of my team is more comfortable designing in Unity than I am.

    After going over the documentation and other tutorials, I believe my concerns are mostly alleviated.

    The one thing I have yet to find, and I am probably missing the forest through the trees at this point, is how do I have scripts behave based on what other scripts are already attached to an object?

    My goal is to effectively tag which components are active on a given game object to add, modify, or subtract functionality that is held in Scriptable objects and other base scripts. As I type this out, this might be a mixture of prefabs and what the tag system is for--besides collisions.

    If I make a base object with a set of controllers and parameters that reference various scriptable objects, how can I modify its behavior to these controller scripts based on the "traits/scripts" said object currently posses?

    For example:

    1) NPC>Large Monster Template > Mountain Troll (Majority of mission critical stats and functionality at this point running on a scriptable object to keep everything in one place between multiple characters)

    2) Add a component to it that enables to player to talk to it. (The actual functionality of this is held elsewhere).

    3) Add Combat component that allows me to modify abilities, damage types, and combat functionality. This effectively flags it as attackable, and allows the attachment of abilities etc. (Again, these would all be driven elsewhere to keep everything centralized).

    4) Add component that declares the monster "Lootable". On death, this can drop whatever etc.

    This is more or less how I have been working in Unreal, leveraging GAS, to allow my designers the ability iterate quickly without having to jump into code or go hunting for stats or functionality that may belong on one actor, script, or another.

    This has also allowed us to keep resources down, as actors (objects) only have the functionality that they need associated with them on instantiation. It also speeds up implementation as you can quickly see what an actor (object) can do with a glance.
     
  14. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    You can acquire a reference to all the other scripts/monobehaviors attached to the object using GetComponent.
    You also can store references to them.
    you can add/destroy them. At runtime. And using drag and drop. And they can be enabled/disabled and work independently from each other.

    The use case you presented sounds, in context of unity, overly complicated, has little use for components, and good portion of it can be implemented through parameters, references, and data structures.
     
  15. typicalturnip

    typicalturnip

    Joined:
    Aug 10, 2018
    Posts:
    11
    After going over some of the scriptable objects tutorials and documentation, this has more or less been working out. The plugable AI tutorial and overthrowing monobehaviour got me onto the right track.
     
    MadeFromPolygons likes this.