agones icon indicating copy to clipboard operation
agones copied to clipboard

Unreal Example

Open purp1ehk opened this issue 3 years ago • 9 comments

is there example for unreal? just try to follow https://agones.dev/site/docs/guides/client-sdks/unreal/ but ERROR: Unable to compile source files.

purp1ehk avatar Aug 10 '21 11:08 purp1ehk

Changing the title to "Unreal Example", as we've been talking about having one for a long time, see #927

The biggest issue (as I understand it) is that it's hard to make a small example with Unreal without having a full blown project.

If there is a specific error you are encountering with the current Unreal SDK, please provide full reproduction steps, engine version and OS, and error logs. There are several people using it in production, so they will likely be to help you.

markmandel avatar Aug 10 '21 17:08 markmandel

Thanks for reply My step as follow

my project name is "tt2mobile 4.26"

i copy the folder agones/sdks/unreal/Agones to tt2mobile 4.26/Plugins/

edit tt2mobile 4.26\Source\tt2mobileServer.Target.cs

as follow // Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool; using System.Collections.Generic;

public class tt2mobileServerTarget : TargetRules { //public tt2mobileTarget(TargetInfo Target) public tt2mobileServerTarget(TargetInfo Target):base(Target) { Type = TargetType.Server; DefaultBuildSettings = BuildSettingsVersion.V2; ExtraModuleNames.Add("tt2mobile"); PublicDependencyModuleNames.AddRange(new[]{"Agones"});

}

}

try to generate VS file project the error message as follow.

Running G:/EpicGames/UnrealEngine-4.26/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project="K:/Epic Games/project/tt2mobile 4.26/tt2mobile.uproject" -game -engine -progress -log="K:\Epic Games\project\tt2mobile 4.26/Saved/Logs/UnrealVersionSelector-2021.08.18-21.45.15.log" Discovering modules, targets and source code for project... While compiling K:\Epic Games\project\tt2mobile 4.26\Intermediate\Build\BuildRules\tt2mobileModuleRules.dll: k:\Epic Games\project\tt2mobile 4.26\Source\tt2mobile.Target.cs(13,3) : error CS0103: ?W?? 'PublicDependencyModuleNames' ???s?b???ثe???e?? k:\Epic Games\project\tt2mobile 4.26\Source\tt2mobileServer.Target.cs(14,3) : error CS0103: ?W?? 'PublicDependencyModuleNames' ???s?b???ثe???e?? ERROR: Unable to compile source files.

i don't know what i missed.

purp1ehk avatar Aug 18 '21 13:08 purp1ehk

the another thing i have tried is to use TSharedRef to call "http://localhost:9358/health"

TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest(); FString Url = "http://localhost:9358/health"; Request->SetContentAsString("{}"); Request->SetURL(Url); Request->SetVerb("POST"); Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent"); Request->SetHeader("Content-Type", TEXT("application/json")); UE_LOG(LogTemp, Warning, TEXT(" Common::OnRequestProgress start %s"), *Url); Request->OnRequestProgress().BindStatic([](FHttpRequestPtr request, int32 bytesSent, int32 bytesReceived) { UE_LOG(LogTemp, Warning, TEXT(" Common::OnRequestProgress ")); });

It still keep status scheduled.

above method should be work or not?

purp1ehk avatar Aug 18 '21 13:08 purp1ehk

@domgreen @highlyunavailable - any chance you can help out here? This is above my pay grade 😄

markmandel avatar Aug 18 '21 17:08 markmandel

You don't add the dependency to your Target file, you add the dependency to your Build file. You build file will be at k:\Epic Games\project\tt2mobile 4.26\Source\tt2mobile\tt2mobile.Build.cs

WilSimpson avatar Aug 19 '21 02:08 WilSimpson

Also, the health request is handled by the Plugin. You simply need to create an instance of Agones with

AgonesSDK = CreateDefaultSubobject<UAgonesComponent>(TEXT("AgonesSDK"));

As outlined in the documentation. It is recommended to do so within your GameMode class on initialization. Then, by default when the component is initialized, it will establish a connection with the sidecar automatically. If you're curious how the requests are made, you can review the UAgonesComponent::BuildAgonesRequest which initializes a request for Agones.

WilSimpson avatar Aug 19 '21 02:08 WilSimpson

Thanks your reply i did what you suggest and got it work now. ^^

purp1ehk avatar Aug 22 '21 06:08 purp1ehk

If you are able / willing to provide a lightweight Unreal example, would also be appreciative! (I know zilch about Unreal, so I'm not sure if this is possible?)

markmandel avatar Aug 24 '21 20:08 markmandel

I've been extremely busy but I'll get one as light weight as possible. The problem with an example is it really doesn't do anything the documentation doesn't illustrate and the implementation is hidden behind code that isn't relevant to Agones. However, it seems it's helpful for people for their personal reasons so I can get those done relatively fast

WilSimpson avatar Aug 26 '21 16:08 WilSimpson

'This issue is marked as Stale due to inactivity for more than 30 days. To avoid being marked as 'stale' please add 'awaiting-maintainer' label or add a comment. Thank you for your contributions '

github-actions[bot] avatar Sep 15 '23 10:09 github-actions[bot]

We actually have this now (https://github.com/googleforgames/global-multiplayer-demo), and we have a link to it in our documentation section, so I'm going to close this ticket.

markmandel avatar Sep 15 '23 17:09 markmandel