Difference between revisions of "Half-Life 2"
(Note that renaming and moving the folders is not needed after recent commits) |
|||
Line 116: | Line 116: | ||
*dod (Day of Defeat) | *dod (Day of Defeat) | ||
*hl2mp (Half-Life 2: Deathmatch) | *hl2mp (Half-Life 2: Deathmatch) | ||
+ | |||
+ | === Suggested settings for the native version === | ||
+ | Tested on Macbook Pro 16 2021 16 GB | ||
+ | |||
+ | 1. '''Add launch parameters (Steam):''' | ||
+ | <code>-noborder -windowed -refresh 120 -autoexec</code> | ||
+ | |||
+ | This starts the game in the windowed borderless mode and limits FPS to 120. | ||
+ | Windowed borderless is needed to ignore the Macbook's notch (render the game under it). Otherwise the interface elements and aim are shifted incorrectly, potentially making the game less playable. | ||
+ | |||
+ | 2. '''Add settings to autoexec.cfg''' | ||
+ | |||
+ | In <code>/Users/<username>/Library/Application Support/Steam/steamapps/common/Half-Life 2/hl2/cfg/autoexec.cfg</code>, add this: | ||
+ | |||
+ | <pre> | ||
+ | //set the video mode to your display resolution (i.e. 1728x1117 - Default, 2056x1329 - More Space). Uncomment only the resolution you are using. | ||
+ | mat_setvideomode 1728 1117 1 | ||
+ | //mat_setvideomode 2056 1329 1 | ||
+ | // Forces the engine to load audio asynchronously. Removes audio micro-stuttering in some cases. | ||
+ | snd_async_fullyasync 1 | ||
+ | snd_async_minsize 0 | ||
+ | snd_noextraupdate 1 | ||
+ | // Improve texture quality | ||
+ | mat_picmip -1 | ||
+ | mat_antialias 4 | ||
+ | mat_forceaniso 8 | ||
+ | //BELOW: Enables software AA at maximum quality. Software AA works alongside normal AA, and helps to remove further | ||
+ | //aliasing, such as power lines. Little to no frame loss with this enabled. | ||
+ | mat_software_aa_quality 8 | ||
+ | mat_software_aa_strength 2 | ||
+ | mat_software_aa_strength_vgui 2 | ||
+ | mat_software_aa_blur_one_pixel_lines 0.5 | ||
+ | mat_software_aa_edge_threshold .8 | ||
+ | // Enables small motion blur with forward movement, feel free to remove | ||
+ | mat_motion_blur_forward_enabled 1 | ||
+ | // Key binding to manually to enable some of the settings | ||
+ | bind "/" "r_newflashlight 0; r_lod 0; r_maxdlights 128; r_shadowmaxrendered 1024; echo 'Graphics commands have been applied.'" | ||
+ | </pre> | ||
+ | |||
+ | This will make sure that the game will run at max settings. FPS will still be 120 almost everywhere except the places in the game that were buggy on the other platforms as well. | ||
+ | |||
+ | <code>r_newflashlight 0</code> - disables HL2 flashlight that is not working well (causes various artefacts when interacting with shadows). With this setting the game will use the still functional HL1 implementation of flashlight. | ||
+ | |||
+ | <code>r_lod 0</code> - always fully load all nearby objects (buildings, cars, etc.). Looks better as the objects will not switch their appearance suddenly when you approach them. There is little to none performance penalty on Mac with its SSD. | ||
+ | |||
+ | <code>r_maxdlights 128; r_shadowmaxrendered 1024;</code> - could potentially improve the look of the game, feel free to remove if you see no difference. | ||
+ | |||
+ | Binding these <code>r_*</code> settings command to <code>/</code> key is necessary, because the game will reset these settings while in the Main Menu. | ||
+ | |||
+ | '''You need to tap <code>/</code> key when you already loaded the save game. The settings then will stay enabled for the whole session (even if re-loading the saves), until you exit the game | ||
+ | ''' | ||
+ | |||
+ | |||
+ | ==Known bugs== | ||
+ | - When playing with Airpods, the audio starts stuttering randomly. '''Fix:''' Mute and unmute the audio on the Macbook. | ||
{{References}} | {{References}} | ||
[[Category:Games]] | [[Category:Games]] |
Revision as of 12:02, 13 August 2023
macOS Compatibility
Method | Rating | Notes |
---|---|---|
Native | Compiled the Source Engine Leak. https://jameshug.notion.site/Guide-to-Installing-Portal-Using-Source-Engine-on-macOS-660803f9ced149cfa1647d38fd5a7092[1] | |
Rosetta 2 | ||
Compatibility layer | ||
CrossOver | Installed via Steam on CrossOver 21, extreme fps drops during shootouts and explosions. | |
Wine | ||
Virtualization | ||
Parallels | Playable.[2] |
Native ARM build from leaked source
These instructions are heavily based on guides written by James Hug. This method can be used to build native ARM macOS ports of Half-Life, Half-Life 2, Half-Life 2: Episode 1 & 2, Portal, Counter-Strike: Source etc. as long as the necessary game files from Steam have been copied into the correct folder.
Enter these commands into a Terminal window:
1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
On Apple Silicon Macs: remember to set the path, modify this command with your username:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/$(whoami)/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"
2. If Xcode Command Line Tools does not install, then install it manually:
xcode-select --install
3. Install required packages from Homebrew (added the jpeg-turbo dependency from instructions)
brew doctor brew cleanup brew install sdl2 freetype2 fontconfig pkg-config opus libpng libedit python3 jpeg jpeg-turbo
4. Clone the Source Engine GitHub repository
git clone --recursive https://github.com/nillerusr/source-engine cd source-engine
5. (this is step was not needed when building HL2 on 1st July 2023) The location of StubSteamAPI
was recently moved on 23rd May 2023, so this has to be put into the correct place for the build scripts to work:
- Rename
/stub_steam/
to/StubSteamAPI/
- Move
/StubSteamAPI/
into the/thirdparty/
folder.
6. Set pkg path:
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"
7. Configure game builds:
- Half-Life 2:
python3 waf configure -T release --64bits --prefix= --build-games=hl2
- Half-Life 2 Episodes:
python3 waf configure -T release --64bits --prefix= --build-games=episodic
- Portal:
python3 waf configure -T release --64bits --prefix= --build-games=portal
- Counter-Strike: Source:
python3 waf configure -T release --64bits --prefix= --build-games=cstrike
8. Build the game:
python3 waf build
9. Create Build folder Install build into directory, this can be located anywhere ideally append with hl2
, episodic
, portal
, cstrike
etc.
python3 waf install --destdir='~/Documents/Build folder/hl2'
10. Open Build folder in new Finder window.
11. Open Mac version of Steam and install games e.g Half-Life 2, Episode 1, Episode 2, Portal, Counter-Strike: Source etc. these game files I will refer to as the Steam folder.
12. Open Steam folder in Finder: right-click on game in Steam library, go to Manage and Browse local files. Alternatively navigate to ~/Library/Application Support/Steam/steamapps/common/
13. In the Steam folder:
- Delete
Steam folder/bin/
folder. - Copy/move
Build folder/bin/
folder intoSteam folder/
replacing the previousSteam folder/bin/
folder.
14. In the Steam folder:
- Delete
hl2_osx
- Copy/move from Build folder
Build folder/hl2_launcher
- Rename the
hl2_launcher
intohl2_osx
15. In the Steam folder:
- Navigate inside 'game' folder (e.g.
/hl2/
or/episodic/
or/portal/
or/cstrike/
) - Delete the bin subfolder (e.g.
Steam folder/hl2/bin/
) - From the Build folder go to game folder (e.g.
Build folder/hl2/
) and move/copy from the Build folder to the Steam folder into the game (e.g.Steam folder/hl2/
)
16. Now the respective game can be launched from within Steam.
17. Other parameters:
- cstrike (Counter-Strike: Source) - in addition tot he above instructions, also copy the
Steam folder/hl2/
and put it in the root of theSteam folder
so that the game will launch. - tf (Team Fortress Classic)
- dod (Day of Defeat)
- hl2mp (Half-Life 2: Deathmatch)
Suggested settings for the native version
Tested on Macbook Pro 16 2021 16 GB
1. Add launch parameters (Steam):
-noborder -windowed -refresh 120 -autoexec
This starts the game in the windowed borderless mode and limits FPS to 120. Windowed borderless is needed to ignore the Macbook's notch (render the game under it). Otherwise the interface elements and aim are shifted incorrectly, potentially making the game less playable.
2. Add settings to autoexec.cfg
In /Users/<username>/Library/Application Support/Steam/steamapps/common/Half-Life 2/hl2/cfg/autoexec.cfg
, add this:
//set the video mode to your display resolution (i.e. 1728x1117 - Default, 2056x1329 - More Space). Uncomment only the resolution you are using. mat_setvideomode 1728 1117 1 //mat_setvideomode 2056 1329 1 // Forces the engine to load audio asynchronously. Removes audio micro-stuttering in some cases. snd_async_fullyasync 1 snd_async_minsize 0 snd_noextraupdate 1 // Improve texture quality mat_picmip -1 mat_antialias 4 mat_forceaniso 8 //BELOW: Enables software AA at maximum quality. Software AA works alongside normal AA, and helps to remove further //aliasing, such as power lines. Little to no frame loss with this enabled. mat_software_aa_quality 8 mat_software_aa_strength 2 mat_software_aa_strength_vgui 2 mat_software_aa_blur_one_pixel_lines 0.5 mat_software_aa_edge_threshold .8 // Enables small motion blur with forward movement, feel free to remove mat_motion_blur_forward_enabled 1 // Key binding to manually to enable some of the settings bind "/" "r_newflashlight 0; r_lod 0; r_maxdlights 128; r_shadowmaxrendered 1024; echo 'Graphics commands have been applied.'"
This will make sure that the game will run at max settings. FPS will still be 120 almost everywhere except the places in the game that were buggy on the other platforms as well.
r_newflashlight 0
- disables HL2 flashlight that is not working well (causes various artefacts when interacting with shadows). With this setting the game will use the still functional HL1 implementation of flashlight.
r_lod 0
- always fully load all nearby objects (buildings, cars, etc.). Looks better as the objects will not switch their appearance suddenly when you approach them. There is little to none performance penalty on Mac with its SSD.
r_maxdlights 128; r_shadowmaxrendered 1024;
- could potentially improve the look of the game, feel free to remove if you see no difference.
Binding these r_*
settings command to /
key is necessary, because the game will reset these settings while in the Main Menu.
You need to tap /
key when you already loaded the save game. The settings then will stay enabled for the whole session (even if re-loading the saves), until you exit the game
Known bugs
- When playing with Airpods, the audio starts stuttering randomly. Fix: Mute and unmute the audio on the Macbook.
References
- ↑ Verified by User:PBeGood4 on 29 April 2023
- Device: M1 MacBook Pro
- Method: Compiled Source Engine Leak
- Resolution: 1920x1080
- Settings: high
- Framerate: 120+ FPS
- ↑ Verified by User:gp on 7 Sep 2021
- Device: Mac M1 16 GB RAM
- OS: Windows 11 (latest Insider ISO)
- Method: Parallels 17
- Resolution: 1080p
- Settings: Medium
- Framerate: 50~60 FPS