Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreal Example #2217

Closed
purp1ehk opened this issue Aug 10, 2021 · 11 comments
Closed

Unreal Example #2217

purp1ehk opened this issue Aug 10, 2021 · 11 comments
Labels
area/examples Examples. Usually found in the `examples` directory help wanted We would love help on these issues. Please come help us! kind/feature New features for Agones stale Pending closure unless there is a strong objection.

Comments

@purp1ehk
Copy link

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.

@markmandel markmandel changed the title Is there example for unreal? Unreal Example Aug 10, 2021
@markmandel
Copy link
Collaborator

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 markmandel added area/examples Examples. Usually found in the `examples` directory help wanted We would love help on these issues. Please come help us! kind/design Proposal discussing new features / fixes and how they should be implemented kind/feature New features for Agones and removed kind/design Proposal discussing new features / fixes and how they should be implemented labels Aug 10, 2021
@purp1ehk
Copy link
Author

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
Copy link
Author

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?

@markmandel
Copy link
Collaborator

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

@WilSimpson
Copy link
Contributor

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
Copy link
Contributor

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.

@purp1ehk
Copy link
Author

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

@markmandel
Copy link
Collaborator

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?)

@WilSimpson
Copy link
Contributor

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

@github-actions
Copy link

'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 github-actions bot added the stale Pending closure unless there is a strong objection. label Sep 15, 2023
@markmandel
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/examples Examples. Usually found in the `examples` directory help wanted We would love help on these issues. Please come help us! kind/feature New features for Agones stale Pending closure unless there is a strong objection.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants