Announcement

Collapse
No announcement yet.

Ongoing C++ Gameplay Example Series: Making a Survival Game

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

    Answer Thank you Tom.
    I'll try my best on their own .

    Comment


      nicejob

      nicejob!!!!!

      Comment


        Hi! Thank you for your sample. Very nice to play and to learn a lot! I have a question: I imported my own model skinned and rigged, then did a retarget animation, then linked the meta blueprint. It works great, except reloading animations, and changing weapons that didnt play (but the game reload and is able to change to flashlight, just that both animation didnt play) Anyone know's why? Thank you!

        Comment


          Originally posted by Naitguolf View Post
          Hi! Thank you for your sample. Very nice to play and to learn a lot! I have a question: I imported my own model skinned and rigged, then did a retarget animation, then linked the meta blueprint. It works great, except reloading animations, and changing weapons that didnt play (but the game reload and is able to change to flashlight, just that both animation didnt play) Anyone know's why? Thank you!
          I am not at home with my PC, but trying to help, did you create all the sockets on your new imported mesh?
          pd: Excuse my English.

          Comment


            Hi Alexarg. Yes, I added the three sockets: on pelvis, on spine_03, and on hand_r.

            EDIT: I found the issue. I needed to point on weapon blueprint the animation composite for the new character, as pointed the maniquee. So that's make me wonder if I need to make every weapon for ever character I will add independant. So Does that's mean lots of same weapon?

            EDIT 2: Could enyone please add an example for how to make a type of zombie that shoots? I would love to see more aditions like adding prone and how to add things like that as the iddle without weapon movement, or the nice flash back done by ZioYuri78, as this sample if very fun to tweak it (and play it!)
            Last edited by Naitguolf; 08-29-2015, 06:57 AM.

            Comment


              Im having problems with multiple PC's since 9.1
              The open command does not work. Any idea?
              JcInventory, a Jigsaw Grid based Inventory designed in UMG and blueprint

              Comment


                Originally posted by Staggerlee View Post
                Im having problems with multiple PC's since 9.1
                The open command does not work. Any idea?
                I'm not in 4.9.1 yet to try out, but it sounds like a general engine bug. Your best bet it to take this to AnswerHub for the support team to look at.
                Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                Comment


                  Originally posted by Staggerlee View Post
                  Im having problems with multiple PC's since 9.1
                  The open command does not work. Any idea?
                  Open works for me, make sure you're using open 127.0.0.1, and that the session you're trying to connect to has ?listen in the command line, otherwise you won't be able to join it.

                  Comment


                    Hi Tom

                    Thanks for the great tutorial series ! I learned a lot from it.

                    I am extending the code to enable spawning objects into the world and then carrying them. Just as into your Pickup() function I have a SpawnNewActor() function hooked up to the B key.

                    Code:
                    void USCarryObjectComponent::SpawnNewActor()
                    {
                    	if (GetIsCarryingActor())
                    	{
                    		return;
                    	}
                    
                    	if (GetOwner()->Role < ROLE_Authority)
                    	{
                    		ServerSpawnNewActor();
                    		return;
                    	}
                    	
                    	UWorld* const World = GetWorld();
                    	if (World){
                    		
                    		//ConstructorHelpers::FObjectFinder<UBlueprint> MyBlueprint(TEXT("/Game/Test/Stairs/StairsBP.StairsBP"));
                    		auto Object = StaticLoadObject(UObject::StaticClass(), nullptr, TEXT("/Game/Test/Stairs/StairsBP"));
                    		
                    		UBlueprint *BP = Cast<UBlueprint>(Object);
                    		
                    		APawn* OwningPawn = Cast<APawn>(GetOwner());
                    
                    		FActorSpawnParameters SpawnParams;
                    		SpawnParams.Instigator = OwningPawn;
                    		SpawnParams.Instigator = OwningPawn->Instigator;
                    
                    		FVector Location = OwningPawn->GetActorLocation() + OwningPawn->GetActorForwardVector() * 600;
                    
                    		AActor *SpawnedActor = World->SpawnActor<AActor>((UClass*)BP->GeneratedClass, Location, FVector::ZeroVector.Rotation(), SpawnParams);
                    		SpawnedActor->SetReplicates(true);
                    		SpawnedActor->SetReplicateMovement(true);
                    		OnSpawnNewActorMulticast(SpawnedActor);
                    	}
                    
                    }
                    
                    
                    
                    
                    void USCarryObjectComponent::ServerSpawnNewActor_Implementation()
                    {
                    	SpawnNewActor();
                    }
                    
                    bool USCarryObjectComponent::ServerSpawnNewActor_Validate()
                    {
                    	return true;
                    }
                    
                    
                    
                    void USCarryObjectComponent::OnSpawnNewActorMulticast_Implementation(AActor* SpawnedActor)
                    {
                    	if (SpawnedActor)
                            .......
                            .......
                    		
                    }


                    It works fine in singleplayer, the object is spawned when the B key is hit, attached to the end of the boom and I can move it around and drop it when I press the middle mouse button. The problem is in multiplayer. On the server its all fine but on the clients the SpawnedActor parameter in the OnSpawnNewActorMulticast_Implementation function is always null. When I drop the object it appears on both client and server but on spawning it fails to attach to the boom in the client as it is null.

                    Any thoughts on what might be wrong ?

                    Thanks !
                    Sanjit

                    Comment


                      Don't see something immediately wrong. Perhaps the Actor does not exist on the Client yet because of the SetReplicates call coming in late.

                      BTW I highly recommend never using FObjectFinder, you can use code like

                      UPROPERTY(EditDefaultsOnly, Category = "Loot")
                      TSubclassOf<class ASAmmoPickupActor> AmmoLootClass;
                      in the Header file to expose a class reference to Blueprint and assign it in the component instead of hard-coding content lines (I know yours is WIP/test code, but I try to stay away from this entirely)
                      Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                      Comment


                        Thanks Tom for the inputs. Yes I suspect it is a replication issue. I have not yet found a work around but trying to, will post if I do.

                        Cheers
                        Sanjit

                        Comment


                          when trying to use this project, i download part 8, i have both visual studio professional 2012, and community 2013, UE4 and get the (Failed to build) try building manually... can someone help?

                          Comment


                            My Error is

                            The project could not be compiled. Would you like to open it in Visual Studio?

                            Running D:/UDK/Epic Games/4.9/Engine/Binaries/DotNET/UnrealBuildTool.exe SurvivalGame Development Win64 -project="C:/Users/Jake/Desktop/SurvivalGame 4.9/SurvivalGame.uproject" -rocket -editorrecompile -progress -noubtmakefiles
                            @progress push 5%
                            Parsing headers for SurvivalGameEditor
                            Running UnrealHeaderTool "C:/Users/Jake/Desktop/SurvivalGame 4.9/SurvivalGame.uproject" "C:\Users\Jake\Desktop\SurvivalGame 4.9\Intermediate\Build\Win64\SurvivalGameEditor\Development\UnrealHeaderTool.manifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -rocket -installed
                            Reflection code generated for SurvivalGameEditor in 13.0976405 seconds
                            @progress pop
                            Performing 17 actions (2 in parallel)
                            [2/17] Resource ModuleVersionResource.rc.inl
                            PCH.SurvivalGame.h.cpp
                            [3/17] Resource SurvivalGame.rc
                            SurvivalGame.generated.cpp
                            SConsumableActor.cpp
                            C:\Users\Jake\Desktop\SurvivalGame 4.9\Source\SurvivalGame\Public\SCharacter.h(72) : error C3668: 'ASCharacter::OnLanded' : method with override specifier 'override' did not override any base class methods
                            C:\Users\Jake\Desktop\SurvivalGame 4.9\Source\SurvivalGame\Public/SCharacter.h(72) : error C3668: 'ASCharacter::OnLanded' : method with override specifier 'override' did not override any base class methods
                            SCharacter.cpp
                            C:\Users\Jake\Desktop\SurvivalGame 4.9\Source\SurvivalGame\Public\SCharacter.h(72) : error C3668: 'ASCharacter::OnLanded' : method with override specifier 'override' did not override any base class methods
                            SHUD.cpp
                            C:\Users\Jake\Desktop\SurvivalGame 4.9\Source\SurvivalGame\Public\SCharacter.h(72) : error C3668: 'ASCharacter::OnLanded' : method with override specifier 'override' did not override any base class methods
                            SCharacterMovementComponent.cpp
                            SPickupActor.cpp
                            C:\Users\Jake\Desktop\SurvivalGame 4.9\Source\SurvivalGame\Public\SCharacter.h(72) : error C3668: 'ASCharacter::OnLanded' : method with override specifier 'override' did not override any base class methods
                            SPlayerCameraManager.cpp
                            C:\Users\Jake\Desktop\SurvivalGame 4.9\Source\SurvivalGame\Public\SCharacter.h(72) : error C3668: 'ASCharacter::OnLanded' : method with override specifier 'override' did not override any base class methods
                            SPlayerController.cpp
                            SBombActor.cpp
                            SurvivalGameGameMode.cpp
                            SGameMode.cpp
                            SUsableActor.cpp
                            SurvivalGame.cpp
                            -------- End Detailed Actions Stats -----------------------------------------------------------
                            ERROR: UBT ERROR: Failed to produce item: C:\Users\Jake\Desktop\SurvivalGame 4.9\Binaries\Win64\UE4Editor-SurvivalGame.dll
                            Total build time: 74.17 seconds

                            Comment


                              Originally posted by Jakeyiii View Post
                              when trying to use this project, i download part 8, i have both visual studio professional 2012, and community 2013, UE4 and get the (Failed to build) try building manually... can someone help?
                              You mention part 8? But there are only 6 sections. if you download the latest from GitHub you need to run it with 4.9. From your log output it seems to fail on OnLanded() which is a function in the API that got changed around 4.8. Please make sure you got the latest, and are trying to compile in Visual Studio 2013 with 4.9.
                              Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                              Comment


                                Hi there Tom!

                                As usual thanks for your contribution mate!

                                Just my 50 cents, I've quickly read through parts of the code, and since you like good practices, here's my contribution:
                                - You're sending Client messages using FStrings, it makes more sense - in terms of bandwidth, performance - to instead send a uint32, having most of the messages hardcoded on the client. All the client has to do, is open the map of those messages (stored in an XML or w/e), and they get their message. uint32 vs FString... And use that solution for special unpredicted messages, or well, just a combination of both sendClientMessage(uint32 messageID, FString replaceString);
                                [On Hold]WIP: Vertex-Based Ledge Detection/Parkour Engine

                                Looking for fellow programmers to develop a project.

                                Comment

                                Working...
                                X