Black Mesa - Mod Creation

From Valve Developer Community
Revision as of 09:36, 27 February 2024 by MrBlackMesa1 (talk | contribs) (fix }})
Jump to navigation Jump to search
Black Mesa Level Creation


Skill Level

This tutorial expects you to have this amount of knowledge within the topic to follow along smoothly.

Novice Familiar Competent Proficient Expert


This article will discuss the creation of a Black mesa mod

Creating a mod

Head to your local variation of C:\Program Files (x86)\Steam\steamapps\common\Black Mesa then create a folder with your mod's name, for the sake of the tutorial we will use: myfirstmod.

Setting up the files:

Navigate into the directory and create the following folders and subfolders:

  • resource
  • scripts
  • mapsrc
  • mapsrc/instances
  • campaigns
  • ui

Inside the newly created resource folder add: clientscheme.res and gamemenu.res from: bms_misc_dir.vpk

Note.pngNote:Use a program like VPKEdit to extract the files from VPK

Setting up the chapters:

Create a scripts/chapter_manifest.txt inside your newly created scripts folder It should be something like this: Edit it to replace with your map names / the amount of chapters you have

"chapter_manifest.txt"
{
  yourmapname_a 1 // the 1 at the end means it's part of chapter 1
  yourmapname_b 2 // the 2 at the end means it's part of chapter 2 
  yourmapname_c 2 // Multiple maps can share same chapter
}

Next up create a blackmesa.json file inside myfirstmod/campaigns/, modify it to suit your needs.

{
{
    "author": "mod author", 
    "url": "",
    "title": "#key",
    "description": "",
    "imageSource": "image://game/ui/campaign/images/logo.jpg",
    "chapters": [
        {
            "title": "#key",
            "description": "",
            "imageSource": "yourpathtoimage", 
            "levelName": "yourmapname"
        },
        {
            "title": "#key",
            "description": "",
            "imageSource": "yourpathtoimage", 
            "levelName": "yourmapname"
        },
        {
            "title": "#key",
            "description": "",
            "imageSource": "yourpathtoimage", 
            "levelName": "yourmapname"
        }
    ]
}
}
Note.pngNote:The imageSource path is relative to the ui/images folder of your mod and example would be "image://game/ui/campaign/images/chapter1.png"

Make sure to replace each #key in the file with the corresponding one in your corresponding localization file (See the next step)

Setting up the text for chapters:

Create a myfirstmod_english.txt in myfirstmod/resources/ It should look something like this, modify it to your needs

"lang"
{ 
	"Language"	"English" 
	"Tokens" 
	{ 

// CHAPTER TITLE CARDS

		"MYFIRSTMOD_CampaignName_BMSCP1"						"CAMPAIGN" // Title, see blackmesa.json for more info
		"MYFIRSTMOD_Chapter1_Title"							"The First Chapter"
		"MYFIRSTMOD_Chapter2_Title"							"The Second Chapter"
		"MYFIRSTMOD_Chapter3_Title"							"CREDITS"
	} 
}
Warning.pngWarning:This file must be saved in a Unicode format.
Note.pngNote:For windows save as UTF-16 LE In Notepad, under Save As..., this is equivalent to choosing unicode for the Encoding option at the bottom of the dialog.

Creating the gameinfo.txt file:

Now you will need create your gameinfo file inside your myfirstmod folder. Use the following one as a template and modify it to your needs:

"GameInfo"
{
	game			"myfirstmod"
	gamelogo 		1
	developer		"Developer Name"
	developer_url	"http://www.blackmesasource.com/"
	type			"both"
	gamelogo 		1
	SupportsDX8     0
	SupportsXbox360 1
	nomodels		1
	nocrosshair		1
	GameData 		"bms.fgd"
	InstancePath	"myfirstmod/mapsrc/instances/" 
	
	hidden_maps
	{
       
	}

	FileSystem
	{
		SteamAppId 362890
		ToolsAppId 211

		//
		// Search paths are relative to the base directory, which is where hl2.exe is found.
		//
		// |gameinfo_path| points at the directory where gameinfo.txt is.
		// We always want to mount that directory relative to gameinfo.txt, so
		// people can mount stuff in c:\mymod, and the main game resources are in
		// someplace like c:\program files\valve\steam\steamapps\half-life 2.
		//
		SearchPaths
		{
			// First, mount all user customizations.  This will search for VPKs and subfolders
			// and mount them in alphabetical order.  The easiest way to distribute a mod is to
			// pack up the custom content into a VPK.  To "install" a mod, just drop it in this
			// folder.
			//
			// Note that this folder is scanned only when the game is booted.
			game+mod								myfirstmod/custom/*
			
                        game+mod                                                                myfirstmod
			// Black Mesa VPK files.
			game+mod 								bms/bms_textures.vpk
			game+mod 								bms/bms_materials.vpk
			game+mod 								bms/bms_models.vpk
			game+mod 								bms/bms_misc.vpk
			game+mod 								bms/bms_sounds_misc.vpk
			game+mod 								bms/bms_sound_vo_english.vpk
			game+mod 								bms/bms_maps.vpk

			// HL2 VPK files.
			game      								|all_source_engine_paths|hl2/hl2_misc.vpk
			game      								|all_source_engine_paths|hl2/hl2_sounds_misc.vpk
			game      								|all_source_engine_paths|hl2/hl2_textures.vpk
			game      								|all_source_engine_paths|hl2/hl2_materials.vpk
			game      								|all_source_engine_paths|hl2/hl2_models.vpk

			// Platform VPK files.
			platform  								|all_source_engine_paths|platform/platform_misc.vpk


			// Now search loose files.  We'll set the directory containing the gameinfo.txt file
			// as the first "mod" search path (after any user customizations).  This is also the one
			// that's used when writing to the "mod" path.
			game+mod+mod_write+default_write_path	|gameinfo_path|.
			gamebin		
							|gameinfo_path|bin

                        // Load the BMS DLL files, mod will crash without this!
			gamebin	"|all_source_engine_paths|bms/bin" 
			
			// Add the HL2 directory as a game search path.  This is also where where writes
			// to the "game" path go.
			game									hl2

			// Last, mount in shared HL2 loose files
			game									|all_source_engine_paths|hl2
			platform								|all_source_engine_paths|platform
		}
	}
}

Creating the BAT file:

Create a file, call it something like myfirstmod.bat

@echo off
if exist "%~dp0\bms.exe" (
start "" "%~dp0\bms.exe" -game myfirstmod %*
) else (
start "" "%~dp0\..\..\..\..\common\Black Mesa\bms.exe" -game myfirstmod %*
)

Also create one for the people who want to launch with oldgameui:

@echo off
if exist "%~dp0\bms.exe" (
    start "" "%~dp0\bms.exe" -game myfirstmod -oldgameui %*
) else (
    start "" "%~dp0\..\..\..\..\common\Black Mesa\bms.exe" -game myfirstmod -oldgameui %*
)

Final notes:

This should be just enough to get your mod working, you'll need to add things like sound manifests, models etc aswell.

You could customize the UI further, for example by changing the colors or the actual layout by editing the .qml inside ui/ of bms_misc_dir.vpk