Servidores puros

From Valve Developer Community
Jump to: navigation, search
English (en)español (es)
... Icon-Important.png

Un servidor puro es el que fuerza a todos los clientes del servidor a utilizar el contenido predeterminado. Esto, junto al comando sv_consistency, evita que se hagan trampas modificando el contenido del juego, por ejemplo aumentando el tamaño de los modelos o el ruido de las pisadas, así como haciendo las paredes de texturas invisibles.


Utilización básica

Para hace que un servidor sea puro, se debe introducir el comando sv_pure con valor 1 o 2.

En este momento el servidor expulsará a la gente con contenido personalizado. Para evitar eso, hay que establecer sv_pure_kick_clients en 0, así solo se advertirá de que tienen contenido "impuro", es decir, personalizado. En este caso el servidor forzará a utilizar el contenido del juego en vez de expulsar a los jugadores.

En los juegos Source (HL2:DM, DoD:S, CS:S o TF2), sv_pure debe estar activado en la consola, antes de que el juego cargue los archivos .VPK.


Detalles del modo 1

En este modo todo el contenido que se recoja en el archivo pure_server_whitelist.txt sera el predeterminado. Los administradores del servidor pueden editar el archivo. De esta forma se pueden permitir, por ejemplo, modelos para las armas, pero prohibir las modificaciones de sonido para pisadas.

Detalles del modo 2

En este modo todo el contenido del juego es predeterminado. Es como ejecutar el modo uno con todos los archivos de Steam en la lista blanca.

sv_consistency y modo -1

Los juegos Source ya no tienen sv_consistency. Esto se ha combinado con sv_pure. sv_pure 0 es el equivalente a sv_pure 0 y sv_consistency 1 en juegos anteriores. sv_pure -1 es el equivalente a sv_pure 0 y sv_consistency 0.

Formato de la lista blanca

La lista blanca es el pure_server_whitelist.txt que se encuentra en /hl2/. Se utiliza en CS:GO, juegos Source de 2009 y antes del motor Source.

El archivo se ha movido al directorio /cfg/ del juego en los juegos multijugador Source.

El pure_server_whitelist.txt especifica qué modificaciones se permiten. Cada línea especifica un archivo o grupo de archivos y sus atributos. Aquí se muestra un ejemplo:

materials\...    from_steam

La primera parte ("materials\...") especifica los archivos. En este caso se especifican todos los archivos del directorio "materials". La segunda parte ("from_steam") especifica qué atributos se aplicarán a dichos archivos. En este caso se utilizarán los de Steam.

Aquí se muestran tres formas de especificar un grupo de archivos:

Por nombre del archivo
materials\models\props\cs_assault\wirepipe.vtf
Todos los archivos del directorio
materials\models\props\cs_assault\*.*
Blank image.pngPendiente: Would *.vtf work too?
Todos los archivos de un directorio y sus subdirectorios
materials\models\...

Y hay otras tres formas de especificar un atributo:

from_steam
Se obliga al jugador a utilizar los modelos de Steam que ya tiene en su disco duro. Reemplazado por trusted_source en juegos multijugador Source.
allow_from_disk
Se permite a los jugadores cargar los archivos específicos del disco. No tienen por qué coincidir con los del servidor. Estos archivos están completamente desprotegidos. Reemplazado por any en juegos multijugador Source.
allow_from_disk+check_crc
Los jugadores pueden cargar los archivos específicos del disco, pero sus discos deben tener los archivos del servidor. Reemplazado por las claves VPK en trusted_keys.txt en juegos multijugador Source.

Ejemplos

   materials\models\player\...                      allow_from_disk
   sounds\...                                       from_steam
   models\MyMod\...                                 allow_from_disk+check_crc
   materials\MyMod\Customizable\*.*                 allow_from_disk
   materials\models\props\cs_assault\wirepipe.vtf   from_steam

Atributos predetermiandos

If sv_pure is set to 1, the default attribute for all files is allow_from_disk. So if you had an empty pure_server_whitelist.txt file and you set sv_pure to 1, there would be no difference from sv_pure 0.

Note.pngNota:The default pure_server_whitelist.txt file that ships with the Source Engine does in fact have settings, so even if you don't modify the default pure_server_whitelist.txt, sv_pure 1 will still enforce most content.

Archivo pure_server_whitelist.txt de origen

The default pure_server_whitelist.txt file that ships with the game looks like this. If you want to begin making changes to the whitelist file, you can start with this.

whitelist
{
	//
	// 3 modifiers are allowed on file specifications:
	//
	//	from_steam		- only check the Steam cache for the file (ignore anything on disk)
	//	allow_from_disk		- allow the file to come from disk
	//	check_crc		- used with allow_from_disk - server does CRC checks on the client's file to make sure it matches
	//
	//	The default modifier on all files is allow_from_disk. Thus, all files can come from disk and don't need CRC checks unless 
	//	allow_from_disk can be set at the same time as check_crc. Use the + character in between them to signify this: allow_from_disk+check_crc.


	//
	// Three types of file specifications:
	//
	//	1. directory\*.*	- refers to all files under the directory
	//	2. directory\...	- refers to all files under the directory and all directories under that (recursively)
	//	3. directory\filename	- refers to a single file
	

	//	
	// By default, when in pure server mode, most content file types are only allowed to come from Steam.
	//
	materials\...			from_steam
	models\...			from_steam
	sound\...			from_steam
	
	
	//
	// Allow custom player models. Don't do CRC checks on them because the clients may all
	// have different custom models and the server won't have them all.
	//	
	models\player\...		allow_from_disk
	materials\models\player\...	allow_from_disk


	//
	// Allow custom spray decals.
	//
	materials\temp\...		allow_from_disk
	materials\vgui\logos\...	allow_from_disk
	materials\vgui\logos\ui\...	allow_from_disk
	
        //
        // Allow replay browser thumbnails.
        //
        materials\vgui\replay\thumbnails\...   allow_from_disk

	//
	// (Uncomment and edit these for mods).
	// Allow mod resources to come from disk.
	//
	// materials\mymod\...		allow_from_disk+check_crc
	// models\mymod\...		allow_from_disk+check_crc
	// sound\mymod\...		allow_from_disk+check_crc
}

