Source SDK Game Development Essentials
上QQ阅读APP看书,第一时间看更新

Creating your own modification (mod)

So you have this amazing idea for a video game and want to create your own mod. You want to include lasers and Samurai, and you want to make a fast-paced, WWII-era, team-based shoot-em-up game called Samurai Laser Paratroopers. Well, guess what—the Source engine can do this, and the Source SDK makes the mod setup easy! In this example, we will be creating a multiplayer Mod for the 2007 Source engine from a template:

  1. To create your very own Half-Life 2 mod, double-click on the Create a Mod utility.
  2. Select the Start a Multiplayer mod from a Template radio button on the first prompt of the Create a Mod wizard and then click on Next.
  3. In the first entry, specify the drive directory location where you want your game to be stored. I chose C:\SLP\ for easy access. In the second entry, specify the name of the mod you want to create, and click on Next to continue.
  4. Choose the options you want available in your mod.
  5. The wizard will then copy all the necessary files into the directory you have specified.
    Creating your own modification (mod)

The instructions are pretty straightforward. Choose carefully when you select the options shown in the following screenshot; they're harder to change later on:

Creating your own modification (mod)

Have patience, we're almost done!

Creating your own modification (mod)

Now, let's take a look at the folders the wizard has created. There are four folders in your new mod's folder (shown here as C:\SLP). Three of those folders have suffixes of "src" as shown in the following screenshot:

Creating your own modification (mod)

The mapsrc folder is where all your maps should be saved (although you can always save your maps elsewhere). All texture and material files go into the materialsrc folder, while all models should be saved in the modelsrc folder. The code generated specifically for your mod is saved in the src folder. Utilizing these folders to store all your source materials will make your life easier later on.

Restart Steam and check out your library of games. Your new mod is in there!

Creating your own modification (mod)

Also take a look at the Source SDK; your mod will be listed as one of the games in the engine build you selected, as shown in the following screenshot:

Creating your own modification (mod)

When you create a mod with the Source SDK wizard, it creates a barebones game. You will need to dive into the game code to make your mod what you want it to be. This book does not cover custom code, but it's still relevant for mapping techniques for your custom mod.