Announcement

Collapse
No announcement yet.

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

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

    hi mr looman,i've got a problem,EpicSurvivalGameSeries\SurvivalGame\Binaries\Win64,there is not a UE4Editor-SurvivalGame.dll
    while rebuild from vs2017,the issue:

    1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(55): error C2027: 使用了未定义类型“ASWeapon”
    1>C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Intermediate\Build\Win64\UE4Editor\Inc\SurvivalGame\SCharacter.generated.h(11): note: 参见“ASWeapon”的声明
    1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(54): note: 编译 类 模板 成员函数 "UClass *TSubclassOf<ASWeapon>:perator *(void) const" 时
    1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(77): note: 参见对正在编译的函数 模板 实例化“UClass *TSubclassOf<ASWeapon>:perator *(void) const”的引用
    1>C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Source\SurvivalGame\Private\World\SGameMode.cpp(385): note: 参见对正在编译的 类 模板 实例化 "TSubclassOf<ASWeapon>" 的引用
    1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(55): error C3861: “StaticClass”: 找不到标识符
    1>ERROR : UBT error : Failed to produce item: C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Binaries\Win64\UE4Editor-SurvivalGame.dll
    1>Total build time: 2.78 seconds (Local executor: 0.00 seconds)
    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: 命令“E:\unrealEngin\UE_4.18\Engine\Build\BatchFiles\Build.bat SurvivalGameEditor Win64 Development "C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\SurvivalGame.uproject" -waitmutex”已退出,代码为 5。请验证您是否拥有运行此命令的足够权限。
    how can i solve it .. is it about hot reload? i hope you can have a look..

    Comment


      I just found this project the other day, it looks a very promising start for building this type of game. I haven't had time to go through everything in detail yet, but would there be any interaction with a database to get a game like this to work? Would it be a situation where once the Unreal dedicated server went down (or crashed) all the world/player data would be lost and players would have to start anew in a fresh world?

      For example, if players had professions and they need to build up their skill to get access to more items. Maybe the player is level 10 out of 100 for First Aid. They login, advance to level 20 First Aid, then log out. Without a database would all of this would just be sitting in server memory?

      Any elaboration on how the database fits into the picture for a game like this would be greatly appreciated!

      Comment


        Originally posted by dasshr View Post
        hi mr looman,i've got a problem,EpicSurvivalGameSeries\SurvivalGame\Binaries\Win64,there is not a UE4Editor-SurvivalGame.dll
        while rebuild from vs2017,the issue:

        1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(55): error C2027: 使用了未定义类型“ASWeapon”
        1>C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Intermediate\Build\Win64\UE4Editor\Inc\SurvivalGame\SCharacter.generated.h(11): note: 参见“ASWeapon”的声明
        1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(54): note: 编译 类 模板 成员函数 "UClass *TSubclassOf<ASWeapon>:perator *(void) const" 时
        1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(77): note: 参见对正在编译的函数 模板 实例化“UClass *TSubclassOf<ASWeapon>:perator *(void) const”的引用
        1>C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Source\SurvivalGame\Private\World\SGameMode.cpp(385): note: 参见对正在编译的 类 模板 实例化 "TSubclassOf<ASWeapon>" 的引用
        1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(55): error C3861: “StaticClass”: 找不到标识符
        1>ERROR : UBT error : Failed to produce item: C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Binaries\Win64\UE4Editor-SurvivalGame.dll
        1>Total build time: 2.78 seconds (Local executor: 0.00 seconds)
        1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: 命令“E:\unrealEngin\UE_4.18\Engine\Build\BatchFiles\Build.bat SurvivalGameEditor Win64 Development "C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\SurvivalGame.uproject" -waitmutex”已退出,代码为 5。请验证您是否拥有运行此命令的足够权限。
        how can i solve it .. is it about hot reload? i hope you can have a look..
        you really should translate your log to english so we can give you some kind of feedback.

        Comment


          Hello, I have followed the tutorial series and it worked great for a base, I have made a few changes but after I updated the project from UE 4.18.3 to 4.19.0 the engine and VS2017pro spit out errors about setting a class as Native. The file in question is the SGameMode.cpp to which I have made no changes. I have spent about 3 days now searching the HUB for any info on a change to the engine that would hide/remove the ability to set a function as Native. If someone would be so kind as to point me in the right direction for info on how to rework this to compile in 4.19 it would be greatly appreciated.

          here is the block throwing the error - Native undeclared identifier and ASGameMode uses non-stanard syntax use '&' to create pointer member.

          void ASGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
          {
          // HACK: workaround to inject CheckRelevance() into the BeginPlay sequence
          UFunction* Func = AActor::GetClass()->FindFunctionByName(FName(TEXT("ReceiveBeginPlay")));
          Func->FunctionFlags |= FUNC_Native;
          Func->SetNativeFunc((Native)&ASGameMode::BeginPlayMutatorHack);

          /* Spawn all mutators. */
          for (int32 i = 0; i < MutatorClasses.Num(); i++)
          {
          AddMutator(MutatorClasses[i]);
          }

          if (BaseMutator)
          {
          BaseMutator->InitGame(MapName, Options, ErrorMessage);
          }

          Super::InitGame(MapName, Options, ErrorMessage);
          }

          Thanks in advance.

          Comment


            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.

            Error:
            Click image for larger version

Name:	UnableToOpen1.png
Views:	2
Size:	25.4 KB
ID:	1484480

            Log during Rebuild (best screenshot I could get as it happens within 1sec):
            Click image for larger version

Name:	UnableToOpen2.png
Views:	1
Size:	66.4 KB
ID:	1484479

            Failure:
            Click image for larger version

Name:	UnableToOpen3.png
Views:	1
Size:	12.1 KB
ID:	1484478

            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

            Attached Files

            Comment


              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.
              Say yes.
              Then find all the mod references and remove them or work on trying to upgrade them to 4.19. I'm going to revisit modding later but this got me started.

              Comment


                I am able to compile the code with no problem, but when i try to edit the game mode...

                Lets say all i did was added one line with 0 code and i get errors... please review images... image one is normal code from github complie works fine.. image two is one line added with tons of errors..how does this happen? I tried reinstalling VS,,, generating project files again...
                Attached Files

                Comment


                  This is due to how UE4 merges cpp files before compile, adding empty line changes timestamp of gamemode, and sudenly there is include missing, just add #include "BehaviorTreeComponent.h" after #include "SMutator.h" and it will compile ...

                  Comment


                    I am using 4.19.. now looks like i have this error. ..also added "#include "BehaviorTree/BehaviorTreeComponent.h"" in the SGameMode.h
                    Attached Files
                    Last edited by skeetaseasonTV; 06-25-2018, 03:54 AM.

                    Comment


                      Anybody

                      Comment


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



                        Comment


                          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.

                          Comment


                            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!

                            Comment


                              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.

                              Comment


                                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?

                                Comment

                                Working...
                                X