Announcement

Collapse
No announcement yet.

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

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

  • replied
    Can't wait and I hope there will be more videos,
    Thanks Tom

    Leave a comment:


  • replied
    coyoneda It's common to do multiple linetraces, one comes from the camera and does the actual damage, the other comes from the muzzle location of the gun and is used for cosmetic things like tracer effects, making it look like there is a bullet coming from the weapon. This helps with player standing next to a wall or behind cover, if the actual linetrace came from the gun chances are it would get blocked by something, but because it comes from the camera you only need line of sight.

    Leave a comment:


  • replied
    Hello Tom, I am curious about why in the hitscan code you the tracing twice. Once from the camera position and one then from the muzzle. Like this:

    Code:
    void ASWeaponInstant::FireWeapon()
    {
         const FVector AimDir = GetAdjustedAim();
         const FVector CameraPos = GetCameraDamageStartLocation(AimDir);
         const FVector EndPos = CameraPos + (AimDir * WeaponRange);
    
        /* Check for impact by tracing from the camera position */
        FHitResult Impact = WeaponTrace(CameraPos, EndPos);
    
        const FVector MuzzleOrigin = GetMuzzleLocation();
    
        FVector AdjustedAimDir = AimDir;
        if (Impact.bBlockingHit)
        {
             /* Adjust the shoot direction to hit at the crosshair. */
             AdjustedAimDir = (Impact.ImpactPoint - MuzzleOrigin).GetSafeNormal();
    
             /* Re-trace with the new aim direction coming out of the weapon muzzle */
             Impact = WeaponTrace(MuzzleOrigin, MuzzleOrigin + (AdjustedAimDir * WeaponRange));
        }
        else
       {
             /* Use the maximum distance as the adjust direction */
             Impact.ImpactPoint = FVector_NetQuantize(EndPos);
       }
    
       ProcessInstantHit(Impact, MuzzleOrigin, AdjustedAimDir);
    }
    In general I have seen in different examples that as the origin of the ray different things are used: the camera position, in your Udemy course you use the actor eyes with GetActorEyesViewPoint() function and the muzzle as well. I know that obviously in the case of AI the camera position can't be used, but what's the rationale behind these different approaches?

    Leave a comment:


  • replied
    So useful work, thank you!

    Leave a comment:


  • replied
    i like this alot

    Leave a comment:


  • replied
    I need to handle all of the death events my self but I can seem to find where some of the functions are getting called. UnFreeze(), and StartSpectating(), I know they are in the Player Controller, but I cant seem to find where they are getting called from, When running log statments after taking damage it calls onDeath(), Die(), but neither of the those call start spectating. Any help would be great.

    Leave a comment:


  • replied
    Ok.. i was able to load the project, but can anyone help me with the retargeting... Everytime i tried to retarget the animation using one of the paragon character, the gun from the original character just move to the place where it is not supposed to be... Plz really need this to work

    Leave a comment:


  • replied
    It looks like Tom upgraded the project on GitHub yesterday to work with 4.22.

    Leave a comment:


  • replied
    still doesn't work for me... i did exactly what STLWalterSobchyk said but still..... im really need this to work, can anyone help, i tried to use UE 4.21.2 and UE 4.22.2. Any help is really appreciated!

    Leave a comment:


  • replied
    Got it working in 4.22

    First i needed to update my VS2017

    Code:
     
     WindowsPlatformCompilerSetup.h(22): error C2338: Visual Studio 2017 versions 15.7 and 15.8 are known to have code generation bugs that affect UE4. Please update to version 15.9.
    Solution: Downloaded the Latest VS 2017
    https://docs.microsoft.com/en-us/vis...s2017-relnotes


    Secondly i received compile errors for the Possess() and UnPossess() calls in SZombieAIController.h
    Code:
     
     error C3248: 'AController::Possess': function declared as 'final' cannot be overridden by 'AEnemyAI::Possess' error C3248: 'AController::UnPossess': function declared as 'final' cannot be overridden by 'AEnemyAI::UnPossess'
    Solution:
    I fixed this by renaming them OnPosess() and OnUnPossess() in header and SZombieAIController.cpp which makes them a custom function instead of an Override function

    Thirdly i received several compile errors concerning FCollisionQueryParams TraceParams in a few files
    Code:
     error C2039: 'bTraceAsyncScene': is not a member of 'FCollisionQueryParams'
    I simply commented them out and this allowed me to build the solution.

    Solution:
    Code:
    //TraceParams.bTraceAsyncScene = true;
    Disclaimer;
    Simply a workaround to build project not getting the engine Possess override function and missing a collision call several places. Toms an awesome instructor figured i could help out so i can continue learning as well!

    Leave a comment:


  • replied
    I tried to recreate the master project in engine version 4.21.2. In the Character.h he declares a USpringArmComponent and UCameraComponent yet he never includes the header files for these classes nor does a forward declaration. My project won't compile without including the header files. Both versions are 4.21.2. Anyone know why this is happening? Where are the includes hiding?

    Leave a comment:


  • replied
    Just a heads up for anyone else having issues on 4.20 and Linux:
    Trying to package the example for release does not work from the Editor. I always get inotify errors.
    I actually increased the inotify max to a huge amount and the error persists: fs.inotify.max_user_watches = 2097152

    So the only "fix" I found was to manually compile it like this: https://wiki.unrealengine.com/How_to..._with_commands
    My engine source is in an external sata hard drive over usb 3.0, so the problem may be related to that, or not.

    Leave a comment:


  • replied
    Originally posted by brian.boettger View Post
    MachineX
    This is due to the mods if I recall correctly. What I did was downloaded the 4.18 copy of the source. Opened it in 4.18. Then if you upgrade it, it should tell you that the rifle mode and the other mod are not supported would you like to disable them...
    Thank you, sorry only just seen this as I've been away


    Originally posted by dc740 View Post
    ...
    UPDATE:
    There was a "bug" in the last commit:
    ...

    Thank you very much, I'll be trying this project again soon!

    Leave a comment:


  • replied
    Originally posted by MachineX View Post
    Hello,


    I'm having trouble opening the SurvivalGame project in 14.19.2, I get an error about the UE4Editor-SurvivalGame.dll file and am too inexperienced to resolve this, I've tried a few things after a couple of days extensively Googling, installed Windows SDK & Visual Studio 2017 (OS: Windows 7 Ultimate 64-bit) as some mentioned that resolved compiling issues but I've had the same error since the start.

    ...
    If there's a magic thing I can do to make this work please let me know, it's frustrating as I'm at a loss
    I'm having exactly the same problem on 4.20 (downloaded and compiled yesterday), but I'm on Linux. The error is the same though. Any way to solve this without having to go back to 4.18? (the download and setup time is pretty big and I'd like to avoid it at all cost)

    Thank you


    UPDATE:
    There was a "bug" in the last commit:
    https://github.com/tomlooman/EpicSur...9b5b4e47b2fda8

    SurvivalGame/Source/SurvivalGame/Private/World/SGameMode.cpp Line 422

    There shouldn't be any problems, since the && has lower precedence than the ||, and everything should just compile, but it didn't work for me and I have to explicitly set the () around the first group of &&.
    Here is the code that compiles:
    Code:
                if (
                    (
                        !Actor->IsA(ALevelScriptActor::StaticClass())
                        && !Actor->IsA(ASMutator::StaticClass())
                        && Actor->GetRootComponent() != nullptr
                        && Actor->GetRootComponent()->Mobility != EComponentMobility::Static
                    )
                   ||
                    (
                        !Actor->IsA(AStaticMeshActor::StaticClass())
                        && !Actor->IsA(ALight::StaticClass())
                    )
                   )
    Notice that I only added extra () around the first 4 && conditions. Either add the () yourself, or copy/paste that code.


    How did I debug it?

    I manually compiled the client:
    https://wiki.unrealengine.com/How_to..._with_commands

    Then I checked the logs in the output, and <home>/Library/Logs/Unreal Engine/LocalBuildLogs/Log.txt
    Last edited by dc740; 08-05-2018, 05:05 PM.

    Leave a comment:


  • replied
    Hello,
    does anyone know how the shooting in the center is made?



    Leave a comment:

Working...
X