Announcement

Collapse
No announcement yet.

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

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

    #91
    Originally posted by Desoxi View Post
    I really have some problems understanding a few things in this project...
    I cant find anything which explains the use of classes like "Local Player", "Player State", "Spectator Pawn".

    And where do you specify where to spawn the player at the start of a game? There are 6 "PlayerStart" objects but only 2 of them, inheriting from
    your custom "SPlayerStart.h", are used. Even when i start it for 3 players.

    EDIT: K i figured out the playerstart thing.. for those who want to know: it is used in SGameMode

    But here is another question: When is "ChoosePlayerStart(AController* Player) called? I guess it uses the Controller spawned for the new player?
    LocalPlayer is a class that's mostly used for local multiplayer and splitscreen.

    PlayerState is used to store variables that need to be send over the network so other clients can understand the state of another player. (A Pawn can replicate variables, but a pawn is destroyed and recreated on every death, the playerstate class allows us to persist certain variables like death count across the network)

    SpectatorPawn, used during spectating. No mesh, no FX, just a fly camera usually. This can be assigned in the gamemode.

    ChoosePlayerStart is called when a new Pawn is spawned during ServerRestartPlayer(..) You can do a search in the entire solution since UE releases now come with all source, it'll help you understand the framework.

    - Tom
    Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

    Comment


      #92
      How would i change how fast the time of day cycles? for example if i want the daytime to last longer?

      Comment


        #93
        Originally posted by KennethE View Post
        How would i change how fast the time of day cycles? for example if i want the daytime to last longer?
        In SGameState.cpp you can find a variable called TimeScale in the constructor, tweak it as you want.

        If you want you can set this variable at runtime via console in this way:

        1) Open SGameState.h

        2) Scroll down and after the SetTimeOfDay function declare a new function like this

        Code:
        UFUNCTION(exec)
        void SetTimeScale(float NewTimeScale);
        3) Now open SGameState.cpp and define your function (personally i done it after the SetTimeOfDay definition)

        Code:
        void ASGameState::SetTimeScale(float NewTimeScale)
        {
        	TimeScale = NewTimeScale;
        }
        Hope it help
        Join the Unreal Engine community on Reddit! | Twitter: @ZioYuri78

        Comment


          #94
          Originally posted by ZioYuri78 View Post
          In SGameState.cpp you can find a variable called TimeScale in the constructor, tweak it as you want.

          If you want you can set this variable at runtime via console in this way:

          1) Open SGameState.h

          2) Scroll down and after the SetTimeOfDay function declare a new function like this

          Code:
          UFUNCTION(exec)
          void SetTimeScale(float NewTimeScale);
          3) Now open SGameState.cpp and define your function (personally i done it after the SetTimeOfDay definition)

          Code:
          void ASGameState::SetTimeScale(float NewTimeScale)
          {
          	TimeScale = NewTimeScale;
          }
          Hope it help
          Not sure why, but it does not seem to be helping, i even built the solution after i made the changes...

          Comment


            #95

            rox keep going with update

            برمجة تطبيقات الاندرويد
            تصميم برامج الايفون
            تطبيقات اندرويد
            Last edited by Ahmedefndi; 11-20-2015, 10:53 PM.

            Comment


              #96
              Hey I am doing my own Shooter game test thingy and I am using your Survival Game as a reference for learning Animation Blueprint and some other things.
              In your projects Player_AnimBP, StartCrouch to Crouch rule, there is this 'Stand_to_Crouch_Rifle_Hip Asset' which has 'Time Remaining' float.
              I am not able to recreate this in my own project, how did you create this asset? Did you create this asset somewhere in C++ or do you make some sort of reference within that animation file?

              Comment


                #97
                Originally posted by TalicFIN View Post
                Hey I am doing my own Shooter game test thingy and I am using your Survival Game as a reference for learning Animation Blueprint and some other things.
                In your projects Player_AnimBP, StartCrouch to Crouch rule, there is this 'Stand_to_Crouch_Rifle_Hip Asset' which has 'Time Remaining' float.
                I am not able to recreate this in my own project, how did you create this asset? Did you create this asset somewhere in C++ or do you make some sort of reference within that animation file?
                The TimeRemaining node is built-in, I didn't do anything custom in C++. It will only be available if the state A (eg. Idle or Crouching state) has an animation to play so we can access this animation info when we want to check TimeRemaining on it.

                Any of the arrows you drag between states has the animation info from the state node it originates from (eg. where the arrow starts) so long as that state is playing an animation sequence, you should be able to get nodes specific to that animation, like the TimeRemaining node.

                Hope that made any sense.

                More info on State Machines and the Transition Rules: https://docs.unrealengine.com/latest...nes/index.html
                Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                Comment


                  #98
                  For Windows 10 users.

                  I have a build of UE v4.7.6 for Windows 10 for whomever is interested. The version from epic doesn't load the project and locks my system. Great work on this.

                  Comment


                    #99
                    Originally posted by tyoungjr View Post
                    I have a build of UE v4.7.6 for Windows 10 for whomever is interested. The version from epic doesn't load the project and locks my system. Great work on this.
                    The latest version on Github runs on UE 4.10. I'm using Windows 8.1, but have not heard of any Windows 10 related issues.
                    Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                    Comment


                      Originally posted by Tom Looman View Post
                      The latest version on Github runs on UE 4.10. I'm using Windows 8.1, but have not heard of any Windows 10 related issues.
                      Hey Tom, I verified master works with 4.10 on windows 10 however the section branches are pre 4.9 api, hence the necessary 4.7.6 rebuild. I like seeing this project in it's early stages!

                      Comment


                        FocusedUsableActor should be Initialized to NULL?

                        Hello Tom .I have a doubt in the Tick function


                        Code:
                        ASUsableActor* Usable = GetUsableInView();
                        
                        		// End Focus
                        		if (FocusedUsableActor != Usable)
                        		{
                        			if (FocusedUsableActor)
                        			{
                        				FocusedUsableActor->OnEndFocus();
                        			}
                        
                        			bHasNewFocus = true;
                        		}
                        Here we are comparing FocusedUsableActor with Usable. FocusedUsableActor is Uninitialized initially, won't it cause Undefined behavior.Should we not initialize to NULL in the constructor.

                        Comment


                          Originally posted by Freedom911 View Post
                          Hello Tom .I have a doubt in the Tick function


                          Code:
                          ASUsableActor* Usable = GetUsableInView();
                          
                          		// End Focus
                          		if (FocusedUsableActor != Usable)
                          		{
                          			if (FocusedUsableActor)
                          			{
                          				FocusedUsableActor->OnEndFocus();
                          			}
                          
                          			bHasNewFocus = true;
                          		}
                          Here we are comparing FocusedUsableActor with Usable. FocusedUsableActor is Uninitialized initially, won't it cause Undefined behavior.Should we not initialize to NULL in the constructor.
                          It's not required to initialize to nullptr (We only use nullptr, NULL is only used for Windows platform specific functions) but it's clean if you make a convention of doing so.

                          UObjects (which includes our SUsableActor) are automatically cleared to zero. So the above code will not cause any issues when not initialized to nullptr.

                          - Tom

                          Comment


                            Oh ok. Thanks .

                            Comment


                              hey I just started to use UE4 so Im new sorry about it mmm and try to build something new so decided to learn something about from your game but I have no idea how to add custom character also animations ?
                              Last edited by alked; 03-04-2016, 12:47 PM.

                              Comment


                                Hi Tom
                                Big thanks for such a big thread...
                                I am still a newbie in UNREAL stuff...
                                I was wondering...
                                Could you describe a little more mechanics of UE4 ... I mean mostly whats is going on under C++ code... For example under your Scharacter.cpp at the beginning you have typed

                                ASCharacter::ASCharacter(const class FObjectInitializer& ObjectInitializer)
                                : Super(ObjectInitializer.SetDefaultSubobjectClass<USCharacterMovementComponent>(ACharacter::CharacterMovementComponentName))

                                I have some notion about object programming , pointers , classes... BUt this still confuses me a lot...
                                Could explain a little bit what for is it?

                                Comment

                                Working...
                                X