Announcement

Collapse
No announcement yet.

RPG Horror System - For my game

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

    RPG Horror System - For my game

    Hello!
    I won't go into much detail about the game just now, as I'm still building the foundation for it, but I'll showcase what I've got so far.

    Inventory system

    Being a bloodfan of the early resident evil games, I wanted to make an inventory system that resembled its limits, and also taking in some inspiration from "The Last of Us" (mainly limiting the amount of each individual weapon type you can carry).
    My plan for the inventory design is a somewhat changing as I'm progressing, but the main style is there.


    InventoryDesign

    I - somewhat obviously - want it to look like the player is logging all his stuff in a book. Somewhat unrealistic in the way that it would take time to take pictures of his weapons and items and "tape" them into the book, but I like the idea of it.

    Inventory Management
    For all items and weapons in the inventory as well as the smaller parts of the UI that are always visible, I use a spritesheet to load just one texture into memory. The larger parts have their individual texture loaded.


    T_InventoryItemsSheet

    I use that colored grid overlay in photoshop to more easily lookup the column, row and spanning of both. For that purpose, I created a small utility class - "UTIL_TextureSheetManager". In this class I pass along a the amount of columns and rows as well as the size of the original texture that is in the game content.

    Code:
    UTIL_TextureSheetManager(int32 columns, int32 rows, const FVector2D &sourceSize)
    {
    	_columnCount = columns;
    	_rowCount = rows;
    	this->sourceSize = sourceSize;
    
    	UpdateScales();
    }
    
    ...
    
    /*
            Columns and rows are zero indexed. Thus the first row and column in the texture is 0
    
            @param int32 column - The column number to get coordinate for.
    	@param int32 columnSpan - The number of columns the column should span across (i.e: a icon that uses more space horizontally)
    	@param int32 row - The row number to get coordinate for
    	@param int32 rowSpan - The number of rows the column should span across (i.e: an icon that uses more space vertically than 1 column)
    	@return FTextureUV - A struct with the calculated UV coordinates
    */
    const FTextureUV GetCoordinates(int32 column, int32 columnSpan, int32 row, int32 rowSpan)
    {
    	FTextureUV uvData;
    
    	uvData.U = _singleColScale * column;
    	uvData.V = _singleRowScale * row;
    	uvData.UWidth = _singleColScale * columnSpan;
    	uvData.VHeight = _singleRowScale * rowSpan;
    
    	return uvData;
    }
    
    ...
    
    /*
    	Updates the scale that represents a single row and column in UV space
    */
    void UpdateScales()
    {
    	_singleColScale = (sourceSize.X / _columnCount) / sourceSize.X;
    	_singleRowScale = (sourceSize.Y / _rowCount) / sourceSize.Y;
    }
    These are the main important functions of that class for calculating and retrieving the UV coordinates for a column/row in the spritesheet.
    In the HUD, I use it like this:

    Code:
    void ARpgHUD::DrawEmptySlot(float x, float y)
    {
    	FTextureUV uvData = TSM.GetCoordinates(2, 2, 0, 1);	// Lookup colum/row combo in spritesheet
    	DrawTexture(InventoryItemsSheet,
    		x,
    		y,
    		SlotBgWidth,
    		SingleSlotHeight,
    		uvData.U, uvData.V, uvData.UWidth, uvData.VHeight);
    }
    Items

    Items are all part of a base class, and they store their unique information in a struct (FInventoryItemInfo), so I can easily just store that struct data in the actual inventory array. From that info, the game object can easily be spawned back in to the world. I designed it so that I instantiate the base class in Blueprint, and set the info structure there. I find it less tedious than creating all different items through c++.

    In that info structure, there is also a sub-structure for defining where this items' sprite is located in the sheet (also set in blueprint).
    So a call to draw that sprite on the HUD is quite simple:

    Code:
    void ARpgHUD::DrawItemSlot(float x, float y, const FInventoryItemInfo itemInfo)
    {
    	FTextureUV uvData = TSM.GetCoordinates(itemInfo.TextureSheetAttributes);	// Lookup colum/row combo in spritesheet
    	DrawTexture(InventoryItemsSheet,
    		x,
    		y,
    		SingleSlotWidth,
    		SingleSlotHeight,
    		iconUvs.U, iconUvs.V, iconUvs.UWidth, iconUvs.VHeight);
    }
    Creating new unique items and weapons in blueprint is also a trivial thing. All item settings like quantity, capacity in stacking, sprite sheet col/row, displayname, description etc. is set there. The "OnPickup", "OnUse", "OnEquip" etc events are also implementable there, so each item made in blueprint can easily do different things when used, and the like.

    Camera system

    To be honest, I also love the good ol' camera system from the first resident evil games. I made a system like that, with a few extra possibilities like making the camera follow the player (static position, but dynamic rotation).
    I have not quite decided yet though... I'm also a fan of regular 3rd person view.

    The input for moving the player is relative to the camera position/rotation so it does not feel weird when moving him around. Right is right, up is up, etc. This has caused some problems when transitioning to a camera that is completely different than the previous one. I have to take in to account the button that is being held to move him, after the transition, and not change the relative movement before it has been released. I vaguely remember that that was the case in Resident Evil, i.e.

    -----------

    Here is a video I recorded to demonstrate camera system, current state of the inventory UI and the functionality of the items and weapons creation.
    I found a few silly bugs when I recorded, so bear with me



    I'll post more progress as I go. I'd also welcome feedback and suggestions.

    Regards,
    Oyvind

    #2
    Love that note book. It looks fantastic.

    Comment


      #3
      Really awesome idea, the notebook is the perfect touch!

      Comment


        #4
        Awesome Work Oyvind! You're bringing back Resident Evil!!!
        Twitter - EyeOfScar

        E-Mail

        Comment


          #5
          Thank you for the feedback. The design at the top is in photoshop. Trying my best to get it all in to the hud, but the math and percentages behind the layout in the HUD is a bit more "square" and linear. After I get all the proper functionality in, I'll start touching it up with more dynamic and "random" like in the design. I've gotten much done tonight, including support for all the menu items, with proper callback to the respective items. They can now be used (calls the items OnUse) and discarded. All callbacks are tied in.

          Next up now is the equip (tied in, but needs the actual logic) and the combination system. Looking forward to that!

          Best regards,
          Oyvind

          Comment


            #6
            Any chance of you releasing that inventory system as a plugin on the marketplace? I would definitely buy it if I could.

            Comment


              #7
              After it is done, cleaned up and quality tested I'm pretty certain that I would, yes.

              Thanks for the interest!

              Comment


                #8
                Well when it's out, I will buy it!

                Comment


                  #9
                  Notebook skin looks so cool! Great style
                  Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                  Comment


                    #10
                    ghost55: Good to hear! hehe

                    Thank you Tom Looman. Much appreciated.

                    I'm currently re-structuring the HUD code, as I made the HUD while I was learning how it worked. Now that I know exactly how all things are tied together, I'm creating a lightweight UI framework to manage all draw/update logic and loading/unloading assets such as fonts, textures etc. The initial version of the HUD got quite messy and hard to maintain, although I cleaned it up as much as I could.

                    So I put the inventory functionality on hold until the UI framework is finished. Won't be long, as it is pretty basic.
                    The concept behind it works much like any UI framework: UIElements that hold other ui-elements. The top parent is the HUD in this case, so when the hud is destroyed, all ui elements is destroyed from last child to top-most.

                    This also gives me great control over positioning and sizing, as each parent element defines where its position is, and what size it has. Positioning and sizing children will all then be relative.

                    Anyway, I'll post some screenshots when it's done

                    Regards,
                    Oyvind

                    Comment


                      #11
                      Howdy Oyand,

                      Fantastic work so far on you Horror System! That notebook looks awesome. Be sure to keep us updated as you progress along in the development of your project!

                      Have a great day!

                      Comment


                        #12
                        Gonna have to keep my eye on this one . Great work so far - Keep it up!

                        On a side note, I myself am currently working on my inventory system for a Horror game using Resident Evil as inspiration. I loved the way that you had to actually take item space into consideration before moving on. I haven't been able to pull off grid spaces yet, and I am still honestly trying to wrap my head around the best way to do it. So as I work around I made all items have weights, and to prevent the player from stock piling weapons and ammo.

                        But I like your system a lot more xD. Its cleaner and it fits nicely. If you end up putting it on the marketplace consider me a customer!
                        Last edited by Arixsus; 09-18-2014, 04:06 PM. Reason: I suck at grammer.
                        Current Project - *shush shush* Ehh.. When its ready?

                        Comment


                          #13
                          @Sean Gribbin: Thank you. I most certainly will

                          @Arixsus: Well, designing and planning the inventory system beforehand is key tbh. For your game, you should plan on what limitations the system should have, what type of inventory system you'd like:
                          1. realistic, 2. semi-realistic, 3. unrealistic. Somewhat vague, but think about the game you are making. If it is much like Diablo, or some MMO, you might need a few slots available to enjoy the game. But if it is more like a survival simulation game, you'd want to keep it realistic in terms of how much an actual human being can carry. Final Fantasy is an awesome game. If that game hade "realistic" inventory system, it would suck, and indeed be unplayable. So, figure out what you need, and what the player needs

                          For my game, he needs to survive, and only carry the amount of weapons that can actually be attached to someone. The rest (non-weapon items) fits in a backpack. Google "designing a game inventory system". You will probably come up with a lot of helpful stuff
                          Thanks for the reply!

                          ---------

                          Anyway, I have already enjoyed the spoils of a more organized and planned UI framework for the HUD. I implemented a generic way of transitioning elements, and applied it to the main UI element (the actual notebook).
                          The transition effect manipulates the position and size of the UI element, which in turn will affect all child ui elements of that element (which later will be the weapon/item slots and text).

                          Here is how it looks so far:



                          Regards,
                          Oyvind
                          Last edited by Oyand; 09-18-2014, 10:06 PM.

                          Comment


                            #14
                            @Oyand I agree. I've pre-planned the inventory for every bit of the games mechanics. Things like equipping, un-equipping and reloading all rely on inventory allotment spaces. Which not only includes the backpack, but the actual players paper doll (equipment load out like you would see in an RPG).

                            For example even if the weapon is equipped to the player in the paper doll it still has to occupy a slot/slots in the inventory (as of right now its weight, until I sort out how to best build a grid inventory system). Reloading requires the player to actually have magazines equipped into the magazine pouch and magazines themselves are actual inventory items and must be combined with ammo boxes to be filled.

                            In the reload system mechanics it has 2 effects, one being if the player holds down the reload button they actually will reload pull a magazine out of a pouch, and place the other in that pouch, holding onto the magazine. But if they only press R, it will reload faster because it drops the magazine to the floor and simply puts the new one in the weapon. This then forces the player to reconsider the current fight and how to best reload because if they drop the magazine and pick it back up, it will go to the inventory first. The extra mechanic to this reload is that if there are 0 magazines in the pouch and they have to pull directly from the backpack at a penalty to reload speed.

                            I mean sure these mechanics are tedious, but its meant to be that way. I am over just running into a room guns blazing not having to take inventory into account and how prepared I actually am for a fire fight. So basically, I took the core of Resident Evil and said lets take it up a notch I guess lol.

                            I hope this makes some sense? If not I will re-clarify when I am home and not at work. xD



                            Anyway looking good man. I love the transition from game to inventory cant wait to see it in further action
                            Last edited by Arixsus; 09-18-2014, 11:09 PM.
                            Current Project - *shush shush* Ehh.. When its ready?

                            Comment


                              #15
                              I see, I think it sounds like an interesting system indeed If you have some questions or would like some feedback/tips you should definitely start a thread and get it going there Good luck!

                              -----

                              Coming along with an update shor

                              Comment

                              Working...
                              X