Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/insta' into insta
Browse files Browse the repository at this point in the history
  • Loading branch information
M0REKZ committed Jul 30, 2024
2 parents 15ffb5f + b4a1d4f commit 279e215
Show file tree
Hide file tree
Showing 37 changed files with 825 additions and 293 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
if: contains(matrix.os, 'macOS')
run: |
brew update || true
brew install pkg-config sdl2 ffmpeg ninja molten-vk vulkan-headers glslang spirv-tools || true
brew install pkg-config sdl2 ffmpeg ninja molten-vk vulkan-headers glslang spirv-tools rust || true
brew upgrade freetype
pip3 install --break-system-packages dmgbuild
echo /Library/Frameworks/Python.framework/Versions/3.12/bin >> $GITHUB_PATH
Expand Down
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3163,10 +3163,16 @@ if(NOT DEV)
install(TARGETS ${TARGET_ANTIBOT} DESTINATION ${CMAKE_INSTALL_LIBDIR}/ddnet COMPONENT server)
endif()
install(TARGETS ${TARGETS_TOOLS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/ddnet COMPONENT tools)
install(FILES other/ddnet.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications COMPONENT client)
if(TARGET game-client)
install(FILES other/ddnet.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications COMPONENT client)
endif()
foreach(SIZE 16 32 48 256)
install(FILES other/icons/DDNet_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet.png COMPONENT client)
install(FILES other/icons/DDNet-Server_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet-server.png COMPONENT server)
if(TARGET game-client)
install(FILES other/icons/DDNet_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet.png COMPONENT client)
endif()
if(TARGET game-server)
install(FILES other/icons/DDNet-Server_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet-server.png COMPONENT server)
endif()
endforeach()
foreach(file ${VULKAN_SHADER_FILE_LIST})
install(FILES ${PROJECT_BINARY_DIR}/${file} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ddnet/data/shader/vulkan COMPONENT client)
Expand Down
97 changes: 96 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ It kills with one shot and capturing the enemy flag scores your team 100 points.
+ `sv_killingspree_kills` How many kills are needed to be on a killing-spree (0=off)
+ `sv_damage_needed_for_kill` Damage needed to kill
+ `sv_allow_zoom` allow ddnet clients to use the client side zoom feature
+ `sv_anticamper` Toggle to enable/disable Anticamper
+ `sv_anticamper_freeze` If a player should freeze on camping (and how long) or die
+ `sv_anticamper_time` How long to wait till the player dies/freezes
+ `sv_anticamper_range` Distance how far away the player must move to escape anticamper
+ `sv_chat_ratelimit_long_messages` Needs sv_spamprotection 0 (0=off, 1=only messages longer than 12 chars are limited)
+ `sv_chat_ratelimit_spectators` Needs sv_spamprotection 0 (0=off, 1=specs have slow chat)
+ `sv_chat_ratelimit_public_chat` Needs sv_spamprotection 0 (0=off, 1=non team chat is slow)
Expand All @@ -85,10 +89,13 @@ It kills with one shot and capturing the enemy flag scores your team 100 points.
+ `sv_tournament_chat` 0=off, 1=Spectators can not public chat, 2=Nobody can public chat
+ `sv_tournament_chat_smart` Turns sv_tournament_chat on on restart and off on round end (1=specs,2=all)
+ `sv_tournament_join_msgs` Hide join/leave of spectators in chat !0.6 only for now! (0=off,1=hidden,2=shown for specs)
+ `sv_round_stats_format` 0=csv 1=psv 2=ascii table 3=markdown table 4=json
+ `sv_round_stats_format_discord` 0=csv 1=psv 2=ascii table 3=markdown table 4=json
+ `sv_round_stats_format_http` 0=csv 1=psv 2=ascii table 3=markdown table 4=json
+ `sv_round_stats_format_file` 0=csv 1=psv 2=ascii table 3=markdown table 4=json
+ `sv_spawn_weapons` possible values: grenade, laser
+ `sv_tournament_welcome_chat` Chat message shown in chat on join when sv_tournament is 1
+ `sv_round_stats_discord_webhook` If set will post score stats there on round end
+ `sv_round_stats_http_endpoint` If set will post score stats there on round end
+ `sv_round_stats_output_file` If set will write score stats there on round end

# Rcon commmands
Expand Down Expand Up @@ -117,3 +124,91 @@ ddnet-insta then added a bunch of own slash chat commands and also bang (!) chat
+ `!settings` show current game settings in the message of the day. It will show if spray protection is on or off and similar game relevant settings.
+ `!1v1` `!2v2` `!v1` `!v2` `!1on1` ... call vote to change in game slots
+ `!restart ?(seconds)` call vote to restart game with optional parameter of warmup seconds (default: 10)

# Publish round stats

At the end of every round the stats about every players score can be published to discord (and other destinations).

The following configs determine which format the stats will be represented in.

+ `sv_round_stats_format_discord` 0=csv 1=psv 2=ascii table 3=markdown table 4=json
+ `sv_round_stats_format_http` 0=csv 1=psv 2=ascii table 3=markdown table 4=json
+ `sv_round_stats_format_file` 0=csv 1=psv 2=ascii table 3=markdown table 4=json

And these configs determin where the stats will be sent to.

+ `sv_round_stats_discord_webhook` Will do a discord webhook POST request to that url. The url has to look like this: `https://discord.com/api/webhooks/1232962289217568799/8i_a89XXXXXXXXXXXXXXXXXXXXXXX`
If you don't know how to setup a discord webhook, don't worry its quite simple. You need to have admin access to a discord server and then you can follow this [1 minute youtube tutorial](https://www.youtube.com/watch?v=fKksxz2Gdnc).
+ `sv_round_stats_http_endpoint` It will do a http POST request to that url with the round stats as payload. You can set this to your custom api endpoint that collect stats. Example: `https://api.zillyhuhn.com/insta/round_stats`
+ `sv_round_stats_output_file` **NOT IMPLEMENTED YET** It will write the round stats to a file located at that path. You could then read that file with another tool or expose it with an http server. Example value: `stats.json`

## csv - comma separated values (format 0)

NOT IMPLEMENTED YET

## psv - pipe separated values (format 1)

```
---> Server: unnamed server, Map: tmp/maps-07/ctf5_spikes, Gametype: gctf.
(Length: 0 min 17 sec, Scorelimit: 1, Timelimit: 0)
**Red Team:**
Clan: **|*KoG*|**
Id: 0 | Name: ChillerDragon | Score: 2 | Kills: 1 | Deaths: 0 | Ratio: 1.00
**Blue Team:**
Clan: **|*KoG*|**
Id: 1 | Name: ChillerDragon.* | Score: 0 | Kills: 0 | Deaths: 1 | Ratio: 0.00
---------------------
**Red: 1 | Blue 0**
```

Here is how it would display when posted on discord:

![psv on discord](https://raw.githubusercontent.com/ddnet-insta/images/5fafe03ed60153096facf4cc5d56c5df9ff20a5c/psv_discord.png)

## ascii table (format 2)

NOT IMPLEMENTED YET

## markdown (format 3)

NOT IMPLEMENTED YET

## json - javascript object notation (format 4)

```json
{
"server": "unnamed server",
"map": "tmp/maps-07/ctf5_spikes",
"game_type": "gctf",
"game_duration_seconds": 67,
"score_limit": 200,
"time_limit": 0,
"score_red": 203,
"score_blue": 0,
"players": [
{
"id": 0,
"team": "red",
"name": "ChillerDragon",
"score": 15,
"kills": 3,
"deaths": 1,
"ratio": 3,
"flag_grabs": 3,
"flag_captures": 2
},
{
"id": 1,
"team": "blue",
"name": "ChillerDragon.*",
"score": 0,
"kills": 0,
"deaths": 3,
"ratio": 0,
"flag_grabs": 0,
"flag_captures": 0
}
]
}
```
19 changes: 10 additions & 9 deletions data/languages/estonian.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Cammodude 2024-10-03 18:04:16
# Cammodude 2024-12-04 17:35:38
# Cammodude 2024-20-04 15:17:26
# Cammodude 2024-18-07 20:00:25
##### /authors #####

##### translated strings #####
Expand Down Expand Up @@ -1843,33 +1844,33 @@ Net

[Spectating]
Following %s
==
== %s jälgimine

%d/%d KiB (%.1f KiB/s)
==
== %d/%d KiB (%.1f KiB/s)

Example of usage
==
== Kasutamise näide

Tee
==
== Tee

Show only chat messages from team members
==
== Ainult näita sõnumeid tiimi kaaslastelt

Round %d/%d
==
== Raund %d/%d

[Spectators]
%d others…
==
== %d teisi…

[Team and size]
%d\n(%d/%d)
==
== %d\n(%d/%d)

Team %d (%d/%d)
==
== Tiim %d (%d/%d)

https://wiki.ddnet.org/wiki/Mapping
==
15 changes: 8 additions & 7 deletions data/languages/simplified_chinese.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
# 2024-03-03 Bamcane
# 2024-04-21 By
# 2024-06-10 By
# 2024-07-21 By
##### /authors #####

##### translated strings #####
Expand Down Expand Up @@ -1892,24 +1893,24 @@ Show only chat messages from team members

[Spectating]
Following %s
==
== 正在旁观 %s

Example of usage
==
== 用途示例

Round %d/%d
==
== 轮次 %d/%d

[Spectators]
%d others…
==
== %d 其他…

[Team and size]
%d\n(%d/%d)
==
== %d\n(%d/%d)

Team %d (%d/%d)
==
== 队伍 %d (%d/%d)

https://wiki.ddnet.org/wiki/Mapping
==
== https://wiki.ddnet.org/index.php?title=Mapping/zh&variant=zh-hans
15 changes: 8 additions & 7 deletions data/languages/traditional_chinese.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# 2024-03-05 By
# 2024-04-21 By
# 2024-06-10 By
# 2024-07-21 By
##### /authors #####

##### translated strings #####
Expand Down Expand Up @@ -1881,24 +1882,24 @@ Show only chat messages from team members

[Spectating]
Following %s
==
== 正在旁觀 %s

Example of usage
==
== 用途示例

Round %d/%d
==
== 輪次 %d/%d

[Spectators]
%d others…
==
== %d 其他…

[Team and size]
%d\n(%d/%d)
==
== %d\n(%d/%d)

Team %d (%d/%d)
==
== 隊伍 %d (%d/%d)

https://wiki.ddnet.org/wiki/Mapping
==
== https://wiki.ddnet.org/index.php?title=Mapping/zh&variant=zh-hant
53 changes: 32 additions & 21 deletions src/engine/client/backend/vulkan/backend_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3730,12 +3730,12 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase
m_pGpuList->m_vGpus.reserve(vDeviceList.size());

size_t FoundDeviceIndex = 0;
size_t FoundGpuType = STWGraphicGpu::ETWGraphicsGpuType::GRAPHICS_GPU_TYPE_INVALID;

STWGraphicGpu::ETWGraphicsGpuType AutoGpuType = STWGraphicGpu::ETWGraphicsGpuType::GRAPHICS_GPU_TYPE_INVALID;

bool IsAutoGpu = str_comp(g_Config.m_GfxGpuName, "auto") == 0;

bool UserSelectedGpuChosen = false;
for(auto &CurDevice : vDeviceList)
{
vkGetPhysicalDeviceProperties(CurDevice, &(vDevicePropList[Index]));
Expand All @@ -3744,36 +3744,47 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase

STWGraphicGpu::ETWGraphicsGpuType GPUType = VKGPUTypeToGraphicsGpuType(DeviceProp.deviceType);

STWGraphicGpu::STWGraphicGpuItem NewGpu;
str_copy(NewGpu.m_aName, DeviceProp.deviceName);
NewGpu.m_GpuType = GPUType;
m_pGpuList->m_vGpus.push_back(NewGpu);

Index++;

int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion);
int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion);

if(GPUType < AutoGpuType && (DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor)))
if(DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor))
{
str_copy(m_pGpuList->m_AutoGpu.m_aName, DeviceProp.deviceName);
m_pGpuList->m_AutoGpu.m_GpuType = GPUType;
STWGraphicGpu::STWGraphicGpuItem NewGpu;
str_copy(NewGpu.m_aName, DeviceProp.deviceName);
NewGpu.m_GpuType = GPUType;
m_pGpuList->m_vGpus.push_back(NewGpu);

AutoGpuType = GPUType;
}
// We always decide what the 'auto' GPU would be, even if user is forcing a GPU by name in config
// Reminder: A worse GPU enumeration has a higher value than a better GPU enumeration, thus the '>'
if(AutoGpuType > STWGraphicGpu::ETWGraphicsGpuType::GRAPHICS_GPU_TYPE_INTEGRATED)
{
str_copy(m_pGpuList->m_AutoGpu.m_aName, DeviceProp.deviceName);
m_pGpuList->m_AutoGpu.m_GpuType = GPUType;

if(((IsAutoGpu && (FoundGpuType > STWGraphicGpu::ETWGraphicsGpuType::GRAPHICS_GPU_TYPE_INTEGRATED && GPUType < FoundGpuType)) || str_comp(DeviceProp.deviceName, g_Config.m_GfxGpuName) == 0) && (DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor)))
{
FoundDeviceIndex = Index;
FoundGpuType = GPUType;
AutoGpuType = GPUType;

if(IsAutoGpu)
FoundDeviceIndex = Index;
}
// We only select the first GPU that matches, because it comes first in the enumeration array, it's preferred by the system
// Reminder: We can't break the cycle here if the name matches because we need to choose the best GPU for 'auto' mode
if(!IsAutoGpu && !UserSelectedGpuChosen && str_comp(DeviceProp.deviceName, g_Config.m_GfxGpuName) == 0)
{
FoundDeviceIndex = Index;
UserSelectedGpuChosen = true;
}
}
Index++;
}

