Announcement

Collapse
No announcement yet.

Announcing Section #1 for Survival Game - Third-person Player Setup

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

  • replied

    i can't find the "bomb gray edge" realization,how to do this?

    Leave a comment:


  • replied
    Originally posted by berserkturtle View Post

    Anyone else know what might be going on? The tutorial game version functions correctly, but mine doesn't, and Im not sure what Im doing differently.
    Hi turtle,

    One way to handle this is to locally (client side) check if the pickup will succeed (in this case we can perform a trace on the client and see if we find a usable item) if that returns an object we can play the sound immediately. THEN send the request to the server to do the actual pickup logic.

    The other way or dealing with this is to have the server send a respond back to the client if we indeed successfully picked up the item, but keep in mind that it will cause a delay because of the round-trip and in turn, makes the game feel less responsive.

    The first example is "safe" because we only played a sound locally, and did not execute any real pickup/use logic on the client. If you have different types of pickup/use audio per item, you can use the same logic, and fetch the audio file from the returned Actor when calling GetUsableInView() on the client and play that file on the client before sending the request to the server.

    Now for the implementation...

    What I like to do it to split the real logic from the local client code when the key is pressed (as you can see we did with sprinting etc.) so you could add a function OnUse() which is bound to the "E" key and handles the above example of tracing locally before sending the request with Use(). This way we don't have to check inside Use() if we should play the sound by checking if we are the owning client or remote server, etc.

    Hope that clears things up!

    - Tom

    Leave a comment:


  • replied
    I've been trying to learn from this and testing in multiplayer.

    After I built the SUsableActor > SPickupActor > SConsumableActor and Use() functionality in my own project I noticed the "PickupSound" was playing pefectly on my Server viewport, but no "Pickup Sound" would play on my Client viewport -- all the other sounds replicate to the client window (ie SBombActor), so Im confused...

    I've created an Attenuation and have assigned it to the PickupSound cue. But that didnt solve the problem for me.


    After playing with it a bunch, I think it only plays in the server window due to the following line, but this is how the tutorial does it.. so Im confused:
    Code:
    void ASCharacter::Use()
    {
       // Only allow on server. If called on client push this request to the server
       if (Role == ROLE_Authority)
       {
          ASUsableActor* Usable = GetUsableInView();
          if (Usable)
          {
             Usable->OnUsed(this);
          }
       }
       else
       {
          ServerUse();
       }
    }
    I can swap some lines around and design the function similarly to SetIsJumping() or SetSprinting()
    Code:
    void ASCharacter::Use()
    {
       ASUsableActor* Usable = GetUsableInView();
       if (Usable)
       {
          Usable->OnUsed(this);
       }
    
       if (Role < ROLE_Authority)
       {
          ServerUse();
       }
    }
    and that can play the sound fine on the Client, but Im guessing its not the right way to do it.


    Anyone else know what might be going on? The tutorial game version functions correctly, but mine doesn't, and Im not sure what Im doing differently.

    Leave a comment:


  • replied
    Originally posted by Gibdion View Post
    I had a thought, based on outline material, how does one fix it so different types of objects have different color outlines?

    I assume we create a MID maybe for types of objects. A bomb type for example could have a red color, Food would be yellow. Then in the ray cast, we create the MID and assign the color from the object? I've not worked much with MID, so am I even on the right path?

    Just not sure how to access the blendable material in the PP volume through code
    That doesn't work for multi-color objects in a single post-process pass. the effect uses a single channel depth value from CustomDepth. By default can't encode any kind of objecttype data into this buffer and therefor can't apply different colors to different objects.

    One user made a mod to the engine that allows custom tags to be used https://github.com/Temaran/UnrealEng...ustomTagBuffer that effectively enables the use of multi-colored outlines.

    Leave a comment:


  • replied
    I had a thought, based on outline material, how does one fix it so different types of objects have different color outlines?

    I assume we create a MID maybe for types of objects. A bomb type for example could have a red color, Food would be yellow. Then in the ray cast, we create the MID and assign the color from the object? I've not worked much with MID, so am I even on the right path?

    Just not sure how to access the blendable material in the PP volume through code
    Last edited by Gibdion; 07-25-2015, 07:18 PM.

    Leave a comment:


  • replied
    thank you.

    Leave a comment:


  • replied
    Originally posted by 有亦 View Post
    when i compile the code of section 1,there is a compile error about the func below
    void ASCharacter::OnLanded(const FHitResult& Hit) override;

    it seems that OnLanded isn't a virtual member function.

    my engine version 4.8.2
    i just don't understand.
    The API changed from 4.7 to 4.8, section 1 code branch and docs may still include some references to 4.7 (and should be updated to 4.8 once the project is up on Learn-tab) the complete download of the project has all updated code of 4.8. OnLanded is one of those functions that was altered in 4.8.

    Leave a comment:


  • replied
    when i compile the code of section 1,there is a compile error about the func below
    void ASCharacter::OnLanded(const FHitResult& Hit) override;

    it seems that OnLanded isn't a virtual member function.

    my engine version 4.8.2
    i just don't understand.

    Leave a comment:


  • replied
    Nice tutorial. Thank you

    Leave a comment:


  • replied
    Originally posted by Gibdion View Post
    Thank you for the explanation.

    What confused me is, section 1 of this project has the game mode set to the SurvialGameGameMode, which is the C++ class, not the blueprint class. And has the pawn was set to DefaultPawn, not PlayerPawn BP. For me, based on what you said, I created a blueprint class based on my empty game mode c++ class, and within the BP, I assigned all my items. I do like this method much better. Thanks
    The map must have been set to override it to the BP variant through the map's World settings. Otherwise the game would have not worked.

    - Tom

    Leave a comment:


  • replied
    Thank you for the explanation.

    What confused me is, section 1 of this project has the game mode set to the SurvialGameGameMode, which is the C++ class, not the blueprint class. And has the pawn was set to DefaultPawn, not PlayerPawn BP. For me, based on what you said, I created a blueprint class based on my empty game mode c++ class, and within the BP, I assigned all my items. I do like this method much better. Thanks

    Leave a comment:


  • replied
    Hi Jeff! Thanks for answering that is such detail

    Our top-level character class is a Blueprint "PlayerPawn" (Meaning assigning SCharacter::StaticClass() in code won't give you properly set up character) I'd like to avoid content references in code whenever possible (I might still add this specific case to the code just to demonstrate that it IS possible to do)

    - Tom

    Leave a comment:


  • replied
    Originally posted by Gibdion View Post
    Where do you assign your DefaultPawnClass?

    I couldn't see that anywhere in the code. And I know when I start I project from scratch, I can't get my character to spawn without defined. Am I missing another way?
    Specifying the default pawn is handled in the Game Mode. In this project, specifying the player pawn class isn't actually done in code. If you look in the Editor, there are two game modes DebugGameMode and SurvivalGameModeSetup, which both descend from SGameMode. The default pawn class from AGameMode is overridden in these two blueprints, which you can find in the Classes section of the Class Defaults tab.

    It's pretty common to create one or more blueprint subclasses of your C++ class. That gives you the flexibility to use either Blueprint or C++ (and easily move logic between them) and gives you the ability to use the built-in features of the editor when it makes sense. If he had wanted to set the pawn in SGameMode, it could have been done the constructor and looked something like this:

    Code:
        DefaultPawnClass = SCharacter::StaticClass();
    if the character class you wanted to use was a C++ class, it'd be something like this:

    Code:
    	static ConstructorHelpers::FClassFinder<APawn> PlayerPawnOB(TEXT("/Game/Blueprints/Characters/Character_BP"));
    	DefaultPawnClass = PlayerPawnOB.Class;
    (note - code typed in editor, caveat emptor, may not compile )

    In this case, it looks like Tom put his common logic into the C++ class and then the things he wants to change between debug and non-debug into the blueprint class (which is a good idea I'm going to steal).

    Leave a comment:


  • replied
    Where do you assign your DefaultPawnClass?

    I couldn't see that anywhere in the code. And I know when I start I project from scratch, I can't get my character to spawn without defined. Am I missing another way?

    Leave a comment:


  • replied
    Originally posted by cridia View Post
    I have a question about this section. I just came in here, hoping to learn C++ coding for UE4, but I have a problem with the files.

    If I'm not mistaken, the CPP and H files you linked to at the start of the first section, already includes the code you have added for the other sections as well. If this is the case, then this tutorial will essentially only be accessible to people who were doing it from the very beginning. I mean, as of writing, just the character class is already about 1000 lines long. To me this is extremely confusing and already kind of overwhelming, as I am not certain what code I need to write to make this first section compile without any mistakes (for instance, I already have to take in account at least the base character class, considering it is what the character class is extended from, and I have no idea what functionality written in the character class is reliant on what included class).

    Is there any plan or way to make it so people that found these tutorials later (like me) can also follow along?
    You can jump back to previous sections using the individual Branches on GitHub, for example section 1:

    https://github.com/tomlooman/EpicSur...tree/Section-1

    I hope that helps you a bit in getting into the code, especially Character has grown a lot more than I had anticipated

    - Tom

    Leave a comment:

Working...
X