664235822 / MultiShootGame

虚幻4制作的多人在线射击对战游戏
GNU General Public License v3.0
17 stars 7 forks source link

encountering a compile error when complie the project in ue5 and vs2022, and also ue4 vs2022 #1

Open chenmozxh opened 1 year ago

chenmozxh commented 1 year ago

when i double click uproject, a window pop up: MultiShootGames could not be compiled, Try rebuilding from source manually. i compile in vs2022, the error is:

Build started... 1>------ Build started: Project: MultiShootGame, Configuration: Development_Editor x64 ------ 1>Using bundled DotNet SDK 1>Log file: C:\Users\xxx\AppData\Local\UnrealBuildTool\Log.txt 1>Using 'git status' to determine working set for adaptive non-unity build (D:\MultiShootGame). 1>Creating makefile for MultiShootGameEditor (no existing makefile) 1>Parsing headers for MultiShootGameEditor 1> Running UnrealHeaderTool "D:\MultiShootGame\MultiShootGame.uproject" "D:\MultiShootGame\Intermediate\Build\Win64\MultiShootGameEditor\Development\MultiShootGameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\xxx\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed 1>Reflection code generated for MultiShootGameEditor in 6.0800228 seconds 1>Waiting for 'git status' command to complete 1>Terminating git child process due to timeout 1>Building MultiShootGameEditor... 1>Using Visual Studio 2022 14.32.31332 toolchain (D:\Microsoft\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326) and Windows 10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10). 1>Determining max actions to execute in parallel (10 physical cores, 12 logical cores) 1> Executing up to 10 processes, one per physical core 1> Requested 1.5 GB free memory per action, 2.97 GB available: limiting max parallel actions to 1 1>Building 7 actions with 1 process... 1>[1/7] Compile SharedPCH.Engine.ShadowErrors.cpp 1>[2/7] Resource Default.rc2 1>[3/7] Compile Module.MultiShootGame.gen.cpp 1>[4/7] Compile Module.MultiShootGame.cpp 1>D:\MultiShootGame\Source\MultiShootGame\GameMode\MultiShootGameGameMode.cpp(93): warning C4996: 'UWorld::GetPawnIterator': The PawnIterator is an inefficient mechanism for iterating pawns. Please use TActorIterator instead. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile. 1>D:\Epic Games\UE_5.0\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.h(33): error C2760: syntax error: '::' was unexpected here; expected 'id-expression'

hoping your reply and help, thx

664235822 commented 1 year ago

WIndowsRunnableTHread.h file has some code error,there is my WindowsRunnableThread.h file in ue 4.27, please check out. // Copyright Epic Games, Inc. All Rights Reserved.

pragma once

include "CoreTypes.h"

include "HAL/PlatformProcess.h"

include "Containers/StringConv.h"

include "HAL/Event.h"

include "HAL/Runnable.h"

include "HAL/RunnableThread.h"

include "HAL/ThreadManager.h"

include "CoreGlobals.h"

include "Windows/WindowsHWrapper.h"

include "HAL/LowLevelMemTracker.h"

class FRunnable;