if(FoundDeviceIndex == 0)
FoundDeviceIndex = 1;
if(m_pGpuList->m_vGpus.empty())
{
SetWarning(EGfxWarningType::GFX_WARNING_TYPE_INIT_FAILED_MISSING_INTEGRATED_GPU_DRIVER, "No devices with required vulkan version found.");
return false;
}

{
auto &DeviceProp = vDevicePropList[FoundDeviceIndex - 1];
auto &DeviceProp = vDevicePropList[FoundDeviceIndex];

int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion);
int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion);
Expand Down Expand Up @@ -3833,7 +3844,7 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase
}
}

VkPhysicalDevice CurDevice = vDeviceList[FoundDeviceIndex - 1];
VkPhysicalDevice CurDevice = vDeviceList[FoundDeviceIndex];

uint32_t FamQueueCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(CurDevice, &FamQueueCount, nullptr);
Expand Down
4 changes: 4 additions & 0 deletions src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4558,6 +4558,10 @@ int main(int argc, const char **argv)
pClient->ShellRegister();
#endif

// Do not automatically translate touch events to mouse events and vice versa.
SDL_SetHint("SDL_TOUCH_MOUSE_EVENTS", "0");
SDL_SetHint("SDL_MOUSE_TOUCH_EVENTS", "0");

#if defined(CONF_PLATFORM_MACOS)
// Hints will not be set if there is an existing override hint or environment variable that takes precedence.
// So this respects cli environment overrides.
Expand Down
Loading

0 comments on commit 279e215

Please sign in to comment.