Announcement

Collapse
No announcement yet.

Play a movie file while loading a level in C++ [UE 4.24.3]

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

    Play a movie file while loading a level in C++ [UE 4.24.3]

    I would like to play a movie file while loading a level. I have followed this tutorial (https://wiki.unrealengine.com/Loading_Screen) but the thing is, being more a designer rather than a programmer I have not succeeded in the making of such a system. I understand that Unreal Engine is made out of modules but in the tutorial there are some missing explanations, like where do you put some part of the code and other implied stuff that programmer must know better than me.

    If someone could guide me a little just to be able to understand how to achieve the result that I want, it would be much appreciated.

    #2
    I'm pretty new myself, and not in front of my computer but... This should get you pointed in the right direction.

    "If you don't already have one, you need to create your own overridden version of the 'UGameInstance' class."

    I think you need to right click in your C++ folder in Ue4, and click create C++ class. You should choose type UGameInstance.


    After the C++ class is made, open it in Visual Studio. It should open YourUGameInstance.cpp and YourUGameInstance.h

    These files are where the code goes.

    Comment


      #3
      The Action RPG project has a functional loading screen, but the loading screens do not work unless you play the game as a standalone. The video explaining the asynchronous loading screens does go through all the necessary steps, rather quickly, but taking in some of the snapshots should give you an idea how it has been built. The very same code recides within the build!

      I would first suggest making your own module, which does not need to be more than the bare minimum; an empty module you can implement C++ classes to. If one tutorial does not work out for you, try to fill in the gaps with another. Just do it on a fresh project so you can iterate quickly until you understand how to implement a module. While use of modules is not necessary for loading screens, it is still very useful concept to be aware of, and it is what the Action RPG project uses.

      After you're done with that, you may want to take a look at the blueprint nodes made in the Action RPG project that trigger the loading screen. Following along the nodes into their C++ implementations, and from there on out all the way to the top, should give you an idea of how the relationships between different parts of the engine work at that point.

      Then you can pretty much start porting the ARPG loading screen to your own project.

      Comment


        #4
        I would first suggest making your own module, which does not need to be more than the bare minimum; an empty module you can implement C++ classes to.
        What is exactly a module? What is it made of? Is it a ".cpp" or ".h" file? How do you start implementing one? By the way, thanks for your help. This is much appreciated.

        Comment


          #5
          4.24 has the loading screen module built in, Go to Edit -> Plugins and select Loading Screen Module.
          Game Programmer - Working for a Indie Studio.

          Visit my blog: TheGamesDev

          InterKaos Games

          PC Specs:

          Comment


            #6
            Originally posted by VDimension View Post

            What is exactly a module? What is it made of? Is it a ".cpp" or ".h" file? How do you start implementing one? By the way, thanks for your help. This is much appreciated.
            https://docs.unrealengine.com/en-US/...les/index.html

            Module is a way to encapsulate functionality. So say you have a chunk of code that integrates Leap Motion or lets you show adds on iOS. A project that needs that functionality implements the module. Projects that don't, omit the modules. Plugins could be thought of as modules where the installation process has been automated. But yeah like Kaos is saying, loading screen movie player has been implemented as "Pre-Load Screen Movie Player".

            Modules have a C# file for the build configuration, and .cpp / .h files for the data itself.

            There are tutorials for implementing modules, like this one.

            Comment


              #7
              The "preLoadScreenMoviePlayer" plugin that is in the engine does not seem to work. Or where is the user interface supposed to appear? How am I supposed to use it?

              Also, I would like to know where I should put this snippet of code that is shown in the wiki tutorial:

              Code:
              /** Struct of all the attributes a loading screen will have. */
              struct MOVIEPLAYER_API FLoadingScreenAttributes
              {
                  FLoadingScreenAttributes()
                      : MinimumLoadingScreenDisplayTime(-1.0f)
                      , bAutoCompleteWhenLoadingCompletes(true)
                      , bMoviesAreSkippable(true)
                      , bWaitForManualStop(false) {}
              
                  /** The widget to be displayed on top of the movie or simply standalone if there is no movie. */
                  TSharedPtr<class SWidget> WidgetLoadingScreen;
              
                  /** The movie paths local to the game's Content/Movies/ directory we will play. */
                  TArray<FString> MoviePaths;
              
                  /** The minimum time that a loading screen should be opened for. */
                  float MinimumLoadingScreenDisplayTime;
              
                  /** If true, the loading screen will disappear as soon as all movies are played and loading is done. */
                  bool bAutoCompleteWhenLoadingCompletes;
              
                  /** If true, movies can be skipped by clicking the loading screen as long as loading is done. */
                  bool bMoviesAreSkippable;
              
                  /** If true, movie playback continues until Stop is called. */
                  bool bWaitForManualStop;
              
                  /** True if there is either a standalone widget or any movie paths or both. */
                  bool IsValid() const;
              
                  /** Creates a simple test loading screen widget. */
                  static TSharedRef<class SWidget> NewTestLoadingScreenWidget();
              };

              Comment


                #8
                I finally found the answers to my issue by asking my question on "Unreal Slackers" discord server.

                So to summarize, I had to download the loading screen plugin at this page:

                https://github.com/ue4plugins/LoadingScreen

                Then I modified some source files in it by following the pull request instructions made by someone else at this link:

                https://github.com/ue4plugins/Loadin...17cc23b17ce4d4

                Finally, I put the modified plugin's folder inside the "MyProject/Plugins" directory and it worked. I have been able to find the plugin section in the "Project settings" under the "GAME" section.

                You may have to rebuild the project once the plugin is added to your project before launching the editor.

                Comment

                Working...
                X