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

[Guide] How to succesfully compile and run on windows. #356

Open
maksw2 opened this issue May 30, 2024 · 25 comments
Open

[Guide] How to succesfully compile and run on windows. #356

maksw2 opened this issue May 30, 2024 · 25 comments

Comments

@maksw2
Copy link

maksw2 commented May 30, 2024

This guide will tell you how to prepare, compile and run build game.

  1. Install visual studio 2017 or 2022 with vs 2017 build tools, git or github desktop and python 3
  2. Cloning
    a. clone with git: git clone https://github.com/nillerusr/source-engine.git --recursive
    b. clone with github desktop.
  3. Go into command prompt and run these commands:
    waf.bat configure -T release --prefix=hl2 --build-games=hl2 --disable-warns
    waf.bat build -p -v
    waf.bat install
  4. now you have a directory called "hl2" with all binaries
  5. copy hl2 and platform from your hl2 install (steam) (skip overwriting files) (if you build any other game also copy it's folder)
  6. double click on hl2_launcher.exe

OTHER IMPORTANT THINGS

  1. want voice chat? add --enable-opus to configure
  2. change build game? change --prefix and --build-games in configure
    hl1 = Half-Life 1: Source
    hl2 = Half-Life 2 // Default - This will be selected if you don't specify a game
    episodic = Half-Life 2 Episode 1
    ep2 = Half-Life 2 Episode 2 // Do not build for ep2, use episodic instead.
    hl2mp = Half-Life 2: Deathmatch
    dod = Day of Defeat
    cstrike = Counter-Strike: Source
    portal = Portal
  3. black screen when starting a game? copy shaders from half-life 2 (black screen after loading #350)
  4. need 32 bit build? add --32-bits to configure
  5. need debug? change -T release to -T debug
@DiegoArmando-27
Copy link

  • Make sure you uninstall visual studio 2022 and 2019
  • Install visual studio 2017, git and python 3

But it can be succesfully built by VS2022, why we need VS2017?

@maksw2
Copy link
Author

maksw2 commented Jun 24, 2024

from what i've seen, vs2022 gives errors. did you really manage a succesfull vs2022 build? if yes, please share the details.

@DiegoArmando-27
Copy link

from what i've seen, vs2022 gives errors. did you really manage a succesfull vs2022 build? if yes, please share the details.

build.log
config.log

@maksw2
Copy link
Author

maksw2 commented Jun 25, 2024

that's very interesting... could it be because i was using vs 2022 proffesional? there were other people with the same problem - not being able to build with vs 2022. i've also seen a lot more warnings in your build.

@DiegoArmando-27
Copy link

i've also seen a lot more warnings in your build.

If my memory serves me, that warnings were even with VS2017 compilers

@DiegoArmando-27
Copy link

could it be because i was using vs 2022 professional?

Don't think that different types of VS provides different compilers

@1922828151
Copy link

I have compiled CSS dedicated_server for Windows 32-bit, but I am unable to use metamod and sourcemod properly.SdkHooks and CStools cannot load properly, and many plugins cannot be used. Can you provide assistance in fixing this issue?

@maksw2
Copy link
Author

maksw2 commented Jun 27, 2024

oh yeah, you might need to use an older version of these.

@maksw2
Copy link
Author

maksw2 commented Jun 28, 2024

after i fixed my path and added a shit-ton of arguments it works?

@maksw2
Copy link
Author

maksw2 commented Jun 28, 2024

updated it a bit

@Kizoky
Copy link

Kizoky commented Jul 16, 2024

Any idea on how to build a solution file?

(nevermind, you need to use msvs to generate a VS2010 .sln)

@maksw2
Copy link
Author

maksw2 commented Jul 17, 2024

what? we use waf. vpc got replaced years ago.

@DiegoArmando-27
Copy link

VS2010

Nope. It generates solution for the last version of VS on your PC

@DiegoArmando-27
Copy link

what? we use waf. vpc got replaced years ago.

.\waf msvs to generate a Visual Studio Solution

@Kizoky
Copy link

Kizoky commented Jul 19, 2024

what? we use waf. vpc got replaced years ago.

as much as I would like to admit waf is better, unfortunately it doesn't have intellisense

@DiegoArmando-27
Copy link

DiegoArmando-27 commented Jul 20, 2024

it doesn't have intellisense

IntelliSense is Visual Studio, not waf or vpc

@WZL203
Copy link

WZL203 commented Sep 25, 2024

本指南将告诉您如何准备、编译和运行构建游戏。

  1. 安装 Visual Studio 2017 或 2022,附带 vs 2017 构建工具、git 或 github 桌面和 python 3
  2. 克隆
    a. 使用 git 克隆:git clone https://github.com/nillerusr/source-engine.git --recursive
    b. 使用 github 桌面克隆。
  3. 进入命令提示符并运行以下命令:
    waf.bat configure -T release --prefix=hl2 --build-games=hl2 --disable-warns
    waf.bat build -p -v
    waf.bat install
  4. 现在你有一个名为“hl2”的目录,其中包含所有二进制文件
  5. 从你的 hl2 安装 (steam) 复制 hl2 和平台 (跳过覆盖文件) (如果你构建了任何其他游戏也请复制它的文件夹)
  6. 双击 hl2_launcher.exe

其他重要事项

  1. 想要语音聊天?在 configure 中添加 --enable-opus
  2. 更改构建游戏?在配置中更改 --prefix 和 --build-games
    hl1 = Half-Life 1: Source
    hl2 = Half-Life 2 // 默认 - 如果您不指定游戏,则会选择此项
    episodic = Half-Life 2 Episode 1
    ep2 = Half-Life 2 Episode 2 // 不要为 ep2 构建,而是使用 episodic。hl2mp
    = Half-Life 2: Deathmatch
    dod = Day of Defeat
    cstrike = Counter-Strike: Source
    portal = Portal
  3. 开始游戏时黑屏?从半条命 2 复制着色器(加载后黑屏 #350
  4. 需要 32 位版本?添加 --32-bits 进行配置
  5. 需要调试?将 -T release 改为 -T debug

After successfully building the project in Windows, is the hl2 directory the root directory? For example, my build directory is C:\Users\Administrator\source-engine, so the hl2 you mentioned is in the directory C:\Users\Administrator\source-engine\hl2, right? Then put the steam css file C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Source directly into C:\Users\Administrator\source-engine\hl2. If you encounter files with the same name, don't choose to replace them, right? I tried it and it kept giving me an error.

@maksw2
Copy link
Author

maksw2 commented Sep 27, 2024

@WZL203 Let me clarify it. You build the entire engine. What you should do is grab platform, hl2 and in your case cstrike and copy it over to the build engine. Do not touch the bin folder! In WAF change --build-games to reflect your game. Make a new text file, give it the .bat extension, open it and type this: hl2_launcher.exe -game cstrike. Run it. If the screen is black copy the hl2 directory from Half-life 2, not Counter-strike. Hope it helps!

@DiegoArmando-27
Copy link

DiegoArmando-27 commented Nov 22, 2024

This is on Windows, using Steam assets from the "pre-anniversary update" branch.

Looks like hl2/resource files issue

Can you check if there's everything required is in your build?

@VioletGiraffe
Copy link

I did copy everything in hl2. Maybe I need a different version of the game? But this engine is pretty new, I would expect it to work with the recent game, since there weren't any major updates before the 20th anniversary (and everything else in-game seems to work well).

@FlamedDogo99
Copy link

  1. black screen when starting a game? copy shaders from half-life 2 black screen after loading #350

This issue no longer appears to exist. Does anyone know how to do what this is referring to?

@DiegoArmando-27
Copy link

This issue no longer appears to exist. Does anyone know how to do what this is referring to?

In HL2:DM, there was a black screen in main menu.
The fix is: just copy the hl2_misc_*.vpk files from vanilla HL2 to hl2/ directory

@DiegoArmando-27
Copy link

DiegoArmando-27 commented Nov 23, 2024

I did copy everything in hl2. Maybe I need a different version of the game? But this engine is pretty new, I would expect it to work with the recent game, since there weren't any major updates before the 20th anniversary (and everything else in-game seems to work well).

Pre-20th anniversary steam version is required.

since there weren't any major updates before the 20th anniversary

False. There's a rendering issues with new assets

@VioletGiraffe
Copy link

VioletGiraffe commented Nov 23, 2024

Figured out my issue from before, it's because I didn't copy the platform folder - didn't read the instructions closely enough.

The same procedure works on Raspberry OS perfectly, you just have to figure out a couple dependencies to apt install as reported by the configure tool.

@ThePixelMoon
Copy link

  1. black screen when starting a game? copy shaders from half-life 2 black screen after loading #350

This issue no longer appears to exist. Does anyone know how to do what this is referring to?

@FlamedDogo99 i am the original creator of that Issue(tm)
it was basically me trying to compile the engine but i got a pure black window due to lack of shaders
this image is basically it
image

but it was hl2

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

No branches or pull requests

8 participants