Announcement

Collapse
No announcement yet.

Level streaming with different controllers

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

    Level streaming with different controllers


    Hi,
    I'm using the level streaming system to display a loading screen in between the loading of my levels.
    However, I can't find a way to use different controllers for different levels while keeping the streaming system,
    the controller stay loaded in between levels, and the level's gamemode override don't do anything, only the persistent level does.

    I understand why it's working this way and I get that it makes sense if you look at how the streaming system works,
    but it is really unpractical and lead to messy code to have the same controller for ingame logic and main menu logic.

    Is there a specific way you are supposed to handle this issue that I am not aware of ?




    #2
    Originally posted by Octadecagon View Post
    Hi,
    I'm using the level streaming system to display a loading screen in between the loading of my levels.
    However, I can't find a way to use different controllers for different levels while keeping the streaming system,
    the controller stay loaded in between levels, and the level's gamemode override don't do anything, only the persistent level does.

    I understand why it's working this way and I get that it makes sense if you look at how the streaming system works,
    but it is really unpractical and lead to messy code to have the same controller for ingame logic and main menu logic.

    Is there a specific way you are supposed to handle this issue that I am not aware of ?


    I was rummaging around and saw:

    Click image for larger version

Name:	Screenshot_1.jpg
Views:	57
Size:	17.5 KB
ID:	1818289

    Maybe if you make the default game mode have no controller and use this? ( shot in the dark ).
    Check out Zof ( puzzle game ) on Steam:

    https://store.steampowered.com/app/1414480/Zof/

    Comment


      #3
      Sadly, the player controller is supposed to represent a single player that has code to do anything the player may need to do at any given time. Because individual levels can have their own player controllers spawned and loading a new bespoke level destroys the current player controllers, people get the idea that player controllers are meant to be more modular (justifiably!).

      So you have two options here: build all of the input logic into a single player controller OR create blueprint components to add to and remove from your player controller as needed. These components could be specific to menu handling or whatever, just destroy unnecessary components when adding new ones.

      I haven't tried this, but maybe you can switch game modes, spawn a new player controller then destroy the old one? But honestly seems like more trouble than just having two graphs in one controller
      Last edited by Jared Therriault; 10-03-2020, 06:18 PM.
      iTween For UE4
      Procedural pathed animation for actors, components & UMG - $0
      Runtime DataTable
      DataTables dynamically loaded from text or Google Sheets while your game is running!
      easyCSV
      Fast, cheap, and accurate CSV parsing at runtime!

      Comment


        #4
        So you have two options here: build all of the input logic into a single player controller
        The main problem is that I have a crapton of variables and references stored in my controller that are linked to object that exists in-game, but that I don't need when in the main menu, and that are re-instanced when you re-load the main level again.

        Basically, I would need to make a complex reset function for my Controller, and I figured just getting a new controller every time I load my level could be much easier and cleanier

        create blueprint components to add to and remove from your player controller as needed. These components could be specific to menu handling or whatever, just destroy unnecessary components when adding new ones.
        Could you elaborate on blueprint components ? Do you just mean creating children of the component class and then putting my logic in it ?

        Comment


          #5
          Originally posted by Octadecagon View Post


          Could you elaborate on blueprint components ? Do you just mean creating children of the component class and then putting my logic in it ?
          Sure, you create a new blueprint class and have it inherit from Actor Component. Then you can add logic to it just like a regular blueprint class and add it to the base class's list of components as your needs for different functionality change. See this video from Matt Wadstein that explains it concisely: https://www.youtube.com/watch?v=U3Wyy1BFrTk. Apologies if you are familiar with it already
          iTween For UE4
          Procedural pathed animation for actors, components & UMG - $0
          Runtime DataTable
          DataTables dynamically loaded from text or Google Sheets while your game is running!
          easyCSV
          Fast, cheap, and accurate CSV parsing at runtime!

          Comment

          Working...
          X