Provides the core foundation to initialize and access the Steamworks GameServer API.
Functions
인터페이스 설정이 필요 없는 전역 함수입니다. 다음 함수에 대한 자세한 사항은
Steamworks API 개요 - Steam 게임 서버 문서를 참고해 주세요.
SteamGameServer_Init
inline bool SteamGameServer_Init( uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString );
Name | Type | Description |
unIP | uint32 | The IP address you are going to bind to. (This should be in host order, i.e 127.0.0.1 == 0x7f000001). You can use INADDR_ANY to bind to all local IPv4 addresses. |
usSteamPort | uint16 | The local port used to communicate with the steam servers. |
usGamePort | uint16 | The port that clients will connect to for gameplay. |
usQueryPort | uint16 | The port that will manage server browser related duties and info pings from clients. |
eServerMode | EServerMode | Sets the authentication method of the server. |
pchVersionString | const char * | The version string is usually in the form x.x.x.x, and is used by the master server to detect when the server is out of date. (Only servers with the latest version will be listed.) |
Initializes the ISteamGameServer interface object, and set server properties which may not be changed.
After calling this function, you should set any additional server parameters, and then call
ISteamGameServer::LogOnAnonymous or
ISteamGameServer::LogOn.
If you pass in
MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE into
usQueryPort
, then the game server will use GameSocketShare mode, which means that the game is responsible for sending and receiving UDP packets for the master server updater.
Returns: bool
See Also: SteamAPI_InitSteamGameServer_ReleaseCurrentThreadMemory
inline void SteamGameServer_ReleaseCurrentThreadMemory();
Frees the internal Steamworks API memory associated with the calling thread.
Most Steamworks API functions allocate a small amount of thread-local memory for parameter storage, calling this will manually free such memory. This function is called automatically by
SteamGameServer_RunCallbacks, so a program that only ever accesses the Steamworks API from a single thread never needs to explicitly call this function.
See Also: SteamAPI_ReleaseCurrentThreadMemorySteamGameServer_RunCallbacks
S_API void SteamGameServer_RunCallbacks();
Dispatches callbacks created with STEAM_GAMESERVER_CALLBACK and call results to all of the registered listeners.
It's best to call this at >10Hz, the more time between calls, the more potential latency between receiving events or results from the Steamworks API.
Most games call this once per render-frame. All registered listener functions will be invoked during this call, in the callers thread context.
SteamGameServer_RunCallbacks is safe to call from multiple threads simultaneously, but if you choose to do this, callback code could be executed on any thread. One alternative is to call SteamGameServer_RunCallbacks from the main thread only, and call
SteamGameServer_ReleaseCurrentThreadMemory regularly on other threads.
See Also: SteamGameServer_RunCallbacksSteamGameServer_Shutdown
S_API void SteamGameServer_Shutdown();
Shuts down the Steamworks GameServer API, releases pointers and frees memory.
See Also: SteamAPI_Shutdown열거형
These are enums which are defined for use with steam_gameserver.
EServerMode
Used to set the authentication and VAC status of a game server when initializing with
SteamGameServer_Init.
이름 | Value | 설명 |
eServerModeInvalid | 0 | DEPRECATED - DO NOT USE! |
eServerModeNoAuthentication | 1 | Don't authenticate user logins and don't list on the server list. |
eServerModeAuthentication | 2 | Authenticate users, list on the server list, don't run VAC on clients that connect. |
eServerModeAuthenticationAndSecure | 3 | Authenticate users, list on the server list and VAC protect clients. |