/**

public:

FRunnableThreadWin( )
    : Thread(NULL)
{}

~FRunnableThreadWin( )
{
    // Clean up our thread if it is still active
    if (Thread != NULL)
    {
        Kill(true);
    }
}

static int TranslateThreadPriority(EThreadPriority Priority)
{
    switch (Priority)
    {
    case TPri_AboveNormal: return THREAD_PRIORITY_HIGHEST;
    case TPri_Normal: return THREAD_PRIORITY_HIGHEST - 1;
    case TPri_BelowNormal: return THREAD_PRIORITY_HIGHEST - 3;
    case TPri_Highest: return THREAD_PRIORITY_HIGHEST;
    case TPri_TimeCritical: return THREAD_PRIORITY_HIGHEST;
    case TPri_Lowest: return THREAD_PRIORITY_HIGHEST - 4;
    case TPri_SlightlyBelowNormal: return THREAD_PRIORITY_HIGHEST - 2;
    default: UE_LOG(LogHAL, Fatal, TEXT("Unknown Priority passed to TranslateThreadPriority()")); return TPri_Normal;
    }
}

virtual void SetThreadPriority( EThreadPriority NewPriority ) override
{
    // Don't bother calling the OS if there is no need
        ThreadPriority = NewPriority;
        // Change the priority on the thread
        ::SetThreadPriority(Thread, TranslateThreadPriority(ThreadPriority));
    }

virtual void Suspend( bool bShouldPause = true ) override
{
    check(Thread);
    if (bShouldPause == true)
    {
        SuspendThread(Thread);
    }
    else
    {
        ResumeThread(Thread);
    }
}

virtual bool Kill( bool bShouldWait = false ) override
{
    check(Thread && "Did you forget to call Create()?");
    bool bDidExitOK = true;
    // Let the runnable have a chance to stop without brute force killing
    if (Runnable)
    {
        Runnable->Stop();
    }
    // If waiting was specified, wait the amount of time. If that fails,
    // brute force kill that thread. Very bad as that might leak.
    if (bShouldWait == true)
    {
        // Wait indefinitely for the thread to finish.  IMPORTANT:  It's not safe to just go and
        // kill the thread with TerminateThread() as it could have a mutex lock that's shared
        // with a thread that's continuing to run, which would cause that other thread to
        // dead-lock.  (This can manifest itself in code as simple as the synchronization
        // object that is used by our logging output classes.  Trust us, we've seen it!)
        WaitForSingleObject(Thread,INFINITE);
    }
    // Now clean up the thread handle so we don't leak
    CloseHandle(Thread);
    Thread = NULL;

    return bDidExitOK;
}

virtual void WaitForCompletion( ) override
{
    // Block until this thread exits
    WaitForSingleObject(Thread,INFINITE);
}

protected:

virtual bool CreateInternal( FRunnable* InRunnable, const TCHAR* InThreadName,
    uint32 InStackSize = 0,
    EThreadPriority InThreadPri = TPri_Normal, uint64 InThreadAffinityMask = 0,
    EThreadCreateFlags InCreateFlags = EThreadCreateFlags::None) override
{
    static bool bOnce = false;
    if (!bOnce)
    {
        bOnce = true;
        ::SetThreadPriority(::GetCurrentThread(), TranslateThreadPriority(TPri_Normal)); // set the main thread to be normal, since this is no longer the windows default.
    }

    check(InRunnable);
    Runnable = InRunnable;
    ThreadAffinityMask = InThreadAffinityMask;

    // Create a sync event to guarantee the Init() function is called first
    ThreadInitSyncEvent = FPlatformProcess::GetSynchEventFromPool(true);

    ThreadName = InThreadName ? InThreadName : TEXT("Unnamed UE4");
    ThreadPriority = InThreadPri;

    // Create the new thread
    {
        LLM_SCOPE(ELLMTag::ThreadStack);
        LLM_PLATFORM_SCOPE(ELLMTag::ThreadStackPlatform);
        // add in the thread size, since it's allocated in a black box we can't track
        LLM(FLowLevelMemTracker::Get().OnLowLevelAlloc(ELLMTracker::Default, nullptr, InStackSize));
        LLM(FLowLevelMemTracker::Get().OnLowLevelAlloc(ELLMTracker::Platform, nullptr, InStackSize));

        // Create the thread as suspended, so we can ensure ThreadId is initialized and the thread manager knows about the thread before it runs.
        Thread = CreateThread(NULL, InStackSize, _ThreadProc, this, STACK_SIZE_PARAM_IS_A_RESERVATION | CREATE_SUSPENDED, (DWORD *)&ThreadID);
    }

    // If it fails, clear all the vars
    if (Thread == NULL)
    {
        Runnable = nullptr;
    }
    else
    {
        ResumeThread(Thread);

        // Let the thread start up
        ThreadInitSyncEvent->Wait(INFINITE);

        ThreadPriority = TPri_Normal; // Set back to default in case any SetThreadPrio() impls compare against current value to reduce syscalls
        SetThreadPriority(InThreadPri);
    }

    // Cleanup the sync event
    FPlatformProcess::ReturnSynchEventToPool(ThreadInitSyncEvent);
    ThreadInitSyncEvent = nullptr;
    return Thread != NULL;
}

};

664235822 commented 1 year ago

Delete '::' symbol in front of DWORD, this file has two errors of this type

chenmozxh commented 1 year ago

**yes after deleting two "::", the project sucessfully compiled, also in UE5 with vs2022, I can package the project to development and MultiShootGame, and i test the game, it works

but i cannot package the project to MultiShootGameServer. I encounter the output log:**

UATHelper: Packaging (Windows): ** BUILD COMMAND STARTED ** UATHelper: Packaging (Windows): Running: D:\Epic Games\UE_5.0\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe MultiShootGameServer Win64 Shipping -Project=D:\MultiShootGame\MultiShootGame.uproject -Clean -NoHotReload D:\MultiShootGame\MultiShootGame.uproject -NoUBTMakefiles -remoteini="D:\MultiShootGame" -skipdeploy -distribution -nobuilduht -log="C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping.txt" UATHelper: Packaging (Windows): Log file: C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping.txt UATHelper: Packaging (Windows): Cleaning MultiShootGameServer binaries... UATHelper: Packaging (Windows): Took 1.0920757s to run UnrealBuildTool.exe, ExitCode=0 UATHelper: Packaging (Windows): Running: D:\Epic Games\UE_5.0\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe MultiShootGameServer Win64 Shipping -Project=D:\MultiShootGame\MultiShootGame.uproject D:\MultiShootGame\MultiShootGame.uproject -NoUBTMakefiles -remoteini="D:\MultiShootGame" -skipdeploy -distribution -Manifest=D:\MultiShootGame\Intermediate\Build\Manifest.xml -NoHotReload -log="C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping_2.txt" UATHelper: Packaging (Windows): Log file: C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping_2.txt UATHelper: Packaging (Windows): ERROR: Server targets are not currently supported from this engine distribution. PackagingResults: Error: Server targets are not currently supported from this engine distribution. UATHelper: Packaging (Windows): Took 1.6788214000000001s to run UnrealBuildTool.exe, ExitCode=6 UATHelper: Packaging (Windows): UnrealBuildTool failed. See log for more details. (C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping_2.txt) UATHelper: Packaging (Windows): AutomationTool executed for 0h 0m 6s UATHelper: Packaging (Windows): AutomationTool exiting with ExitCode=6 (6) UATHelper: Packaging (Windows): Updating environment variables set by a Turnkey sub-process UATHelper: Packaging (Windows): The system cannot find the path specified. UATHelper: Packaging (Windows): The system cannot find the path specified.

and the content of file C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping_2.txt is **

Log started at 2023/2/16 19:07:23 (2023-02-16T11:07:23Z) No config file at C:\Users\xxx\Documents\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml Configuration will be read from: C:\Users\xxx\AppData\Roaming\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml Log file: C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping_2.txt

Note: Android toolchain NDK r21b recommended Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (1) Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (2) Found Windows 10 SDK version 10.0.19041.0 at C:\Program Files (x86)\Windows Kits\10 Found Universal CRT version 10.0.19041.0 at C:\Program Files (x86)\Windows Kits\10 HoloLens using Manual SDK 10.0.19041.0 Win64 using Manual SDK 10.0.19041.0 Command line: "D:\Epic Games\UE_5.0\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" MultiShootGameServer Win64 Shipping -Project=D:\MultiShootGame\MultiShootGame.uproject D:\MultiShootGame\MultiShootGame.uproject -NoUBTMakefiles -remoteini=D:\MultiShootGame -skipdeploy -distribution -Manifest=D:\MultiShootGame\Intermediate\Build\Manifest.xml -NoHotReload "-log=C:\Users\xxx\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+Games+UE_5.0\UBT-MultiShootGameServer-Win64-Shipping_2.txt" Skipping D:\Epic Games\UE_5.0\Engine\Intermediate\Build\BuildRules\UE5Rules.dll: File is installed Skipping D:\Epic Games\UE_5.0\Engine\Intermediate\Build\BuildRules\UE5ProgramRules.dll: File is installed Found Visual Studio installation: D:\Microsoft\Microsoft Visual Studio\2022\Community (Product=Microsoft.VisualStudio.Product.Community, Version=17.2.32630.192) Found Visual Studio toolchain: D:\Microsoft\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326 (Family=14.32.31326, FamilyRank=1, Version=14.32.31332, Is64Bit=True, Preview=False, Architecture=x64, Error=False, Redist=D:\Microsoft\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326) ERROR: Server targets are not currently supported from this engine distribution. BuildException: Server targets are not currently supported from this engine distribution. at UnrealBuildTool.UEBuildTarget.Create(TargetDescriptor Descriptor, Boolean bSkipRulesCompile, Boolean bForceRulesCompile, Boolean bUsePrecompiled) in D:\Epic Games\UE_5.0\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 735 at UnrealBuildTool.BuildMode.CreateMakefile(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet) in D:\Epic Games\UE_5.0\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 726 at UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile, Boolean bSkipPreBuildTargets) in D:\Epic Games\UE_5.0\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 267 at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) in D:\Epic Games\UE_5.0\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 237 at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\Epic Games\UE_5.0\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 612 WriteFileIfChanged() wrote 0 changed files of 0 requested writes. Timeline:

[ 0.000] 0.000 [ 1.418]

I wonder the reason may be that the storage and C is not enough.

664235822 commented 1 year ago

you should read the MultiShootGame project readme.md, there are some tips you must know. It is Chinese, you should translate it into English

664235822 commented 1 year ago

To view the project source code, download the source version Unreal 4.27 release zip file and use git and Git-lfs to clone the project source code, compile Unreal Engine, and open the game project through the code editor

Note that you cannot open the project using the binary version of Unreal 4.27 downloaded by the Epic Games launcher, which does not compile the server side

Note that you cannot use a later version of Unreal, such as Unreal 5. The later version will have compatibility issues, such as the character walking drift due to the lack of root bone binding

Note that you cannot download the project source code zip package directly, which would lack the project binaries included in git-lfs

Project play, single - player mode can only download the client executable program

To play the project, in multiplayer mode, you need to download the executable program on the server side and the client side, run the bat batch processing file on the server side, enter the server ip address for the online game on the client side, do not enter the port, the default is 7777, and then click Start the game

chenmozxh commented 1 year ago

ok thx, you are very kind. i will try this way

664235822 commented 1 year ago

hahaha, thanks