googleforgames / agones

Dedicated Game Server Hosting and Scaling for Multiplayer Games on Kubernetes
https://agones.dev
Apache License 2.0
5.91k stars 778 forks source link

Agones SDK for Unity Client Server example #3641

Open wowSheldon opened 4 months ago

wowSheldon commented 4 months ago

What happened: Encountering compilation errors in the Agones SDK Unity example (release 1.38) with Unity Editor version 2023.2.9f1 on Windows 11. Despite attempting to use Unity Editor version 2018.4.12f1 as recommended in the Agones SDK documentation for Unity, compilation errors persist with the latest Unity installation on Windows 11.

What you expected to happen: Expecting successful compilation with the official latest released version of the Unity editor on Windows 11 and the ability to run the example as expected, considering the SDK's support for Unity.

How to reproduce it (as minimally and precisely as possible): Attempt to run the Agones SDK Unity example on the official latest released version of the Unity editor on Windows 11.

Anything else we need to know?:

Environment: Since we are talking about compilation issue following environment variables are not NA.

markmandel commented 4 months ago

Is this the same as https://github.com/googleforgames/agones/issues/2800 ? Also - can you share what the compilation errors are?

The Unity plugin unfortunately is tested manually, because licencing (yay lawyercats), so it can definitely fall out of date. Any extra help you can provide here is appreciated.

markmandel commented 4 months ago

As an aside: https://github.com/mbychkowski/agones/tree/example/unity-netcode/examples/unity-netcode does exist, although still needs to be pulled into it's own repo

@mbychkowski not sure if you would be interested in helping update our basic example? or @wowSheldon that would also be appreciated!

wowSheldon commented 4 months ago

Hi Mark,

Thank you for your swift response.

Below are the compilation errors encountered for both Unity Editor 2018.4.12f1 and 2023.2.9f1. I'm exploring the integration with Unity and Mirror networking, so it's possible that the issues align with #2800.

Additionally, it's worth noting that the latest 2023 version of Unity opens in safe mode to address compilation errors before fully loading the project. While I attempted to resolve these errors, it resulted in the emergence of more issues (given my limited expertise in C#). Unfortunately, I may not be able to provide substantial assistance with the project at this time.

Your help is appreciated.

Here are the compilation errors from Unity Editor version 2023.2.9f1: Note: All errors are mentioning semicolon expected but once you add that it leads to further errors

Output

Assets\Scripts\Agones\AgonesSdk.cs(1,39): error CS1002: ; expected

Assets\Scripts\Agones\model\GameServer.cs(1,49): error CS1002: ; expected

Assets\Scripts\Agones\model\GameServerObjectMeta.cs(1,59): error CS1002: ; expected

Assets\Scripts\Agones\model\GameServerSpec.cs(1,53): error CS1002: ; expected

Assets\Scripts\Agones\model\GameServerStatus.cs(1,55): error CS1002: ; expected

Assets\Scripts\Agones\model\SpecHealth.cs(1,49): error CS1002: ; expected

Assets\Scripts\Agones\third_party\MiniJSON.cs(1,53): error CS1002: ; expected

Here are the compilation errors from Unity Editor version 2018.4.12f1, as recommended in the Agones SDK documentation for Unity:

-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e) Copyright (C) Microsoft Corporation. All rights reserved.

Assets\Scripts\Agones\model\GameServer.cs(1,47): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\AgonesSdk.cs(1,37): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServerObjectMeta.cs(1,57): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServer.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServer.cs(1,23): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\AgonesSdk.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerObjectMeta.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServer.cs(1,29): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServer.cs(1,35): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\AgonesSdk.cs(1,20): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServer.cs(1,19): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServerObjectMeta.cs(1,23): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\AgonesSdk.cs(1,26): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\AgonesSdk.cs(1,16): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServerObjectMeta.cs(1,29): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerObjectMeta.cs(1,35): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerObjectMeta.cs(1,19): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServerSpec.cs(1,51): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServerSpec.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerSpec.cs(1,23): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerSpec.cs(1,29): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerSpec.cs(1,35): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerSpec.cs(1,19): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServerStatus.cs(1,53): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\GameServerStatus.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerStatus.cs(1,23): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerStatus.cs(1,29): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerStatus.cs(1,35): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\GameServerStatus.cs(1,19): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\SpecHealth.cs(1,47): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\StatusPort.cs(1,47): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\third_party\MiniJSON.cs(1,51): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\model\StatusPort.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\SpecHealth.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\StatusPort.cs(1,23): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\SpecHealth.cs(1,23): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\third_party\MiniJSON.cs(1,1): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\StatusPort.cs(1,29): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\SpecHealth.cs(1,29): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\StatusPort.cs(1,35): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\SpecHealth.cs(1,35): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\StatusPort.cs(1,19): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\third_party\MiniJSON.cs(1,23): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\model\SpecHealth.cs(1,19): error CS0116: A namespace cannot directly contain members such as fields or methods Assets\Scripts\Agones\third_party\MiniJSON.cs(1,29): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\third_party\MiniJSON.cs(1,41): error CS1022: Type or namespace definition, or end-of-file expected Assets\Scripts\Agones\third_party\MiniJSON.cs(1,19): error CS0116: A namespace cannot directly contain members such as fields or methods -----CompilerOutput:-stderr---------- -----EndCompilerOutput---------------

mbychkowski commented 4 months ago

As an aside: https://github.com/mbychkowski/agones/tree/example/unity-netcode/examples/unity-netcode does exist, although still needs to be pulled into it's own repo

@markmandel thanks for linking to this. I've since pulled it into a separate repository: https://github.com/mbychkowski/unity-netcode-agones

@mbychkowski not sure if you would be interested in helping update our basic example?

Is there an issue for this to work off of? Happy to take a look to see what needs to be updated here.

markmandel commented 4 months ago

@markmandel thanks for linking to this. I've since pulled it into a separate repository: https://github.com/mbychkowski/unity-netcode-agones

Oh nice, we should link in https://agones.dev/site/docs/third-party-content/examples/ ! 👍🏻

Is there an issue for this to work off of? Happy to take a look to see what needs to be updated here.

This is the issue 😄

mbychkowski commented 4 months ago

@wowSheldon I am linking this issue to the repository directory. Since I think it might be out of the scope for this Agones repository. Unfortunately, I have not been able to test this solution myself on Windows. I will try to get around to test this.

we can limit this issue to the basic unity example.

Were you able to resolve the issue of running this locally mentioned in https://github.com/googleforgames/agones/issues/3641#issuecomment-1941538642? And now working on a deployment to Kubernetes?

As far as next steps you will need to push your build image to a repository if you plan on having a cluster in the cloud. The unity-netcode-example uses Artifact Registry, but you can use Docker Hub or any other repository as long as your Kubernetes cluster has access to pull images from. If you are still testing all this locally, there are some resources on running Mini Kube

markmandel commented 4 months ago

So I'm going to step in here with my contributor hat 👷🏻 on and put a polite end to the back and forth -- this bug is about an issue with compilation of the Unity example, so let's please keep it on topic.

GitHub issues aren't for general back and forth and education - if you wish to continue the discussion, may I suggest either heading over the example repository in question, taking advantage of the Agones community resources, and/or taking some time to go through Prerequisite Knowledge documentation section to get comfortable with the foundational technologies.

Thanks!

wowSheldon commented 4 months ago

OK Thank you Mark. Closing the issue as there are no compilation issues with Netcode example.

markmandel commented 4 months ago

Reopening, as there is still an issue with our other Unity example, that we should definitely fix.