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

Fix build props and improve docs #419

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

pzhlkj6612
Copy link
Contributor

Hi! I've been trying building YR CnCNet by myself these days and have found something can be improved. Please see the commits for details.

@pzhlkj6612
Copy link
Contributor Author

And I don't know if someone is still using this build props? As I said in CnCNet/xna-cncnet-client#516 (comment), the filename is wrong so the file cannot be picked by the client's props.

@@ -8,7 +8,7 @@ so that the client starts up with the YR theme.
<PropertyGroup>
<!--
Change the value of YRSource to wherever you have the YR client repo checked out OR
you can use your installation path of YR for cncnet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine as is, i think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, @brichardson1991! thank you for reviewing my changes.


Change the value of YRSource to wherever you have the YR client repo checked out OR you can use your installation path of YR for cncnet.

the original sentence sounds a bit odd to my non-native ears. that sentence, i think, means that we have two choices about specifying the path:

  • the one is my checked-out YR client repo.
  • the other is my YR installation.

to be simplified, that's "change A to B or C" or "change A to B or change A to C". here the "you can use" looks being placed in a wrong location, so i've deleted it.

your opinion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much yes, we are stating use the one where you've just checked the repository out to or your game installation directory.

The language used at present is fine, but I guess for non-english native it's a bit harder to interpret.

The easiest thing would be

<!-- 
            Change the value of YRSource to wherever you have the YR client repo checked out OR
            you can use your installation path of YR for cncnet. For example:
            C:\repos\cncnet-yr-client-package\ or 
            C:\SteamLibrary\steamapps\common\Command & Conquer Red Alert II\
--!> 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Adding examples looks better.

Maybe I can rewrite it like this (comparing with the original):

         <PropertyGroup>
             <!--
             Change the value of YRSource to wherever you have the YR client repo checked out OR
             you can use your installation path of YR for cncnet.
-            This path should be the same one that contains the file "gamemd.exe".

-            Example: c:\repos\cncnet-yr-client-package\package
+            Examples:
+            - c:\repos\cncnet-yr-client-package\package
+            - c:\Westwood\RA2
             -->
             <YRSource></YRSource>

             <!--
             OPTIONAL
             Change the value of YRGameInstallSource to wherever you have the game installed locally.
-            This is only necessary if YRSource above is not already set to the game installation path and
+            This is only necessary if YRSource above is not already set to the game installation path (containing "gamemd.exe") and
             you need to be able to launch the game from the client during development/while using the YR client repo for YRSource.

             Example: c:\ra2InstallPath\Command and Conquer Red Alert II
             -->
             <YRGameInstallSource></YRGameInstallSource>

Explanation:

  • "c:\Westwood\RA2": I think that the game from Steam is not a "YR for cncnet" without modification, so I use the default installation path of "CnCNet5_YR_Installer.exe". The code is at
    DefaultGamePathEng=C:\Westwood\RA2\
  • About "gamemd.exe": we have no game files in YR client repo, so don't mislead new developers to try to copy them to the "package" directory in this repository and then face a bunch of untracked files. Yeah, I did it before.
  • Lowercase drive letters, missing trailing backslashes and other changes: consistent style.

Do you like this? 😁

@pzhlkj6612
Copy link
Contributor Author

Incorrect copy destination?

Another question: why do we need a YRStartupPath at a very high level?

    <Target Name="CopyYRResources" AfterTargets="PrepareForRun" Condition="$(ProjectName) == 'DXMainClient'">
        <PropertyGroup>
            ... 
-           <YRStartupPath>$(OutputPath)..\..\..</YRStartupPath>
        </PropertyGroup>

In Common MSBuild Project Properties - MSBuild | Microsoft Learn:

Property or parameter name Project types Description
OutputPath All Specifies the path to the output directory, relative to the project directory, for example, bin\Debug or bin\Debug\$(Platform) in non-AnyCPU builds.

I've tested the "YRWindowsDXDebug" configuration and the directory structure is as below:

