6324: Optimize client ids map update r=def- a=0xfaulty

I have launched support for 128 players in testing mode on my server, it's means it's time for another step in this direction here. Perhaps not all changes will be clear, I am ready to answer/discuss them as usual. Let me know if I forgot or didn't take anything into account.

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


6345: Set constant and uniform names for the server and client CMake targets r=def- a=Kaffeine

This MR set the server and client CMake target names to `game-server` and `game-client` which are uniform with other targets such as `engine-gfx`, `engine-shared`, and `game-shared`.

Set uniform names for the targets to:
1. Avoid long rebuilds on the target _executable_ name changed
2. Provide the same name for different executables and/or different setup (use-cases are `cmake --build . --target game-server` and various CMake target lookups in IDEs)

Those changes are necessary but not enough to allow CI for custom app name on all platforms.

Personally this 'll allow me switch to between DDNet and Infclass branches faster and without breaking the targets configuration (e.g. with that patchset I can have `game-client` as an active target in both branches), and also reduces the conflicts in `CMakeLists.txt`.
Easier to switch between the forks => easier to contribute.

Co-authored-by: Valentin Bashkirov <valenteen3d@ya.ru>
Co-authored-by: Valentin Bashkirov <v.bashkirov@dev.tassta.com>
Co-authored-by: Alexander Akulich <akulichalexander@gmail.com>
This commit is contained in:
bors[bot] 2023-03-05 16:53:37 +00:00 committed by GitHub
commit 5107b38d04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 103 additions and 148 deletions

View file

