Announcement

Collapse
No announcement yet.

Training Stream - Tanks vs. Zombies: Movement and Aiming - April 5th

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

    [LIVESTREAM] Training Stream - Tanks vs. Zombies: Movement and Aiming - April 5th



    WHAT
    Lauren and Richard return to continue their 2D Tanks vs. Zombies game with C++. In this stream, they'll do a quick level tile map, and then add movement functions to their tank. With WASD to move and a click-to-aim turret, let's get these tanks moving!

    WHEN

    Tuesday, April 5th @ 2:00PM-3:00PM ET - Countdown

    WHERE

    www.twitch.tv/unrealengine

    WHO

    Lauren Ridge - Training Content Creator @LRRidge
    Richard Hinckley - Sr Documentation Engineer

    SOURCE FILES
    https://forums.unrealengine.com/unre...ream#post81169

    Archive:

    Last edited by Amanda.Schade; 09-28-2017, 10:32 AM.
    Twitch /unrealalexander| Twitter @UnrealAlexander
    How to report a bug? | Installation & Setup issues?
    Call me to a thread by posting this: [MENTION]Alexander Paschall[/MENTION]

    #2
    From the first lesson, I still have the problem that whenever I move the childTurret in the TankBP viewport and recompile, the engine creates a new child which is visible in both the editor viewport and the BP viewport itself as described in the old anouncement thread by another user.
    I checked my code and compared it with yours and it is literally the same but maybe I missed something. It would be nice if you could make a statement either at the beginning of the second video or in the thread about whether the UCHildActorComponent stuff is buggy in 4.11 or well, I don't know to be honest I started the project in 4.11 preview 4 or whenever your first lesson aired, just for your information.

    To be honest with you guys, I really appreciate what you are doing for the community and I know this must be a lot! of work, but for the future I think it would be nice if you could have an eye on the accompanying thread for further help as the other thread didn't get a lot of attention by both of you. (Of course there was GDC etc. so nothing personal and I hope you take my opinion in a neutral way)
    Last edited by LeFxGuy; 04-02-2016, 02:11 PM.
    Guido Lein
    Technical Artist - LeFx www.lefx.de

    Comment


      #3
      Originally posted by LeFxGuy View Post
      From the first lesson, I still have the problem that whenever I move the childTurret in the TankBP viewport and recompile, the engine creates a new child which is visible in both the editor viewport and the BP viewport itself as described in the old anouncement thread by another user.
      Lauren and I just checked this, and it happens here, too. That looks like a bug! I'll report it to QA in a few minutes.

      Originally posted by LeFxGuy View Post
      I checked my code and compared it with yours and it is literally the same but maybe I missed something. It would be nice if you could make a statement either at the beginning of the second video or in the thread about whether the UCHildActorComponent stuff is buggy in 4.11 or well, I don't know to be honest I started the project in 4.11 preview 4 or whenever your first lesson aired, just for your information.
      Well, it can be an issue if you use a different version of the engine from what we have. We used 4.10.4 on the stream, not 4.11 Preview 4, so that could cause errors. However, in this case, it's a legitimate engine bug. It is worth noting that since the game re-instantiates all objects on startup, your tank in-game (including PIE) should be fine, and should have only one child turret, even though it will have more than one in the editor.

      Originally posted by LeFxGuy View Post
      To be honest with you guys, I really appreciate what you are doing for the community and I know this must be a lot! of work, but for the future I think it would be nice if you could have an eye on the accompanying thread for further help as the other thread didn't get a lot of attention by both of you. (Of course there was GDC etc. so nothing personal and I hope you take my opinion in a neutral way)
      We do attempt to stay on top of threads, but some posts may fall through the cracks, or may be addressed by other people like community members or other Epic staff. We'll see if we can improve that. Thanks for your feedback!

      Comment


        #4
        The source code from the stream is now available for download! Here's a link to the thread:

        https://forums.unrealengine.com/show...016-livestream

        Comment


          #5
          it would be nice if you show how each part of code affects the tank(or game) instead of just typing the code and with a little explain on what it does , and after everything is done then showing the game.
          its a little unclear for people like me who not familiar with C++ coding in UE . for me this part 2 was more like reading a documentation instead of watching a video tutorial.

          thanks
          Last edited by Siahpoosh; 05-02-2016, 04:48 PM.

          Comment


            #6
            I've had a ton of issues with this, but I eventually found out that my blueprints weren't updating after changing the C++ files they derived from, which led to empty details panels on some components and various Static/Movable mismatch errors.

            The only way I've found to update them is to change the parent to something basic like Actor, then back to Tank/Turret, which resets it as if I just created a brand new Blueprint. so have to re-set the sprites/rotations etc.



            Also, not sure if it was really needed, but I also followed a workaround posted in an Answerhub post for the ChildActor parenting issue which suggested to set the Child Actor in Construction Script instead of the Component details panel.



            After this, all was well in the world!

            Last edited by KWS; 06-07-2016, 08:26 PM.

            Comment


              #7
              Hi,

              I'm trying to follow along with the tutorial but I'm stuck at the USTRUCT part. I'm using Engine 4.17 while this was designed to work with 4.10 so I know there will be changes.

              I keep getting the below errors:

              CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(19) : LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. TankInput.MovementInput
              CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(75) : LogCompile: Error: Type 'FTankInput' is not supported by blueprint. Tank.TankInput
              CompilerResultsLog: Error: UnrealHeaderTool failed for target 'TanksEditor' (platform: Win64, module info: D:\UE4\Projects\Tanks\Intermediate\Build\Win64\TanksEditor\Development\TanksEditor.uhtmanifest, exit code: OtherCompilationError (5)).

              And the Code I have for the struct is:

              Code:
              USTRUCT()
              struct FTankInput
              {
                  GENERATED_BODY()
              
              public:
                  // Sanitized movement input, usable for game logic.
                  UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Tank Input")
                      FVector2D MovementInput;
              
                  void Sanitize();
                  void MoveX(float AxisValue);
                  void MoveY(float AxisValue);
              
              private:
                  // Private because it's internal, raw data. Game code should never see this.
                  FVector2D RawMovementInput;
              };
              I've tried to go ahead to see if something changed later on in the tutorials but I am unable to find this issue. Everything I've searched for just returns that the UPROPERTY needs to be editable in the Blueprint, so I've tried to change "BlueprintReadOnly" to "BlueprintReadWrite".

              Comment


                #8
                Originally posted by ChappyOak View Post
                Hi,

                I'm trying to follow along with the tutorial but I'm stuck at the USTRUCT part. I'm using Engine 4.17 while this was designed to work with 4.10 so I know there will be changes.

                I keep getting the below errors:

                CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(19) : LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. TankInput.MovementInput
                CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(75) : LogCompile: Error: Type 'FTankInput' is not supported by blueprint. Tank.TankInput
                CompilerResultsLog: Error: UnrealHeaderTool failed for target 'TanksEditor' (platform: Win64, module info: D:\UE4\Projects\Tanks\Intermediate\Build\Win64\TanksEditor\Development\TanksEditor.uhtmanifest, exit code: OtherCompilationError (5)).
                Hey, ChappyOak! You're right some changes have taken place that affect this code. USTRUCTS that you wish to use as UPROPERTIES must now be BlueprintTypes. So you just need to change this part of your code:

                Code:
                USTRUCT()
                struct FTankInput
                To this:

                Code:
                USTRUCT(BlueprintType)
                struct FTankInput
                That change came about in 4.17, I think, or maybe 4.16, which is why this was fine in 4.10. That should get it working for you. I'll update the source file when I get a chance. Thanks for watching and posting!

                EDIT: On attempting this myself, there's one other change that must be made before this will compile. The UArrowComponent's header file, Runtime/Engine/Classes/Components/ArrowComponent.h, should be included in Tank.h. This will be in the source code update that I post in the next few minutes.

                Here is the 4.17 version: https://epicgames.box.com/s/4cft45vr...9y4fazeu2lf9u2

                I can't post it up top because Alexander Paschall made that post, but I'll leave the link here for now until I can talk to the Community team about it.
                Last edited by Richard Hinckley; 09-28-2017, 10:02 AM. Reason: New download link

                Comment


                  #9
                  Richard, I made those changes and the errors I have listed were solved but now I have some other errors. I've tried to recreate the project with your source code to remove them, but they still remain. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\TanksGameMode.cpp(1) : error: Expected TanksGameMode.h to be first header included. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\TankStatics.cpp(1) : error: Expected TankStatics.h to be first header included. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\Turret.cpp(1) : error: Expected Turret.h to be first header included. So I changed these lines to reflect the order required. I'm currently investigating the errors that followed, as they may be a result from some setting or lack of.

                  Comment


                    #10
                    My turret always appears to aim directly 90 degrees to the left of the mouse location. I saw another post with the same issue, but can't seem to find a link for it anymore.

                    Does anyone know what's going on here?

                    Comment


                      #11
                      Originally posted by DJRD4465 View Post
                      My turret always appears to aim directly 90 degrees to the left of the mouse location. I saw another post with the same issue, but can't seem to find a link for it anymore.

                      Does anyone know what's going on here?

                      I have the same problem. My turret is aiming 90 degrees to the left of my mouse location. There was another similar post with an answer, but the answer doesn't seem to work.

                      Comment


                        #12
                        This is a great tutorial, but I'm having a little trouble with the third stream. I'm my Turret.h I have forward declared ATanksVsZombies but it is giving me this error: 2>D:/UnrealEngine/Projects/TanksVsZombies/Source/TanksVsZombies/Turret.h(31): error : Unrecognized type 'ATanksVsZombies' - type must be a UCLASS, USTRUCT or UENUM
                        Any help would be great! Thank you!
                        For those looking to earn a little money from home during this virus, or any time really: https://www.swagbucks.com/lp-savings...extRb=69551109 A free $3 when you sign up!

                        Comment


                          #13
                          My tank seems to move fine but it gets stuck after a short while.

                          Comment


                            #14
                            Camera problems:

                            This does not work for me I got the same initial results as until 23:00 but the camera is still off - it is not pointing to the ground but "backwards":

                            Click image for larger version  Name:	Tankcam1.png Views:	0 Size:	108.9 KB ID:	1720249

                            Click image for larger version  Name:	Tankcam2.png Views:	0 Size:	146.9 KB ID:	1720250





                            Solution - I had to remake this using blueprints and found that you need to use this line:
                            CameraComponent->SetWorldRotation(FRotator(0.0f, 0.0f, 0.0f));

                            That is there should be no -90 rotation on the Camera?




                            Problems with FVector2D MovementInput;?

                            You are getting these errors:
                            ..../Tank.h(19) : LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. TankInput.MovementInput
                            .../Tank.h(80) : LogCompile: Error: Type 'FTankInput' is not supported by blueprint. Tank.TankInput




                            // Manage Input
                            USTRUCT(BlueprintType)
                            struct FTankInput
                            {
                            GENERATED_BODY()

                            public:

                            UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Tank Input")
                            FVector2D MovementInput;



                            For some reason BlueprintType is needed now, was not when this tutorial was done?
                            Last edited by AssetDK; 02-12-2020, 09:06 AM.

                            Comment

                            Working...
                            X