Search Unity

Unity Getting Started with Game Foundation Preview

Discussion in 'Game Foundation' started by mingz-unity, Sep 23, 2019.

  1. mingz-unity

    mingz-unity

    Unity Technologies

    Joined:
    Oct 12, 2017
    Posts:
    10
    What is Game Foundation

    Game Foundation provides you with pre-built common game systems (such as inventory, currency, stats) that are flexible and fully extensible, so that developers can focus more on building the unique gameplay instead of reinventing wheels on the most common / essential systems.


    Installing the Preview Package

    Game Foundation Preview is released as a preview package in Package Manager. Minimum required Unity version for the package is 2018.3.

    Please refer to the Installing pre-requisites guide for a step by side guide on how to install it.

    We currently support these Build Target platforms: iOS, Android, Mac, Windows


    Game Foundation Developer Guides

    Game Foundation Concepts
    • Definitions and explanations of various specific terms used in Game Foundation
    QuickStart tutorial
    • Overview of the basic steps to get up and running with Game Foundation
    API Reference
    • Detailed Scripting API reference documentation for Game Foundation
    Editor UI
    • Overview of the various editor user interface to create and manage definitions
    Overview of Game Systems
    • Overview of the inventory, wallet, and stats system currently available in the preview
    Known Issues and Limitations
    • A summary of known issues and limitations in the current release
     
    Last edited: Sep 24, 2019
    Lurking-Ninja likes this.
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    4,531
    Yay! QQ: when the announcement was made it was told that it will be a mobile package. I took a quick look (without downloading, because I can't do that right now) and I haven't found any reference to any hard mobile prerequisite. Does this mean that the GF will be a general purpose package for any kind of application rather than only for mobiles?
    I'll play around with this a bit later.
     
  3. JayR

    JayR

    Unity Technologies

    Joined:
    Aug 2, 2016
    Posts:
    80
    Game Foundation is not inherently limited to mobile and should also be fine on desktop platforms. There may be limitations on some features on more-restrictive platforms (WebGL and consoles.)
     
    Lurking-Ninja likes this.
  4. MadanyNO

    MadanyNO

    Joined:
    Apr 18, 2016
    Posts:
    5
    i was wondering if i make a custom Detail Definition, can i require that it will need another Detail on the item? like u do with some components?
    like i make Equipment Definition and i want it to require the stat definition. is there a way to go about that? dont think i saw one in the ducs

    edit: if there is explantion on what needed to be done to add new Detail Definition it could be helpfull too since my new Detail Definition doesnt show up to be add on the Game item details
     
    Last edited: Oct 10, 2019
  5. mingz-unity

    mingz-unity

    Unity Technologies

    Joined:
    Oct 12, 2017
    Posts:
    10
    Thanks for reaching out @MadanyNO. Some very good questions here.

    Custom Detail: it's not entirely impossible to do, but quite difficult since we haven't well documented the API interface for you to create your custom details. We do have plan to better support this option for developers in the near future, including better documentation / explanation that you mentioned, so stay tuned.

    Also in the meanwhile, if you can share with us your use case / what you want to do with the Custom Details, it could also help us take that into consideration when designing it.

    For your question on required Detail: yes that's something we're currently looking into as well. We haven't made final plans yet on how that can be supported, but we do understand it can be useful sometime.
     
  6. MadanyNO

    MadanyNO

    Joined:
    Apr 18, 2016
    Posts:
    5
    tnx for answering me @mingz-unity i really see a lot of potential in GF as some one that tried to self create system like that for myself.

    about what i am trying to do is something like this:

    create a detail definition for Equipment, which would hold the type of it and the rarity of it. at list for now.
    and i want it to require the Stat detail so i can give bonus stats when equipped.

    For example i will create a game item, name it "One Handed Sword" and add the Equipment Detail to it.
    in the detail i will give it the type "One-Handed Weapon" and the rarity of "Common".
    And because i put the stat detail as required, it would add the stat detail or worn me i need to add it myself.

    i kind of expect the code for the Equipment detail i described to be something like this:

    Code (CSharp):
    1. [RequireDetail(typeof(StatDetailDefinition))]
    2. public class EquipmentDetailDefinition : BaseDetailDefinition
    3. {
    4.  
    5.     public EquipmentType type;
    6.     public RarityType rarity;
    7.    
    8.     public override string DisplayName()
    9.     {
    10.         return "Equipment Detail";
    11.     }
    12. }
    to use the RequireDetail just like i use RequireComponent r RequireComponentData.

    Also, i created a class like that(without the RequireDetail) in my project, but when i try to Add the detail, i only see the details that come with the package.
    Is there a need to do something more when creating new Detail? Because i watched the presentation about GF in Youtube from Unity Copenhagen and it seems like a thing i should be able to do.
     
  7. mingz-unity

    mingz-unity

    Unity Technologies

    Joined:
    Oct 12, 2017
    Posts:
    10
    Thanks for the additional information @MadanyNO. The scenario you described makes a lot of sense.

    Indeed it requires more steps than just that to get your Custom Details supported right now, but better support will be provided in the near future so that developers can be relatively easy to add their own Custom Detail.

    One additional follow-up question from the user story you provided above. I noticed you're using 'type' as an attribute in your Custom Detail to model the different types of Equipment. Is there any particular reason you prefer to do it this way, than say using the Definition on the left side (e.g. creating a new definition for each type of equipments, assuming if you can also use Inheritance to link to the base Equipment)?

    We try to provide a flexible system so there's no 'wrong' way to do it, but currently we do see more cases where developers would use Definition for that purpose, while using Detail for holding specific attribute for a concept.
     
  8. MadanyNO

    MadanyNO

    Joined:
    Apr 18, 2016
    Posts:
    5
    not sure i got how you suggested to handle the equipment type...
    did u mean to make a game item of one hand sword, and then when i want to create a new sword i create a new inventory item to inherited detail from my one hand sword, then it simple, i didnt think about that XD
    i did see the why u did the sword item in the tutorial, but i guess it didnt strike me as what i was looking to do

    and the EquipmentType is more of an enum, to use as a label, and in my opinion it is easier to create the equipment like that. Because say i made an sword item with all the stats, info, and now i think that this equipment is more of a lance then a sword so i want to change it to lance, so i only need to change the label, and its a lance, and i wont need to change the inherited from sword to lance.
    so my equipment detail is more of something i would like to have each item to itself and not something he inherited.
    at list that what i was going for.

    i am mainly playing around with GF to test it and see how i feel with it compered to the old made up system i created for myself a year ago as a project for my degree ^^" my system worked but it had lots cons.... i guess i still think on creating items as i created in my system ^^"
    now that i think about that, i can even use the category as a label instead of my equipment type.

    on another note, i was wondering about something:

    can i use the categories i created to sort or get only specif items in my inventory that belong to specific category?
    for example if i have a tab window in my in-game inventory that i want to present only potion that were categorized as "potion" items, can i use the categories to get only the items that categorized as "potion"?
     
  9. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    314
    Hi @MadanyNO,

    Thanks for trying out Game Foundation and sharing with us your use cases!

    As far as your question about looking up groups of items based on their category, yes, that is a thing you can do! It looks like a bug in our documentation that it's not showing up in the scripting reference, but here is a list of method signatures that you can call from Inventories:
    - public InventoryItem[] GetItemsByCategory(string categoryId)
    - public void GetItemsByCategory(string categoryId, List<InventoryItem> items)
    - public InventoryItem[] GetItemsByCategory(int categoryHash)
    - public void GetItemsByCategory(int categoryHash, List<InventoryItem> items)
    - public InventoryItem[] GetItemsByCategory(CategoryDefinition category)
    - public void GetItemsByCategory(CategoryDefinition category, List<InventoryItem> items)

    For the one's that return void, they will add the list of items that fit the category into the List<InventoryItem> that you pass in.

    And just as an added note of clarification, I saw you mentioned further up about creating custom details because you saw it in the presentation from Unite, I just wanted to call out that parts of that presentation was a demonstration of plans we have for the future of Game Foundation, so certain things, like the custom details, aren't supported yet, but we plan to in the future.

    Hope that helps!
     
    mingz-unity likes this.
  10. MadanyNO

    MadanyNO

    Joined:
    Apr 18, 2016
    Posts:
    5
    Hi @erika_d

    Tnx for the list of method!
    and about the custom details tnx for clearing up that it isnt yet supported, i will wait for the update with those.

    tnx for answering my question till now, i will keep playing with Game Foundation to test it and wait for update on custom details for more use cases :)
     
    erika_d likes this.