Announcement

Collapse
No announcement yet.

Inventory System - C++ Plugin - UMG - Networked

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Inventory System - C++ Plugin - UMG - Networked

    First, you can get it here:

    https://github.com/iniside/GameInventorySystemPlugin

    And it will work with 4.6 version. As the plugin is not finished yet, it will always work with newest version of engine available (including preview builds). Once I get it to the state it's done, I will branch it to match current engine version, but new features in case there will be ones, won't be backported to older versions.


    Update:
    If you want try it out you can also download presetup version here:

    https://github.com/iniside/ActionRPGGame

    It should work against binary launcher build. It will work 100% against latest 4.6 source.

    I recommend using git and cloning it directly.

    You will also need some content. If you have existing project, with starter content, you can copy everything except blueprints.

    Also you will need to export SampleTags to csv file, and reimport it again. Since it's not automatically loaded upon engine start, and it will prevent inventory from working properly.

    New Video:


    New Video:


    Tested on 4.6 from github. It will NOT work on older releases. And I will NOT make it work on older releases.

    What is different about my plugin, from any other inventory system that lays around forums ?
    Despite name, it's not really inventory. Using this plugin, you can create action bars, character dolls (well this one, I'm not sure exactly, but it's something I want plugin to be able to handle) and of course inventories (;. Essentially anything, which need to contain some data and interact with it can be implemented using this plugin as base.

    The base of working are Tabs. You can think of tab as single bag or action bar. You can have multiple tabs, and each tab can have multiple slots to store items. Each slot can store single item.

    The next part is class GISItemData, it's base object type, which is used to store data in inventory. If you want to store your custom data, you need to create new class derived from this object, and define custom properties, you want to store.

    Then there GISInventoryBaseComponent, which is base component class to allow any actor, to make use of inventory. Probabaly best place to add is PlayerController.
    You can have multiple inventory components on your actor. And you can drag items between components. This is currently working on base level, but it's not yet finished.

    At last there are custom C++ widget classes. They implement basic interactions on client side. They do not display anything. If you want to display your inventory, you need to create your own widgets, which will derive, from these base widget classes. How you display your data is entirely up to you. You can create grid/bag based inventory or full screen list. Sample on github provide simple inventory as grid, which locked to top left corner screen.


    GISContainerBaseWidget - base widget which contain inventory widgets. You can think of it as place where tabs will be added. Though of course this class does not specific how they will be displayed. It also takes care of client side interactions, like swapping item positions.

    GISTabBaseWidget - base widget, for tabs. It's not terribly complicated it have two properties .

    GISSlotBaseWidget - base widget for slots. Slots contain item widgets, and some info about item.

    GISItemBaseWidget - widget which will actually display info about our item, like icons, description etc. It's also used as drag&drop payload, but unless you are planning to modify sources, you don't need to care about it.


    Networking. Replication of inventory objects is set up. I have not tested how well it works though. But replication is critical part of this plugin and I will make sure it will work .

    Plugin does not support any kind of saving data anywhere. It's way to game specific, how and where you want to store your data.

    Not yet implemented features:
    1. Picking up items from ground. I do not know yet, how to make in manner which can be easily extended and fits nicely into generic nature of plugin.
    2. There is no dropping items to ground from inventory. It just wasn't important enough to tackle it yet (;.
    3. Inventory only accept items of certain class. Not yet done, but very important!
    4. Accepting items only from specified inventory component. Don't know how to tackle it. But I want to add it.
    5. Adding new tabs at runtime. (adding slots is out of question for now).
    6. There is no way to get information about item. Like Icon, Description, etc. Since GISItemData doesn't have appropriate functions to override yet. It's absolutely going to be done. Though, because it's fairly generic don't expect anything specific.
    There probabaly won't be much beyond
    GetIcon()
    GetDescription()
    GetName()
    and Possibly GetType() as FName, FString, or maybe something else.

    Things that will change for sure:
    1. How you add items now is not safe in client-server environment. It will change. I just left it like that, because it's easier to test this way.

    For now best way to handle this plugin is to add new things trough C++, except display logic. You can do it just as easily with UMG.

    some screenshots:


    Component configuration. Drop Slot Name is slot to which Item Widgets will be droped. Currently it must be Overlay slot, added to widget derived from GISSlotBaseWidget. The name must match exactly the name of slot in your widget blueprint. Also slot should be exposed as variable.


    Here is sample setup I use to debug widget




    Actual inventory displayed. Single tab with 30 slots.Sorry for no art at all, but it wasn't really important to me at this point (;.
    Last edited by iniside; 12-17-2014, 02:48 PM.
    https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

    #2
    Very cool, so far that seems to be the best way to mix/match C++ and UMG. With a C++ programmer defining base classes extending from UUserWidget and then reparenting the WidgetBlueprint so that the designer has freedom and the C++ programmer has an interface they can control. Nicely done

    Comment


      #3
      Thanks Nick!

      Yeah I totally agree about it When I first prototyped it, by doing all UI in blueprint, there was just so many things, to take care of, that I doubt anyone who just want to get to display something would have patience to setup it properly .

      Updates for today:
      1. I added GameplayTags support for Inventory. You can now specify tags, for different components, to control how they will interact with each other. You can setup it to move items only within single component, move items between only specific componenets, or even move items only in one direction!

      2. Fixed some bugs, which actually prevents moving items between components in first place (;.

      Also video:
      https://www.youtube.com/watch?v=8yrGzB3Fa3Y
      https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

      Comment


        #4
        Pushed networking support to github. Replication and inventory in multiplayer should work now.

        Also added looting from level, but it doesn't work in multiplayer yet, so no video today for two reasons:
        1. I haven't had time to do it.
        2. Without proper looting in multiplayer there is not much new to show. It's just the same as last video, the only difference is, you do it now with client and dedicated server (;.
        https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

        Comment


          #5
          Update:
          If you want try it out you can also download presetup version here:

          https://github.com/iniside/ActionRPGGame

          It should work against binary launcher build. It will work 100% against latest 4.6 source.

          I recommend using git and cloning it directly.

          You will also need some content. If you have existing project, with starter content, you can copy everything except blueprints.

          Also you will need to export SampleTags to csv file, and reimport it again. Since it's not automatically loaded upon engine start, and it will prevent inventory from working properly.
          https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

          Comment


            #6
            New video:



            Shows item looting in multiplayer.
            https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

            Comment

            Working...
            X