@ -2341,11 +2341,12 @@ if(CLIENT)
endif()
if(TARGET_OS STREQUAL "windows")
configure_file("other/manifest/client.manifest.in" "client.manifest")
set(CLIENT_ICON "other/icons/DDNet.rc")
if(NOT MINGW)
set(CLIENT_MANIFEST "other/manifest/DDNet.manifest")
set(CLIENT_MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/client.manifest")
else()
set(CLIENT_MANIFEST "other/manifest/DDNet.rc")
set(CLIENT_MANIFEST "other/manifest/client.rc")
set_target_properties(${TARGET_STEAMAPI} PROPERTIES PREFIX "")
endif()
else()
@ -2354,10 +2355,8 @@ if(CLIENT)
endif()
# Target
set(TARGET_CLIENT ${CLIENT_EXECUTABLE})
if(TARGET_OS STREQUAL "android")
add_library(${TARGET_CLIENT} SHARED
add_library(game-client SHARED
${CLIENT_SRC}
${CLIENT_ICON}
${CLIENT_MANIFEST}
@ -2368,7 +2367,7 @@ if(CLIENT)
$<TARGET_OBJECTS:rust-bridge-shared>
)
else()
add_executable(${TARGET_CLIENT} WIN32
add_executable(game-client WIN32
${CLIENT_SRC}
${CLIENT_ICON}
${CLIENT_MANIFEST}
@ -2379,13 +2378,16 @@ if(CLIENT)
$<TARGET_OBJECTS:rust-bridge-shared>
)
endif()
target_link_libraries(${TARGET_CLIENT} ${LIBS_CLIENT})
set_property(TARGET game-client
PROPERTY OUTPUT_NAME ${CLIENT_EXECUTABLE}
)
target_link_libraries(game-client ${LIBS_CLIENT})
if(MSVC)
target_link_options(${TARGET_CLIENT} PRIVATE /ENTRY:mainCRTStartup)
target_link_options(game-client PRIVATE /ENTRY:mainCRTStartup)
endif()
target_include_directories(${TARGET_CLIENT} SYSTEM PRIVATE
target_include_directories(game-client SYSTEM PRIVATE
${FREETYPE_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS}
${OGG_INCLUDE_DIRS}
@ -2403,7 +2405,7 @@ if(CLIENT)
)
if(STEAMAPI_KIND STREQUAL SHARED OR DISCORD_DYNAMIC)
set_own_rpath(${TARGET_CLIENT})
set_own_rpath(game-client)
endif()
set(PARAMS "${WAVPACK_INCLUDE_DIRS};${WAVPACK_INCLUDE_DIRS}")
@ -2420,23 +2422,23 @@ if(CLIENT)
set(CMAKE_REQUIRED_LIBRARIES ${ORIGINAL_CMAKE_REQUIRED_LIBRARIES})
if(WAVPACK_OPEN_FILE_INPUT_EX)
target_compile_definitions(${TARGET_CLIENT} PRIVATE CONF_WAVPACK_OPEN_FILE_INPUT_EX)
target_compile_definitions(game-client PRIVATE CONF_WAVPACK_OPEN_FILE_INPUT_EX)
endif()
if(WAVPACK_CLOSE_FILE)
target_compile_definitions(${TARGET_CLIENT} PRIVATE CONF_WAVPACK_CLOSE_FILE)
target_compile_definitions(game-client PRIVATE CONF_WAVPACK_CLOSE_FILE)
endif()
if(GLEW_BUNDLED)
target_compile_definitions(${TARGET_CLIENT} PRIVATE CONF_GLEW_HAS_CONTEXT_INIT)
target_compile_definitions(game-client PRIVATE CONF_GLEW_HAS_CONTEXT_INIT)
endif()
if(VULKAN)
target_compile_definitions(${TARGET_CLIENT} PRIVATE CONF_BACKEND_VULKAN)
target_compile_definitions(game-client PRIVATE CONF_BACKEND_VULKAN)
endif()
list(APPEND TARGETS_OWN ${TARGET_CLIENT})
list(APPEND TARGETS_LINK ${TARGET_CLIENT})
list(APPEND TARGETS_OWN game-client)
list(APPEND TARGETS_LINK game-client)
endif()
@ -2558,8 +2560,7 @@ if(SERVER)
)
# Target
set(TARGET_SERVER ${SERVER_EXECUTABLE})
add_executable(${TARGET_SERVER}
add_executable(game-server
${DEPS}
${SERVER_SRC}
${SERVER_ICON}
@ -2567,18 +2568,23 @@ if(SERVER)
$<TARGET_OBJECTS:game-shared>
$<TARGET_OBJECTS:rust-bridge-shared>
)
target_link_libraries(${TARGET_SERVER} ${LIBS_SERVER})
target_include_directories(${TARGET_SERVER} PRIVATE ${PNG_INCLUDE_DIRS})
list(APPEND TARGETS_OWN ${TARGET_SERVER})
list(APPEND TARGETS_LINK ${TARGET_SERVER})
set_property(TARGET game-server
PROPERTY OUTPUT_NAME ${SERVER_EXECUTABLE}
)
target_link_libraries(game-server ${LIBS_SERVER})
target_include_directories(game-server PRIVATE ${PNG_INCLUDE_DIRS})
list(APPEND TARGETS_OWN game-server)
list(APPEND TARGETS_LINK game-server)
if(TARGET_OS AND TARGET_OS STREQUAL "mac")
set(SERVER_LAUNCHER_SRC src/macos/server.mm)
set(TARGET_SERVER_LAUNCHER ${TARGET_SERVER}-Launcher)
add_executable(${TARGET_SERVER_LAUNCHER} ${SERVER_LAUNCHER_SRC})
target_link_libraries(${TARGET_SERVER_LAUNCHER} ${COCOA})
list(APPEND TARGETS_OWN ${TARGET_SERVER_LAUNCHER})
list(APPEND TARGETS_LINK ${TARGET_SERVER_LAUNCHER})
add_executable(game-server-launcher ${SERVER_LAUNCHER_SRC})
set_property(TARGET game-server-launcher
PROPERTY OUTPUT_NAME ${SERVER_EXECUTABLE}-Launcher
)
target_link_libraries(game-server-launcher ${COCOA})
list(APPEND TARGETS_OWN game-server-launcher)
list(APPEND TARGETS_LINK game-server-launcher)
endif()
endif()
@ -2616,6 +2622,7 @@ if(TOOLS)
string(REGEX REPLACE "\\.cpp$" "" TOOL "${T}")
set(TOOL_DEPS ${DEPS})
set(TOOL_LIBS ${LIBS})
unset(EXTRA_TOOL_SRC)
if(TOOL MATCHES "^(dilate|map_convert_07|map_create_pixelart|map_optimize|map_extract|map_replace_image)$")
list(APPEND TOOL_INCLUDE_DIRS ${PNG_INCLUDE_DIRS})
list(APPEND TOOL_DEPS $<TARGET_OBJECTS:engine-gfx>)
@ -2801,7 +2808,7 @@ add_custom_target(run_rust_tests
add_custom_target(run_integration_tests
COMMAND ${PROJECT_BINARY_DIR}/integration_test.sh ${INTEGRATIONTESTRUNNER_ARGS}
COMMENT Running integration tests
DEPENDS ${TARGET_CLIENT} ${TARGET_SERVER}
DEPENDS game-client game-server
USES_TERMINAL
)
@ -2969,8 +2976,8 @@ else()
endif()
set(CPACK_TARGETS
${TARGET_CLIENT}
${TARGET_SERVER}
game-client
game-server
${TARGET_TOOLS}
)
if(STEAMAPI_KIND STREQUAL SHARED)
@ -2999,11 +3006,11 @@ endif()
if(NOT DEV)
include(GNUInstallDirs)
install(DIRECTORY data DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ddnet COMPONENT data)
install(TARGETS ${TARGET_CLIENT} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
install(TARGETS game-client DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT client)
if(STEAMAPI_KIND STREQUAL SHARED)
install(TARGETS ${TARGET_STEAMAPI} DESTINATION ${CMAKE_INSTALL_LIBDIR}/ddnet COMPONENT client)
endif()
install(TARGETS ${TARGET_SERVER} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server)
install(TARGETS game-server DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server)
if(ANTIBOT)
install(TARGETS ${TARGET_ANTIBOT} DESTINATION ${CMAKE_INSTALL_LIBDIR}/ddnet COMPONENT server)
endif()
@ -3040,17 +3047,17 @@ if(CLIENT AND DMGBUILD)
set(DMG_TMPDIR pack_${CPACK_PACKAGE_FILE_NAME}_dmg)
set(DMG_MKDIRS
${TARGET_CLIENT}.app
${TARGET_CLIENT}.app/Contents
${TARGET_CLIENT}.app/Contents/Frameworks
${TARGET_CLIENT}.app/Contents/MacOS
${TARGET_CLIENT}.app/Contents/Resources
${TARGET_SERVER}.app
${TARGET_SERVER}.app/Contents
${TARGET_SERVER}.app/Contents/MacOS
${TARGET_SERVER}.app/Contents/Resources
${TARGET_SERVER}.app/Contents/Resources/data
${TARGET_SERVER}.app/Contents/Resources/data/mapres
${CLIENT_EXECUTABLE}.app
${CLIENT_EXECUTABLE}.app/Contents
${CLIENT_EXECUTABLE}.app/Contents/Frameworks
${CLIENT_EXECUTABLE}.app/Contents/MacOS
${CLIENT_EXECUTABLE}.app/Contents/Resources
${SERVER_EXECUTABLE}.app
${SERVER_EXECUTABLE}.app/Contents
${SERVER_EXECUTABLE}.app/Contents/MacOS
${SERVER_EXECUTABLE}.app/Contents/Resources
${SERVER_EXECUTABLE}.app/Contents/Resources/data
${SERVER_EXECUTABLE}.app/Contents/Resources/data/mapres
)
set(DMG_MKDIR_COMMANDS)
foreach(dir ${DMG_MKDIRS})
@ -3067,39 +3074,39 @@ if(CLIENT AND DMGBUILD)
${DMG_MKDIR_COMMANDS}
# CLIENT
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/data ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Resources/data
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/other/icons/${TARGET_CLIENT}.icns ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Resources/
COMMAND ${CMAKE_COMMAND} -E copy bundle/client/Info.plist ${PROJECT_SOURCE_DIR}/other/bundle/client/PkgInfo ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${TARGET_CLIENT}> ${TARGET_TOOLS_FILES} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/ddnet-libs/sdl/${LIB_DIR}/SDL2.framework ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/SDL2.framework
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/discord/${LIB_DIR}/discord_game_sdk.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/freetype/${LIB_DIR}/libfreetype.6.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/png/${LIB_DIR}/libpng16.16.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavcodec.59.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavformat.59.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavutil.57.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswresample.4.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswscale.6.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/libsteam_api.dylib ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/Frameworks/
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_strip_rpath.py ${CMAKE_OTOOL} ${CMAKE_INSTALL_NAME_TOOL} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT}
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @loader_path/../Frameworks ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_CLIENT}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/data ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Resources/data
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/other/icons/${CLIENT_EXECUTABLE}.icns ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Resources/
COMMAND ${CMAKE_COMMAND} -E copy bundle/client/Info.plist ${PROJECT_SOURCE_DIR}/other/bundle/client/PkgInfo ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:game-client> ${TARGET_TOOLS_FILES} ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/MacOS/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/ddnet-libs/sdl/${LIB_DIR}/SDL2.framework ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/SDL2.framework
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/discord/${LIB_DIR}/discord_game_sdk.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/freetype/${LIB_DIR}/libfreetype.6.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/png/${LIB_DIR}/libpng16.16.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavcodec.59.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavformat.59.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavutil.57.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswresample.4.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswscale.6.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/libsteam_api.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_strip_rpath.py ${CMAKE_OTOOL} ${CMAKE_INSTALL_NAME_TOOL} ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/MacOS/${CLIENT_EXECUTABLE}
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @loader_path/../Frameworks ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/MacOS/${CLIENT_EXECUTABLE}
# SERVER
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/data/maps ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/Resources/data/maps
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/other/icons/${TARGET_SERVER}.icns ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/Resources/
COMMAND ${CMAKE_COMMAND} -E copy bundle/server/Info.plist ${PROJECT_SOURCE_DIR}/other/bundle/server/PkgInfo ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${TARGET_SERVER}> $<TARGET_FILE:${TARGET_SERVER_LAUNCHER}> ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/MacOS/
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_strip_rpath.py ${CMAKE_OTOOL} ${CMAKE_INSTALL_NAME_TOOL} ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/MacOS/${TARGET_SERVER}
COMMAND ${CMAKE_COMMAND} -E copy ${DMG_TMPDIR}/${TARGET_SERVER}.app/Contents/MacOS/${TARGET_SERVER} ${DMG_TMPDIR}/${TARGET_CLIENT}.app/Contents/MacOS/${TARGET_SERVER}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/data/maps ${DMG_TMPDIR}/${SERVER_EXECUTABLE}.app/Contents/Resources/data/maps
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/other/icons/${SERVER_EXECUTABLE}.icns ${DMG_TMPDIR}/${SERVER_EXECUTABLE}.app/Contents/Resources/
COMMAND ${CMAKE_COMMAND} -E copy bundle/server/Info.plist ${PROJECT_SOURCE_DIR}/other/bundle/server/PkgInfo ${DMG_TMPDIR}/${SERVER_EXECUTABLE}.app/Contents/
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:game-server> $<TARGET_FILE:game-server-launcher> ${DMG_TMPDIR}/${SERVER_EXECUTABLE}.app/Contents/MacOS/
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_strip_rpath.py ${CMAKE_OTOOL} ${CMAKE_INSTALL_NAME_TOOL} ${DMG_TMPDIR}/${SERVER_EXECUTABLE}.app/Contents/MacOS/${SERVER_EXECUTABLE}
COMMAND ${CMAKE_COMMAND} -E copy ${DMG_TMPDIR}/${SERVER_EXECUTABLE}.app/Contents/MacOS/${SERVER_EXECUTABLE} ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/MacOS/${SERVER_EXECUTABLE}
# DMG
COMMAND dmgbuild -s ${PROJECT_SOURCE_DIR}/other/dmgsettings.py -D client=${DMG_TMPDIR}/${TARGET_CLIENT}.app -D server=${DMG_TMPDIR}/${TARGET_SERVER}.app -D background=${PROJECT_SOURCE_DIR}/other/dmgbackground.png "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}" ${CPACK_PACKAGE_FILE_NAME}.dmg
COMMAND dmgbuild -s ${PROJECT_SOURCE_DIR}/other/dmgsettings.py -D client=${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app -D server=${DMG_TMPDIR}/${SERVER_EXECUTABLE}.app -D background=${PROJECT_SOURCE_DIR}/other/dmgbackground.png "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}" ${CPACK_PACKAGE_FILE_NAME}.dmg
DEPENDS
${TARGET_CLIENT}
game-client
${TARGET_STEAMAPI}
${TARGET_SERVER_LAUNCHER}
${TARGET_SERVER}
game-server-launcher
game-server
${PROJECT_BINARY_DIR}/bundle/client/Info.plist
${PROJECT_BINARY_DIR}/bundle/server/Info.plist
data
@ -3107,8 +3114,8 @@ if(CLIENT AND DMGBUILD)
other/bundle/server/PkgInfo
other/dmgbackground.png
other/dmgsettings.py
other/icons/${TARGET_CLIENT}.icns
other/icons/${TARGET_SERVER}.icns
other/icons/${CLIENT_EXECUTABLE}.icns
other/icons/${SERVER_EXECUTABLE}.icns
)
add_custom_target(package_dmg DEPENDS ${CPACK_PACKAGE_FILE_NAME}.dmg)
list(APPEND PACKAGE_TARGETS package_dmg)
@ -3203,7 +3210,7 @@ source_group_tree(src)
if(ANTIBOT)
# Allow the antibot library to use functions from the server binary.
add_cxx_compiler_flag_if_supported(OUR_FLAGS_LINK -rdynamic)
set_own_rpath(${TARGET_SERVER})
set_own_rpath(game-server)
endif()
set(TARGETS ${TARGETS_OWN} ${TARGETS_DEP})

View file

@ -1,2 +0,0 @@
#include "winuser.h"
1 RT_MANIFEST DDNet.manifest

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="DDNet.exe"/>
<assemblyIdentity version="1.0.0.0" name="${CLIENT_EXECUTABLE}.exe"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">

2
other/manifest/client.rc Normal file
View file

@ -0,0 +1,2 @@
#include "winuser.h"
1 RT_MANIFEST client.manifest

View file

@ -109,6 +109,11 @@ inline float length(const vector2_base<float> &a)
return std::sqrt(dot(a, a));
}
inline float length_squared(const vector2_base<float> &a)
{
return dot(a, a);
}
constexpr inline float angle(const vector2_base<float> &a)
{
if(a.x == 0 && a.y == 0)

View file

@ -544,7 +544,6 @@ public:
virtual int WindowOpen() = 0;
};
extern IEngineGraphics *CreateEngineGraphics();
extern IEngineGraphics *CreateEngineGraphicsThreaded();
#endif

View file

@ -3869,27 +3869,6 @@ const char *CGameContext::NetVersion() const { return GAME_NETVERSION; }
IGameServer *CreateGameServer() { return new CGameContext; }
bool CGameContext::PlayerCollision()
{
float Temp;
m_Tuning.Get("player_collision", &Temp);
return Temp != 0.0f;
}
bool CGameContext::PlayerHooking()
{
float Temp;
m_Tuning.Get("player_hooking", &Temp);
return Temp != 0.0f;
}
float CGameContext::PlayerJetpack()
{
float Temp;
m_Tuning.Get("player_jetpack", &Temp);
return Temp;
}
void CGameContext::OnSetAuthed(int ClientID, int Level)
{
if(m_apPlayers[ClientID])

View file

@ -514,9 +514,6 @@ public:
void SendRecord(int ClientID);
void OnSetAuthed(int ClientID, int Level) override;
virtual bool PlayerCollision();
virtual bool PlayerHooking();
virtual float PlayerJetpack();
void ResetTuning();
};

View file

@ -207,12 +207,16 @@ void CGameWorld::UpdatePlayerMaps()
{
if(!Server()->ClientIngame(i))
continue;
if(Server()->GetClientVersion(i) >= VERSION_DDNET_OLD)
continue;
int *pMap = Server()->GetIdMap(i);
// compute distances
for(int j = 0; j < MAX_CLIENTS; j++)
{
Dist[j].second = j;
if(j == i)
continue;
if(!Server()->ClientIngame(j) || !GameServer()->m_apPlayers[j])
{
Dist[j].first = 1e10;
@ -224,65 +228,29 @@ void CGameWorld::UpdatePlayerMaps()
Dist[j].first = 1e9;
continue;
}
// copypasted chunk from character.cpp Snap() follows
CCharacter *pSnapChar = GameServer()->GetPlayerChar(i);
if(pSnapChar && !pSnapChar->IsSuper() &&
!GameServer()->m_apPlayers[i]->IsPaused() && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS &&
!pChr->CanCollide(i) &&
(!GameServer()->m_apPlayers[i] ||
GameServer()->m_apPlayers[i]->GetClientVersion() == VERSION_VANILLA ||
(GameServer()->m_apPlayers[i]->GetClientVersion() >= VERSION_DDRACE &&
(GameServer()->m_apPlayers[i]->m_ShowOthers == SHOW_OTHERS_OFF ||
(GameServer()->m_apPlayers[i]->m_ShowOthers == SHOW_OTHERS_ONLY_TEAM && !GameServer()->m_apPlayers[i]->GetCharacter()->SameTeam(j))))))
if(!pChr->CanSnapCharacter(i))
Dist[j].first = 1e8;
else
Dist[j].first = 0;
Dist[j].first += distance(GameServer()->m_apPlayers[i]->m_ViewPos, GameServer()->m_apPlayers[j]->GetCharacter()->m_Pos);
Dist[j].first = length_squared(GameServer()->m_apPlayers[i]->m_ViewPos - pChr->m_Pos);
}
// always send the player themselves
Dist[i].first = 0;
// compute reverse map
int aReverseMap[MAX_CLIENTS];
for(int &j : aReverseMap)
{
j = -1;
}
for(int j = 0; j < VANILLA_MAX_CLIENTS; j++)
{
if(pMap[j] == -1)
continue;
if(Dist[pMap[j]].first > 5e9f)
pMap[j] = -1;
else
aReverseMap[pMap[j]] = j;
}
// always send the player themselves, even if all in same position
Dist[i].first = -1;
std::nth_element(&Dist[0], &Dist[VANILLA_MAX_CLIENTS - 1], &Dist[MAX_CLIENTS], distCompare);
int Mapc = 0;
int Demand = 0;
int Index = 1; // exclude self client id
for(int j = 0; j < VANILLA_MAX_CLIENTS - 1; j++)
{
int k = Dist[j].second;
if(aReverseMap[k] != -1 || Dist[j].first > 5e9f)
pMap[j + 1] = -1; // also fill player with empty name to say chat msgs
if(Dist[j].second == i || Dist[j].first > 5e9f)
continue;
while(Mapc < VANILLA_MAX_CLIENTS && pMap[Mapc] != -1)
Mapc++;
if(Mapc < VANILLA_MAX_CLIENTS - 1)
pMap[Mapc] = k;
else
Demand++;
pMap[Index++] = Dist[j].second;
}
for(int j = MAX_CLIENTS - 1; j > VANILLA_MAX_CLIENTS - 2; j--)
{
int k = Dist[j].second;
if(aReverseMap[k] != -1 && Demand-- > 0)
pMap[aReverseMap[k]] = -1;
}
pMap[VANILLA_MAX_CLIENTS - 1] = -1; // player with empty name to say chat msgs
// sort by real client ids, guarantee order on distance changes, O(Nlog(N)) worst case
// sort just clients in game always except first (self client id) and last (fake client id) indexes
std::sort(&pMap[1], &pMap[minimum(Index, VANILLA_MAX_CLIENTS - 1)]);
}
}