Announcement

Collapse
No announcement yet.

The Penalty of GameInstance

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

    The Penalty of GameInstance

    Let me start by saying I appreciate that Epic shares their Engine with us openly. It does have some very nice features. Now unless I'm doing something wrong, GameInstance isn't one of them.

    There is a nefarious penalty for C++ and GameInstance projects that I've come across. I have a sizeable project consisting of a Menu, and nine levels. Whenever I try to migrate a single level, just about every thing is migrated. Try to build (package) a particular level, again, every thing is included. At the time I started working on LongshotHero I contemplated about keeping each level in its own uproject but thought that would be counterproductive and too much maintenance would be duplicated, error prone, etc.

    Packaging takes a long time processing assets that weren't supposed to be included anyway. And for Android, failing due to exceeding the 2GB size limit. Sadly it took well over an hour to get to that message.

    At this point I'm compelled to manually migrate my levels out into individual projects, and try referencing the source from a centralized location. I'm wondering if I can reference shared assets from a central location too?

    I'll add more results later. . .
    Last edited by Jerry.Richards; 06-23-2018, 03:21 PM.

    #2
    What does GameInstance have to do with the rest of your post?

    Comment


      #3
      I'm using GameInstance to hold game wide settings, items that are shared between the levels.

      Comment


        #4
        Having an Android game exceed 2GB falls squarely onto the "user error" realm of issues. This has nothing to do with the GameInstance.


        Originally posted by Jerry.Richards View Post
        I'm using GameInstance to hold game wide settings, items that are shared between the levels.
        And that makes you exceed the project size... how?

        Comment


          #5
          DamirH, except that I listed only two levels in the "List of maps to include in a packaged build". Unfortunately other levels were being processed too. Is that what you define as a "user error"?

          Comment


            #6
            Originally posted by Jerry.Richards View Post
            DamirH, except that I listed only two levels in the "List of maps to include in a packaged build". Unfortunately other levels were being processed too. Is that what you define as a "user error"?
            Yes I would because in the years of using the engine that feature worked flawlessly for me and pretty much everyone else. Considering it is a mandatory and widespread feature any actual bug with it would be obvious to a large amount of people. What is most likely happening is that your other maps are being referenced by the maps that you are cooking so they're being picked up as dependencies. That is a user error.

            And disregarding all of that, it still has nothing to do with GameInstance.

            Comment


              #7
              No, you're wrong on all accounts. Prove it otherwise.

              Why would the Android packaging be processing assets that aren't being referenced. I think I know why though. At this point though I'm not sure it is affecting the final output.

              Comment


                #8
                Yeah, packaging likes to gather unnecessary data.
                BTW, I always thought "List of maps to include in a packaged build" is there for adding maps not asset referenced anywhere, isn't it? Needed when your code loads maps by name?

                Still...
                - Dividing a single project into several projects... it's just some insane voodoo magic, man...
                - Did you check compression settings of textures and sounds? Maybe simply decreasing cooked size of such assets would be enough?
                - Isn't possible to quickly remove unused content? 2GB is huge package for Android already. Nobody likes removing junk, but it always a good practice.

                You know, I have to ask. Did you went through all the options of reducing size of pakaged game?
                https://docs.unrealengine.com/en-us/...ingPackageSize

                If nothing helps, we need better description of your project. "Sizeable project consisting of a Menu, and nine levels" is an incrediby modest description.
                Last edited by Moth Doctor; 06-23-2018, 04:32 PM.

                Comment


                  #9
                  Thank you Cheshire Dev

                  I'll go through that list again. My primary focus had been trying to migrate levels a few days ago but had no luck. Recently started working with the Android side of things so I haven't been as diligent with the information there. I did see the page you linked and I did follow the steps. I'll double check the settings.

                  I just made a change to my GameInstance class, removing a couple of button images I wasn't using anymore, went back to the blueprint to review the changes, and it was completely blank. I had to re-enter my settings, which are links to other assets in the game. Not a big deal though because there aren't that many items I'm keeping a link to. Anyway, using 4.19.2 the Windows 64 build for the Menu and one level was 349MB. That's the first I've seen such a small build.

                  My first Android shipping build without the Shared Materials and Library was 204MB. With shared enabled it is 193MB.

                  Comment


                    #10
                    Originally posted by Jerry.Richards View Post
                    No, you're wrong on all accounts. Prove it otherwise.
                    I can vouch for packaging process being good at including things you don't mean to reference and excluding those you do.

                    Most of our game modes and inventory is loaded on demand, with very few things actually referenced anywhere besides a few default items.
                    We have to specifically tell engine to include the directories containing these assets otherwise they are left out.

                    On the flip side, assets inside the /Developers directory - which should not have been included - were referenced by the AI behaviour tree, so the packaging system made sure to include them.
                    Meanwhile, test maps under /Developers are excluded, since nothing references them.

                    Check your references and settings.
                    Trying running the resave packages command to cleanup any old references that may be in there unintentionally.
                    Code:
                    UE4Editor.exe" "%PROJECT_DIR%\%PROJECT_FILE%" -run=ResavePackages -VERIFY -IgnoreChangelist -AutoCheckOut -AutoCheckIn -SKIPFAILS -PROJECTONLY -SkipDeveloperFolders -log
                    None of this has any direct relation to the game instance class though, unless that is where you are storing a lot of your references.
                    If your gameinstance has turned into some sort of catch all behemoth, you may want to reconsider where and how you handle your menus and map changes.

                    For example, we have full a robust character and item editor, a bunch of maps, game modes etc.
                    Our game instance class is ~200 lines in length and the only thing it references is a loading screen widget when non-seamlessly traveling between maps.
                    Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

                    Comment

                    Working...
                    X