Announcement

Collapse
No announcement yet.

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

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

  • replied
    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)

    Leave a comment:


  • replied
    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

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    Im having problems with multiple PC's since 9.1
    The open command does not work. Any idea?

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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?

    Leave a comment:


  • replied
    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!

    Leave a comment:


  • replied
    nicejob

    nicejob!!!!!

    Leave a comment:


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

    Leave a comment:


  • replied
    Alright, thx! Good thing I can download 4.7

    Leave a comment:


  • replied
    Originally posted by IceDealer View Post
    So I downloaded the first section to get a better understanding of coding in UE4. Sadly, all sections don't work with 4.8 and there is far too much code in the master project for me to handle as a beginner . Any chance of getting at least section 1 and 2 updated to 4.8 ?
    If you wish to go per-section you can grab the section branches instead of master

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

    And yes those are for 4.7 which is a bit unfortunate but can't really undo that. If the docs are out of date for 4.8 I can take a look to update where needed though.

    Leave a comment:


  • replied
    So I downloaded the first section to get a better understanding of coding in UE4. Sadly, all sections don't work with 4.8 and there is far too much code in the master project for me to handle as a beginner . Any chance of getting at least section 1 and 2 updated to 4.8 ?

    Leave a comment:


  • replied
    Originally posted by nullponull View Post
    Thank you tom answer.
    It is , it is that you use the session if you use the online subsystem that !
    I am now , I want to realize the network match using the OnlineSystemSteam at some in learning " ShooterGame or MultiPlayShootout " .
    And I tried to step street to see the wiki of RAMA , but it does not go well . The detailed procedure of the operation of the operation and UE4 of VS2013 I want to know .
    Why not tell me me a detailed procedure ?

    https://wiki.unrealengine.com/Steam,...ng_Development
    https://docs.unrealengine.com/latest...eam/index.html
    I have yet to work on integrating Steamworks myself into projects. I noticed the docs on this are scarce on this subject and there is a lot involved to get this up and running. I'm afraid I can't help you besides showing multiplayer shootout, shootergame and the docs you already linked yourself.

    - Tom

    Leave a comment:


  • replied
    Hey,
    just a quick question: Can I only open the project with Visual Studio 2013 ? Seems like it, but I can only download Visual Studio Community 2015 on the website. How can I open it with 2015 ? Or is there a 2013 installer somewhere to download ? Can't find a way to open this project


    *UPDATE*: Nevermind, just read 2015 is not supported yet.
    Last edited by IceDealer; 08-08-2015, 05:55 PM.

    Leave a comment:

Working...
X