$ find ./DXMainClient/bin/ -name 'clientdx.*'
./DXMainClient/bin/Debug/YR/WindowsDX/net48/clientdx.exe
./DXMainClient/bin/Debug/YR/WindowsDX/net48/clientdx.exe.config
./DXMainClient/bin/Debug/YR/WindowsDX/net48/clientdx.pdb
./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.deps.json
./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.dll
./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.pdb
./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.runtimeconfig.json

Here $(OutputPath) is bin\Debug\$(Game)\$(Engine)\$(TargetFramework).

I think we should change YRStartupPath to $(OutputPath).. or $(OutputPath) since we will auto find the "Resources" directory: https://github.com/CnCNet/xna-cncnet-client/blob/bae385595f48c525f1f44baf24044f337dc6cae2/DXMainClient/Program.cs#L214-L240

@brichardson1991
Copy link
Contributor

@GrantBartlett @alexp8 not sure about the last comment made by @pzhlkj6612, can you elaborate for him

@GrantBartlett
Copy link
Member

@GrantBartlett @alexp8 not sure about the last comment made by @pzhlkj6612, can you elaborate for him

@SadPencil

@SadPencil
Copy link
Member

Incorrect copy destination?

Another question: why do we need a YRStartupPath at a very high level?

    <Target Name="CopyYRResources" AfterTargets="PrepareForRun" Condition="$(ProjectName) == 'DXMainClient'">

        <PropertyGroup>

            ... 

-           <YRStartupPath>$(OutputPath)..\..\..</YRStartupPath>

        </PropertyGroup>


In Common MSBuild Project Properties - MSBuild | Microsoft Learn:

| Property or parameter name | Project types | Description |

|:- |:- |:- |

| OutputPath | All | Specifies the path to the output directory, relative to the project directory, for example, bin\Debug or bin\Debug\$(Platform) in non-AnyCPU builds. |

I've tested the "YRWindowsDXDebug" configuration and the directory structure is as below:


$ find ./DXMainClient/bin/ -name 'clientdx.*'

./DXMainClient/bin/Debug/YR/WindowsDX/net48/clientdx.exe

./DXMainClient/bin/Debug/YR/WindowsDX/net48/clientdx.exe.config

./DXMainClient/bin/Debug/YR/WindowsDX/net48/clientdx.pdb

./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.deps.json

./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.dll

./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.pdb

./DXMainClient/bin/Debug/YR/WindowsDX/net8.0-windows/clientdx.runtimeconfig.json



Here $(OutputPath) is bin\Debug\$(Game)\$(Engine)\$(TargetFramework).

I think we should change YRStartupPath to $(OutputPath).. or $(OutputPath) since we will auto find the "Resources" directory: https://github.com/CnCNet/xna-cncnet-client/blob/bae385595f48c525f1f44baf24044f337dc6cae2/DXMainClient/Program.cs#L214-L240

Reason: several years ago, when the client was still in .NET 7, the client was not able to automatically find the Resource folder. Instead, it assumed a path like Resources/Binaries/Windows/clientdx.dll.

I think either removing it or retaining it with a proper XML comment should be fine.

@pzhlkj6612
Copy link
Contributor Author

@SadPencil

Another question: why do we need a YRStartupPath at a very high level?

    <Target Name="CopyYRResources" AfterTargets="PrepareForRun" Condition="$(ProjectName) == 'DXMainClient'">
        <PropertyGroup>
            ... 
-           <YRStartupPath>$(OutputPath)..\..\..</YRStartupPath>
        </PropertyGroup>

...

I think either removing it or retaining it with a proper XML comment should be fine.

Hmm, no. The current code cannot find resources in $(OutputPath)..\..\.., but $(OutputPath), $(OutputPath).. or $(OutputPath)..\... That is, the current path does not work.

I think we should change YRStartupPath to $(OutputPath).. or $(OutputPath) since we will auto find the "Resources" directory: https://github.com/CnCNet/xna-cncnet-client/blob/bae385595f48c525f1f44baf24044f337dc6cae2/DXMainClient/Program.cs#L214-L240

That's why I said the above.


And please also see CnCNet/xna-cncnet-client#632, I think we may have things didn't get migrated during refactor or upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants