Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.

Difference between revisions of "Half-Life 2"

From AppleGamingWiki, the wiki about gaming on M1 Apple silicon Macs
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Infobox game
 +
|cover        = HL2_cover.jpeg
 +
|developers  =
 +
{{Infobox game/row/developer|Valve Corporation}}
 +
|publishers  = {{Infobox game/row/publisher|Valve Corporation|2005-present}}
 +
|engines      = {{Infobox game/row/engine|Source}}
 +
|release dates= {{Infobox game/row/date|macOS|May 26, 2010|ref=<ref>{{Refurl|url=https://store.steampowered.com/oldnews/3874|title=News - Steam For Mac Launch: Week 3|date=2023-07-02}}</ref>}}
 +
|reception    =
 +
{{Infobox game/row/reception|Metacritic|half-life-2|96}}
 +
{{Infobox game/row/reception|IGDB|half-life-2|91}}
 +
|taxonomy    = {{Infobox game/row/taxonomy/series| Half-Life }}
 +
|official site= https://www.half-life.com/en/halflife2
 +
|hltb        = 4248
 +
|mobygames    = 15564
 +
|strategywiki = Half-Life 2
 +
|wikipedia    = Half-Life 2
 +
|winehq      = 2095
 +
|license      = commercial
 +
|codeweavers  = half-life-2
 +
|steam appid = 220
 +
}}
 +
 
{{Compatibility/macOS
 
{{Compatibility/macOS
|native              = Perfect
+
|native              = playable
|native notes        = Compiled the Source Engine Leak. https://jameshug.notion.site/Guide-to-Installing-Portal-Using-Source-Engine-on-macOS-660803f9ced149cfa1647d38fd5a7092<ref>{{Refdevice
+
|native notes        = Can be run with an EP1/2 installation with <code>-game hl2</code>, saves and achievements do not sync. See [[#Fixes & Tweaks]]<ref>{{Refdevice
 
|user=PBeGood4
 
|user=PBeGood4
 
|date=29 April 2023
 
|date=29 April 2023
Line 10: Line 32:
 
|framerate=120+ FPS
 
|framerate=120+ FPS
 
}}</ref>
 
}}</ref>
 +
<ref>{{Refdevice|user=mokMan23|date=2023-09-25|device=16GB M1 Mac Mini|os=macOS Sonoma 14.0 RC2|settings=Very High|resolution=2560x1440}}</ref>
 
|rosetta 2            = unknown
 
|rosetta 2            = unknown
 
|rosetta 2 notes      =  
 
|rosetta 2 notes      =  
Line 16: Line 39:
 
|crossover            = runs
 
|crossover            = runs
 
|crossover notes      = Installed via Steam on CrossOver 21, extreme fps drops during shootouts and explosions.
 
|crossover notes      = Installed via Steam on CrossOver 21, extreme fps drops during shootouts and explosions.
|wine                = unknown
+
|wine                = perfect
|wine notes          =
+
|wine notes          = Tested on M1 max with settings set to high and resolution set to 2056x1329. Runs at over 120 fps with no vertical sync. Slight stuttering in load areas.
 
|parallels            = perfect
 
|parallels            = perfect
 
|parallels notes      = Playable.<ref>{{Refdevice|user=gp|date=7 Sep 2021|device=Mac M1 16 GB RAM|os=Windows 11 (latest Insider ISO)|method=Parallels 17|version=|resolution=1080p|settings=Medium|framerate=50~60 FPS|controller=|url=|title=|comment=}}</ref>
 
|parallels notes      = Playable.<ref>{{Refdevice|user=gp|date=7 Sep 2021|device=Mac M1 16 GB RAM|os=Windows 11 (latest Insider ISO)|method=Parallels 17|version=|resolution=1080p|settings=Medium|framerate=50~60 FPS|controller=|url=|title=|comment=}}</ref>
Line 26: Line 49:
 
}}
 
}}
  
==Native ARM build from leaked source==
+
==Native==
These instructions are heavily based on guides written by [https://www.youtube.com/watch?v=mMuSXs0SF_g 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.
+
Guides originally written by [https://www.youtube.com/watch?v=mMuSXs0SF_g James Hug]. This method builds a native port for older Source engine games, such as Half-Life 2, its episodes, and Portal.
 
 
Enter these commands into a Terminal window:
 
  
1. Install Homebrew
+
Enter these commands into Terminal, Homebrew & Xcode Command Line Tools are required:
<pre>
 
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
 
</pre>
 
 
 
On Apple Silicon Macs: remember to set the path, modify this command with your username:
 
<pre>
 
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/$(whoami)/.zprofile
 
eval "$(/opt/homebrew/bin/brew shellenv)"
 
</pre>
 
 
 
2. If Xcode Command Line Tools does not install, then install it manually:
 
<pre>
 
xcode-select --install
 
</pre>
 
 
 
3. Install required packages from Homebrew (added the jpeg-turbo dependency from instructions)
 
<pre>
 
brew doctor
 
brew cleanup
 
brew install sdl2 freetype2 fontconfig pkg-config opus libpng libedit python3 jpeg jpeg-turbo
 
</pre>
 
  
4. Clone the Source Engine GitHub repository
+
1. Install prerequisites from Homebrew and clone Repository (added the jpeg-turbo dependency from instructions):
 
<pre>
 
<pre>
git clone --recursive https://github.com/nillerusr/source-engine
+
brew install sdl2 freetype2 fontconfig pkg-config opus libpng libedit python3 jpeg jpeg-turbo && brew cleanup
cd source-engine
+
git clone --recursive https://github.com/nillerusr/source-engine && cd source-engine
 
</pre>
 
</pre>
  
5. ('''this is step was not needed when building HL2 on 1st July 2023''') The location of <code>StubSteamAPI</code> was recently moved on 23rd May 2023, so this has to be put into the correct place for the build scripts to work:
+
2. Set pkg path:
#Rename <code>/stub_steam/</code> to <code>/StubSteamAPI/</code>
 
#Move <code>/StubSteamAPI/</code> into the <code>/thirdparty/</code> folder.
 
 
 
6. Set pkg path:
 
 
<pre>
 
<pre>
 
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"
 
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"
 
</pre>
 
</pre>
  
7. Configure game builds:
+
3. Configure, build and install the game into your Documents Folder:
*'''Half-Life 2''':
 
**<code>python3 waf configure -T release --64bits --prefix='' --build-games=hl2</code>
 
*'''Half-Life 2 Episodes''':
 
**<code>python3 waf configure -T release --64bits --prefix='' --build-games=episodic</code>
 
*'''Portal''':
 
**<code>python3 waf configure -T release --64bits --prefix='' --build-games=portal</code>
 
*'''Counter-Strike: Source''':
 
**<code>python3 waf configure -T release --64bits --prefix='' --build-games=cstrike</code>
 
  
8. Build the game:
+
<pre>python3 waf configure -T release --prefix='' --build-games=[game folder] && python3 waf build && python3 waf install --destdir='~/Documents/Build/[game folder]'
<pre>
 
python3 waf build
 
 
</pre>
 
</pre>
  
9. Create '''Build folder''' Install build into directory, this can be located anywhere ideally append with <code>hl2</code>, <code>episodic</code>, <code>portal</code>, <code>cstrike</code> etc.
+
Valid Game Folder Names:
<pre>
+
*cstrike (Counter-Strike Source)
python3 waf install --destdir='~/Documents/Build folder/hl2'
+
*episodic (Half-Life 2: Episode 1)
</pre>
+
*ep2 (Half-Life 2: Episode 2, can be played without <code>python3 waf build</code>)
 +
*hl1 (Half-Life: Source)
 +
*hl2
 +
*portal  
 +
*dod (Day of Defeat: Source)
 +
*hl2mp (Half-Life 2: Deathmatch)
  
10. Open '''Build folder''' in new Finder window.
+
4. Open your "Half-Life 2" Folder. (Portal and/or Day of Defeat Source, if you're installing those games)
 +
''(Right-Click > "Browse local files" on Steam.)''
  
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'''.
+
5. Modify Installation Files
 +
(If you're installing multiple games, you only need to replace the files from "[game folder]/bin"):
 +
*Delete the root and game folder <code>"bin"</code> directories and <code>"hl2_osx"</code> executable
 +
**Move your <code>"bin", "[game folder]/bin"</code> folders and <code>"hl2_launcher"</code> executable to your Half-Life 2 folder,  
 +
**and rename <code>"hl2_launcher"</code> to <code>"hl2_osx"</code>
 +
Congratulations! You (hopefully) successfully built a working Native Source Port!
  
12. Open '''Steam folder''' in Finder: right-click on game in Steam library, go to Manage and Browse local files. Alternatively navigate to <code>~/Library/Application Support/Steam/steamapps/common/</code>
+
==Fixes & Tweaks==
  
13. In the '''Steam folder''':
+
'''Quality/Performance''':  
*Delete <code>Steam folder/bin/</code> folder.
+
* MBP Notch Fix. Initiates the game in windowed borderless mode, allowing the game to render beneath the MacBook's notch, ensuring interface elements and aiming are correctly displayed. (put these in your Steam Launch Options, Right-Click > "Properties..."): <code>-noborder -windowed</code>
*Copy/move <code>Build folder/bin/</code> folder into <code>Steam folder/</code> replacing the previous <code>Steam folder/bin/</code> folder.
 
  
14. In the '''Steam folder''':  
+
* Cap FPS to a specific value, if using 120hz monitor (add this to your Steam Launch Options, Right-Click > "Properties..."): <code>-refresh 120</code>
*Delete <code>hl2_osx</code>
 
*Copy/move from '''Build folder''' <code>Build folder/hl2_launcher</code>
 
*Rename the <code>hl2_launcher</code> into <code>hl2_osx</code>
 
  
15. In the '''Steam folder''':
 
*Navigate inside 'game' folder (e.g. <code>/hl2/</code> or <code>/episodic/</code> or <code>/portal/</code> or <code>/cstrike/</code>)
 
*Delete the bin subfolder (e.g. <code>Steam folder/hl2/bin/</code>)
 
*From the '''Build folder''' go to game folder (e.g. <code>Build folder/hl2/</code>) and move/copy from the '''Build folder''' to the '''Steam folder''' into the game (e.g. <code>Steam folder/hl2/</code>)
 
  
16. Now the respective game can be launched from within Steam.
+
'''Console commands'''
  
17. Other parameters:
+
'''THESE CONSOLE COMMANDS WILL NOT SAVE (so need to be ran at the start of each game session or after reload)!'''
*cstrike (Counter-Strike: Source) - in addition tot he above instructions, also copy the <code>Steam folder/hl2/</code> and put it in the root of the <code>Steam folder</code> 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):'''
+
'''Tweaks'''
<code>-noborder -windowed -refresh 120 -autoexec</code>
+
* Asynchronous Audio. Forces audio asynchronization. Removes audio stuttering in some cases: <code>snd_async_fullyasync 1; snd_async_minsize 0; snd_noextraupdate 1</code>
  
This starts the game in the windowed borderless mode and limits FPS to 120.
+
* Texture Quality Improvement: <code>mat_picmip -1;mat_antialias 4;mat_forceaniso 8</code>
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'''
+
* Software AA: Maximum Quality (Helps to remove further aliasing, such as power lines.):<code>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</code>
  
In <code>/Users/<username>/Library/Application Support/Steam/steamapps/common/Half-Life 2/hl2/cfg/autoexec.cfg</code>, add this:
+
* Disable nearby culling: <code>r_lod 0</code>
  
<pre>
+
* Enable motion blur (some people prefer it disabled): <code>mat_motion_blur_forward_enabled 1</code>
//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.
+
* Default Macbook Pro 16 resolution (can try this if the game is still not rendering under the notch): <code>mat_setvideomode 1728 1117 1</code>
  
<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.
+
* More Space resolution (can try this it the game is still not rendering under the notch): <code> mat_setvideomode 2056 1329 1</code>
  
<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.
+
'''Fixes'''
  
<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.
+
* HL2 Flashlight Fix: <code>r_newflashlight 0</code> (Replaces buggy HL2 flashlight with HL1 counterpart. HL2 flashlight typically causes various artifacts when interacting with shadows.)
  
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.
+
==Known bugs==
 
+
*When playing with Airpods, the audio starts stuttering randomly. '''Fix:''' Mute and unmute the audio on the Macbook.
'''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
 
'''
 
  
 +
*Counter-Strike: Source, Half-Life 2: Deathmatch and Day of Defeat: Source show a black screen  has no HUD on macOS Sonoma
  
==Known bugs==
+
*[https://www.youtube.com/watch?v=l26R-dRrLZc Father Gregori & The Cart Ride are bugged in the last part of "We don't go to Ravenholm...", with the cart ride section being culled out until you enter it. ]
- When playing with Airpods, the audio starts stuttering randomly. '''Fix:''' Mute and unmute the audio on the Macbook.
 
 
 
 
{{References}}
 
{{References}}
  
 
[[Category:Games]]
 
[[Category:Games]]

Latest revision as of 23:43, 9 February 2024

Half-Life 2
Half-Life 2 cover
Developers
Valve Corporation
Publishers
2005-present Valve Corporation
Engines
Source
Release dates
macOS May 26, 2010 [1]
Reception
Metacritic 96
IGDB 91
Taxonomy
Series Half-Life
Resources
Codeweavers
WineHQ
Half-Life 2 on HowLongToBeat
Half-Life 2 on IGDB
Half-Life 2 guide on StrategyWiki
Half-Life 2 on MobyGames
Half-Life 2 on Wikipedia

macOS Compatibility

Method Rating Notes
Native Playable Can be run with an EP1/2 installation with -game hl2, saves and achievements do not sync. See #Fixes & Tweaks[2] [3]
Rosetta 2 Unknown
Compatibility layer
CrossOver Runs Installed via Steam on CrossOver 21, extreme fps drops during shootouts and explosions.
Wine Perfect Tested on M1 max with settings set to high and resolution set to 2056x1329. Runs at over 120 fps with no vertical sync. Slight stuttering in load areas.
Virtualization
Parallels Perfect Playable.[4]

Native

Guides originally written by James Hug. This method builds a native port for older Source engine games, such as Half-Life 2, its episodes, and Portal.

Enter these commands into Terminal, Homebrew & Xcode Command Line Tools are required:

1. Install prerequisites from Homebrew and clone Repository (added the jpeg-turbo dependency from instructions):

brew install sdl2 freetype2 fontconfig pkg-config opus libpng libedit python3 jpeg jpeg-turbo && brew cleanup
git clone --recursive https://github.com/nillerusr/source-engine && cd source-engine

2. Set pkg path:

export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"

3. Configure, build and install the game into your Documents Folder:

python3 waf configure -T release --prefix='' --build-games=[game folder] && python3 waf build && python3 waf install --destdir='~/Documents/Build/[game folder]'

Valid Game Folder Names:

  • cstrike (Counter-Strike Source)
  • episodic (Half-Life 2: Episode 1)
  • ep2 (Half-Life 2: Episode 2, can be played without python3 waf build)
  • hl1 (Half-Life: Source)
  • hl2
  • portal
  • dod (Day of Defeat: Source)
  • hl2mp (Half-Life 2: Deathmatch)

4. Open your "Half-Life 2" Folder. (Portal and/or Day of Defeat Source, if you're installing those games) (Right-Click > "Browse local files" on Steam.)

5. Modify Installation Files (If you're installing multiple games, you only need to replace the files from "[game folder]/bin"):

  • Delete the root and game folder "bin" directories and "hl2_osx" executable
    • Move your "bin", "[game folder]/bin" folders and "hl2_launcher" executable to your Half-Life 2 folder,
    • and rename "hl2_launcher" to "hl2_osx"

Congratulations! You (hopefully) successfully built a working Native Source Port!

Fixes & Tweaks

Quality/Performance:

  • MBP Notch Fix. Initiates the game in windowed borderless mode, allowing the game to render beneath the MacBook's notch, ensuring interface elements and aiming are correctly displayed. (put these in your Steam Launch Options, Right-Click > "Properties..."): -noborder -windowed
  • Cap FPS to a specific value, if using 120hz monitor (add this to your Steam Launch Options, Right-Click > "Properties..."): -refresh 120


Console commands

THESE CONSOLE COMMANDS WILL NOT SAVE (so need to be ran at the start of each game session or after reload)!


Tweaks

  • Asynchronous Audio. Forces audio asynchronization. Removes audio stuttering in some cases: snd_async_fullyasync 1; snd_async_minsize 0; snd_noextraupdate 1
  • Texture Quality Improvement: mat_picmip -1;mat_antialias 4;mat_forceaniso 8
  • Software AA: Maximum Quality (Helps to remove further aliasing, such as power lines.):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
  • Disable nearby culling: r_lod 0
  • Enable motion blur (some people prefer it disabled): mat_motion_blur_forward_enabled 1
  • Default Macbook Pro 16 resolution (can try this if the game is still not rendering under the notch): mat_setvideomode 1728 1117 1
  • More Space resolution (can try this it the game is still not rendering under the notch): mat_setvideomode 2056 1329 1

Fixes

  • HL2 Flashlight Fix: r_newflashlight 0 (Replaces buggy HL2 flashlight with HL1 counterpart. HL2 flashlight typically causes various artifacts when interacting with shadows.)

Known bugs

  • When playing with Airpods, the audio starts stuttering randomly. Fix: Mute and unmute the audio on the Macbook.
  • Counter-Strike: Source, Half-Life 2: Deathmatch and Day of Defeat: Source show a black screen has no HUD on macOS Sonoma

References

  1. News - Steam For Mac Launch: Week 3 - last accessed on 2023-07-02
  2. Verified by User:PBeGood4 on 29 April 2023
    Device: M1 MacBook Pro
    Method: Compiled Source Engine Leak
    Resolution: 1920x1080
    Settings: high
    Framerate: 120+ FPS
  3. Verified by User:mokMan23 on 2023-09-25
    Device: 16GB M1 Mac Mini
    OS: macOS Sonoma 14.0 RC2
    Resolution: 2560x1440
    Settings: Very High
  4. 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