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
(Undo revision 8299 by Mokman23 (talk))
Tag: Undo
Line 117: Line 117:
 
==Known bugs==
 
==Known bugs==
 
- When playing with Airpods, the audio starts stuttering randomly. '''Fix:''' Mute and unmute the audio on the Macbook.
 
- When playing with Airpods, the audio starts stuttering randomly. '''Fix:''' Mute and unmute the audio on the Macbook.
- Counter-Strike: Source has no HUD on macOS Sonoma
+
 
 +
- Counter-Strike: Source has no HUD, Half-Life 2: Deathmatch and Day of Defeat: Source show a black screen on macOS Sonoma
  
 
{{References}}
 
{{References}}
  
 
[[Category:Games]]
 
[[Category:Games]]

Revision as of 21:02, 25 September 2023

macOS Compatibility

Method Rating Notes
Native Perfect Compiled the Source Engine Leak. https://github.com/nillerusr/source-engine[1]
Rosetta 2 Unknown
Compatibility layer
CrossOver Runs Installed via Steam on CrossOver 21, extreme fps drops during shootouts and explosions.
Wine Unknown
Virtualization
Parallels Perfect Playable.[2]

Native ARM build from leaked source

These instructions are based on guides written by James Hug. This method builds a native port for older Source engine games, such as Half-Life 2, its episodes, and Portal. TF2 AND LATER SOURCE GAMES WON'T WORK!!

Enter these commands into Terminal, Homebrew and 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 --64bits --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/2)
  • hl1 (Half-Life: Source)
  • hl2 (Half-Life 2),
  • portal
  • dod (Day of Defeat: Source)
  • hl2mp (Half-Life 2: Deathmatch)

4. Open your Half-Life 2 Folder, and your game's subfolder. (Portal and/or Day of Defeat Source, if you're installing those games), Right-Click > "Browse local files". DO NOT MESS WITH THE HL2 FOLDER UNLESS YOU'RE ACTUALLY INSTALLING HL2!)

5. Modify Installation Files:

  • 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!

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. Optionally, if you have EP2 installed and want to launch EP1 or base HL2 (or any other Half-Life 2 folder game), you can launch it by appending -game [game subfolder name]. If you'd like to play EP2 again, simply remove the -game parameter. Make sure NOT to share game "bin" folders or they WILL crash upon loading!

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.

- Counter-Strike: Source has no HUD, Half-Life 2: Deathmatch and Day of Defeat: Source show a black screen on macOS Sonoma

References

  1. Verified by User:PBeGood4 on 29 April 2023
    Device: M1 MacBook Pro
    Method: Compiled Source Engine Leak
    Resolution: 1920x1080
    Settings: high
    Framerate: 120+ FPS
  2. 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