Ru/Setting up Source SDK Base 2013 Multiplayer: Difference between revisions

From Valve Developer Community
< Ru
Jump to navigation Jump to search
No edit summary
Line 79: Line 79:
Если для создания вашего проекта нужен phonemeextractor, то вам необходимо скачать [http://www.microsoft.com/en-us/download/details.aspx?id=10121 SAPI 5.1] от Microsoft. Мы не поставляем Speech SDK с Source SDK. Для установки просто поместите sapi51 в каталог src/utils/.
Если для создания вашего проекта нужен phonemeextractor, то вам необходимо скачать [http://www.microsoft.com/en-us/download/details.aspx?id=10121 SAPI 5.1] от Microsoft. Мы не поставляем Speech SDK с Source SDK. Для установки просто поместите sapi51 в каталог src/utils/.


=== Building ===
=== Создание ===
''Помните, сперва нужно [[#Создание файлов проекта и make-файлов|создать файлы проекта & make-файлы]]!''
''Помните, сперва нужно [[#Создание файлов проекта и make-файлов|создать файлы проекта & make-файлы]]!''


Line 90: Line 90:


At this point you should have '''client.dll''' and '''server.dll''' to load with the Source Engine game you based the mod on.
At this point you should have '''client.dll''' and '''server.dll''' to load with the Source Engine game you based the mod on.
=== Создание шейдеров ===
If you are adding shaders in your mod you will need to build the runtime shader files on Windows. These are the steps necessary to do that:
# Open a command prompt and CD to sp/src/materialsystem/stdshaders  (or mp/src if you are building shaders for a multiplayer mod.)
# copy build<game>shaders.bat buildmyshaders.bat
# notepad buildmyshaders.bat
#* Change SDKBINDIR to <steaminstallpath>\SteamApps\common\Source SDK Base 2013 Singleplayer\bin
# buildmyshaders.bat
You can find more information on authoring shaders in Source SDK [https://developer.valvesoftware.com/wiki/Shader_authoring/Quick_Start here].


==Mac OS X==
==Mac OS X==

Revision as of 13:09, 20 July 2013

Template:Otherlang2

Для начала скачайте исходный код размещённый на GitHub Valve Software Source SDK repository. А теперь вперёд, к созданию велик и прекрасных модов!

Скачивание исходников с GitHub

Существует несколько способов получения и обновления исходников с GitHub . Обзор основных способов, описан разделе помощи по GitHub, но прежде всего обратите внимание на использование в связке Git и GitHub.


Git репозиторий

Самый простой способ, поддерживать исходники Source SDK в актуальном состоянии - это использование Git репозитория. По сути Git является набором утилит командной строки с параметрами (CLI), но для работы с GitHub можно установить клиенты как с CLI, так и с графическим (GUI) интерфейсом.

Установка клиента для GitHub(Windows & Mac)

  1. Загрузите GitHub клиент:
  2. Установите GitHub клиент.
  3. Перейдите на репозитарий Source SDK 2013 в вашем браузере и нажмите на кнопку "Clone in Desktop".
    • В результате нажатия на кнопку откроется GitHub клиент. Далее, следуйте инструкциям, чтобы создать копию рабочего стола (Desktop) на Вашем компьютере.

Если Вы хотите обновить код, вы можете сделать это, нажав "Sync" в самом клиенте или кнопку "Sync Branch" в самом репозитарии.

Git CLI (Для всех платформ)

Подробные инструкции о том, как работать с Git на любой платформе с использованием командной строки, включая обновление с репозитария, смотрите на GitHub.

Так, например, с помощью командной строки можно создать копию source sdk 2013 на Вашем компьютере (только с установленным CLI клиентом):

> git clone git@github.com:ValveSoftware/source-sdk-2013.git

Скачивание

Можно просто скачать ZIP архив со всеми обновлениями, но соответственно загружать и обновлять код придется в ручную.

  1. Перейдите на репозитарий Source SDK 2013 в вашем браузере.
  2. Нажмите кнопку "Download ZIP".

Особенности создания файлов проекта на различных ОС

Создание файлов проекта и make-файлов

SDK 2013 использует Valve Project Creator (VPC) для создания специальных файлов платформы и make-файлов проекта. Эти специальные файлы, необходимы для создания SDK. Если после выполнения этого шага, Вы обновили какие-либо файлы, то необходимо все действия выполнить повторно.

ОС Windows

# Проект для одного игрока
> <SDK_ROOT>/sp/src/creategameprojects.bat

# Многопользовательский проект
> <SDK_ROOT>/mp/src/creategameprojects.bat

В результате должны появиться файлы с расширением *.vcxproj (Visual Studio Project) и *. SLn(Solution) в директории SRC.

ОС Mac OS X & Linux

# Проект для одного игрока
> <SDK_ROOT>/sp/src/creategameprojects

# Многопользовательский проект
> <SDK_ROOT>/mp/src/creategameprojects

В результате в Mac OS X должны появиться файлы проекта `*.mak` и Xcode в директории SRC.

в ОС Linux, `.mak` файлы будут сгенерированы в SRC директории.

Информация о VPC

Для получения дополнительной информации о том, как можно использовать скрипты VPC перейдите на страницу, или выполните следующую команду под любой ОС:

> <SDK_ROOT>/<gameType>/src/devtools/bin/vpc /help

Обратите внимание на Git репозиторий и игнорируемые файлы

Все сгенерированные файлы с помощью VPC перечислены в файле с расширением *.gitignore и игнорируются при обмене с Git репозиторием.

ОС Windows

Требования к компонентам системы

Чтобы создать Source SDK 2013 под ОС Windows вам нужно Microsoft Visual Studio 2010 с Service Pack 1. Также можно использовать Visual Studio 2012 но только при установленном Visual Studio 2010, при этом в настройках проекта не выбирать «updating», при новой компиляции (Дополнительно в комментариях на GitHub).

Если для создания вашего проекта нужен phonemeextractor, то вам необходимо скачать SAPI 5.1 от Microsoft. Мы не поставляем Speech SDK с Source SDK. Для установки просто поместите sapi51 в каталог src/utils/.

Создание

Помните, сперва нужно создать файлы проекта & make-файлы!

  1. Open the "everything" solution file for the project type you wish to make.
    • everything.sln
  2. Build the above solution.
  3. Open the solution file for the game you are building the mod for.
    • games.sln
  4. Build the above solution.

At this point you should have client.dll and server.dll to load with the Source Engine game you based the mod on.

Создание шейдеров

If you are adding shaders in your mod you will need to build the runtime shader files on Windows. These are the steps necessary to do that:

  1. Open a command prompt and CD to sp/src/materialsystem/stdshaders (or mp/src if you are building shaders for a multiplayer mod.)
  2. copy build<game>shaders.bat buildmyshaders.bat
  3. notepad buildmyshaders.bat
    • Change SDKBINDIR to <steaminstallpath>\SteamApps\common\Source SDK Base 2013 Singleplayer\bin
  4. buildmyshaders.bat

You can find more information on authoring shaders in Source SDK here.

Mac OS X

Environment & Tools Setup

Mac OS X, you will need Xcode 4.2 installed. You will also need to have "Command Line Tools" installed. You can find this at:

XCode Preferences -> "Downloads" -> "Components"

Building The Tools

Remember to create project & make files first!

To run the tools, run this command under Terminal:

> make -f games.mak

When successfully built, you should have client.dylib and server.dylib files to load with the Source SDK Base 2013 of your choice.

Linux

Steam Client Runtime

To build the Source SDK 2013 on Linux you will need the Steam Client Runtime.

  1. Download the Steam Client Runtime.
  2. Run the following commands to extract the runtime:
> tar xvf steam-runtime-sdk_latest.tar.xz
> cd steam-runtime-sdk_<version>

Replace <version> with the version you just unpacked.

> ./setup.sh

Pick your architecture and debug/release preferences. Then answer Y to everything else.

> ./shell.sh --arch=i386

SDK Build

Remember to create project & make files first!

With the above prerequisite installed, run the following:

> make -f games.mak

At this point you should have client.so and server.so files to load with the Source SDK Base 2013 of your choice. More instructions on using the Steam runtime can be found in README.txt in the installed runtime directory.

Code Organization

Naming Conventions

The Source SDK is split into two directories at the root for <gameType>, followed by source for <gameName>. If you are building a single player mod, use the "sp" directory. If you are building a multi-player mod you should base yourself on the code in the "mp" directory.

  • <gameType>
    • sp (singleplayer)
    • mp (multiplayer)
  • <gameName>
    • hl2 (Half-Life 2)
    • episodic (Half-Life 2 Episodes)
    • hl2mp (Half-Life 2: Deathmatch)

Each directory has a matching Source SDK 2013 Base appID to use to get the base mod files:

These two base apps are very similar, differing mostly in update schedule. The Singleplayer base will only update with HL2 and the Episodes do, which isn't very often. The Multiplayer base will update a few times a year to incorporate engine changes from TF2 and Counter-Strike: Source. None of these updates should break mod compatibility.

Directory Structure

Under each of these directories is a very similar directory structure:

  • game - Runtime files for the mods themselves. Your mod content will go in here.
  • src - All the source code for that kind of mod. The root of the src directory contains .sln or root level .mak files for building the source.
    • common - A few files used by the server and client DLLs
    • devtools - Scripts and utilities that are used to build the source. These are called by the makefiles and projects and you probably won't need to interact with them directly.
    • game - All of the source code for the DLLs.
      • client - Code used by client.dll (or client.dylib or client.so). There are also game-specific directories under here.
      • server - Code used by server.dll. There are also game-specific directories under here.
      • shared - Code used by both client.dll and server.dll.
    • gcsdk - A couple of tools used to build the DLLs.
    • lib - Binary versions of the libraries that the source code depends on. This is also the build target for vgui_controls, tier1, and mathlib.
    • mathlib - Math utilities used by the game.
    • public - Header files for all of the DLLs and libraries that are used by the game. Also includes a few source files.
    • thirdparty - Third party libraries needed to build the source. At the moment this contains only the Google Protocol Buffers (protobuf) library.
    • tier1 - Useful utility classes. Builds into tier1.lib
    • utils - Various development utilities
    • vgui2 - Source code for vgui_controls, which is used by client.dll.

We recommend that you follow the conventions here as you add files for your own mod.

Common Errors

Common errors encountered in SDK 2013. Please use Discussion before posting other solutions.

"ERROR: Unable to find RegKey for .vcproj files in solutions." while generating project files

This problem is usually caused by missing file extensions associations in the your system registry.

Visual Studio 2010

Warning.pngПредупреждение:Make sure to have 2010 Visual Studio Service Pack 1 or later installed.
  • Open Registry Editor
    1. Windows key + R
    2. Type 'regedit' without quotes and then hit Enter.
  • Navigate to one of the following registry keys, based on the operating system you're currently using:
# For 32-bit (x86) Operating Systems:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Projects\{60dc8134-eba5-43b8-bcc9-bb4bc16c2548}

# For 64-bit (x64) Operating Systems:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Projects\{60dc8134-eba5-43b8-bcc9-bb4bc16c2548}
  • At the key, you will need to create a new string value.
    1. Navigate to: New > String Value
    2. Fill out the following information:
      • Name: DefaultProjectExtension
      • Value: vcproj
    3. Click "OK" to save the registry key.

Visual Studio 2012

A tool has been created by a member of the community to fix this type of error on Visual Studio 2012. Use at your own risk. Download source from GitHub (AutoIt v3 is needed).

vgui_controls Doesn't Compile

This problem is usually fixed by obtaining a fresh copy from the SDK distribution. If you're using a local GitHub repository, do a Sync (pull) on your repository. Otherwise you can download and reapply the ZIP file.