For SteamPipe Source MP games, from_steam; allow_from_disk; and check_crc were deprecated. They were replaced with trusted_source; any; and the ability to validate signed VPKs based on their public keys.

El nuevo es:

whitelist
{
        // Example custom server whitelist.
        //
        // Do not modify this file.  Instead, rename this file to "pure_server_whitelist.txt" and then modify it as appropriate.
        //
        // sv_pure values are in order of "increasing pureness":
        //
        //   -1: No restrictions.  Allow clients to load any files.
        //    0: Only load pure_server_minimal.txt.
        //    1: Load pure_server_full.txt, followed by pure_server_whitelist.txt (the custom file).
        //       Also, in this mode, the server may specify additional public keys that it considers to be trusted.
        //    2: Load pure_server_full.txt only.
        //       In this mode, user only the public keys listed in trusted_keys_base are used.
        //
        // If multiple rules apply to the same file, then the rule listed later (or from the file loaded later) takes priority.
        // Therefore, because the custom whitelist file is loaded last, after a fully pure whitelist has been loaded, typically
        // the custom whitelist file is used to carve out exceptions (where the server wants to be more permissive), rather than
        // listing the files that are requested to be.
        //
        // 2 different rule types may be used:
        //
        //      trusted_source - require file to be loaded from a "trusted source".
        //                   A trusted source is a VPK that is signed with one of the public keys listed
        //                   in trusted_keys_base.txt or trusted_keys.txt.
        //      any - Client can use file from any source.
        //
        // For historical purposes, the following strings are also allowed:
        //
        //      allow_from_disk           - same as "any"
        //      from_steam                - same as "trusted_source"
        //  check_crc                 - same as "trusted_source"
        //  allow_from_disk+check_crc - same as "trusted_source"

        //
        // Three types of file specifications:
        //
        //      1. directory\*.*                        - refers to all files under the directory
        //      2. directory\...                        - refers to all files under the directory and all directories under that (recursively)
        //      3. directory\filename           - refers to a single file

        //
        // Allow custom player models.
        //
        models\player\...           any
        materials\models\player\... any

        //
        // Allow custom spray decals.
        //
        materials\temp\...          any
        materials\vgui\logos\...    any
        materials\vgui\logos\ui\... any

        //
        // Allow "mymod" resources to come from disk.
        //
        materials\mymod\... any
        models\mymod\...    any
        sound\mymod\...     any
}


Stacking

The attributes for files are applied in top-down order in the pure_server_whitelist.txt file. This way, you can apply one attribute to a large set of files and a different attribute to a subset of those files. For example, if you wanted to force all models to come from Steam except the models under models\MyMod, you could add these lines to your pure_server_whitelist.txt file:

   models\...         from_steam
   models\MyMod\...   allow_from_disk+check_crc

Utilización avanzada

If you set sv_pure to 2, then the server will not even load the pure_server_whitelist.txt file. Instead, it will apply the from_steam attribute to all materials, models, and sounds. This can be useful for competitive matches where one team is hosting the game. The team who is not hosting the game can look in their console at round start and see which sv_pure mode the server is using. If the server is using sv_pure 2, then the non-hosting team can know that the players on the hosting team are not using custom content.

Errores

Source SDK 2007 apparently has problems when checking directories having files as well as directories on the Linux platform (Windows behaves correctly).

For example doing something like this would lead to sv_pure error when the MyModDecals contain files and some subdirectories:

materials\MyModDecals\*.* allow_from_disk+crc_check
or
materials\MyModDecals\... allow_from_disk+crc_check


You should avoid this and put the files into their subdirectories and check them separately.

Performance

There are two places where sv_pure will affect performance.

When the server loads its first map with sv_pure set to 1, it has to calculate file CRCs for all files marked as allow_from_disk+check_crc.
Generally, this set of files should be set to the minimal set of files. If, for example, the pure_server_whitelist.txt file had a line like materials\... allow_from_disk+check_crc, the server would pause for a very long time the first time it loaded a map because it would calculate CRCs for every single material file in the game.
Setting sv_pure to 2 will not affect server performance because the server does not need to calculate CRCs.
When a client loads a map and the value of sv_pure has changed, the client will reload any content necessary to make sure it is obeying the pure server's rules.
So if the client had many materials, models, and sounds that were customized on a previous server and then connected to a pure server, the client would have to reload all those materials, models, and sounds.
Generally, the performance hit on the client is negligible because the client will only flush out a few files when connecting to a pure server.