Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GH-616] Add client config json #619

Merged
merged 30 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c3b6651
Add clients config json
Nico-Sanchez May 14, 2024
aebb3c1
Add new protobuf messages for client config and lag spikes config
Nico-Sanchez May 14, 2024
4ceeb71
Read client config and add it to configuration map before sending it …
Nico-Sanchez May 14, 2024
80a0e5b
Merge remote-tracking branch 'origin/main' into gh-616-add-client-con…
Nico-Sanchez May 14, 2024
922f61c
Restore protos from main
Nico-Sanchez May 14, 2024
d401aa1
Change lag spikes config in messages.proto
Nico-Sanchez May 14, 2024
3336460
mix format
Nico-Sanchez May 15, 2024
00b6a2b
Merge branch 'main' into gh-616-add-client-config-json
AngieDutra May 15, 2024
74313e3
Merge branch 'main' into gh-616-add-client-config-json
AngieDutra May 15, 2024
2152ba5
Merge remote-tracking branch 'origin/main' into gh-616-add-client-con…
Nico-Sanchez May 16, 2024
d2e441b
new testing config
AngieDutra May 16, 2024
3b326d6
Merge branch 'gh-616-add-client-config-json' of github.com:lambdaclas…
AngieDutra May 16, 2024
a5f4160
fix messages.proto generated files
Nico-Sanchez May 16, 2024
30f38a3
spikes amount threshold increase
AngieDutra May 17, 2024
3f360a0
Merge branch 'main' into gh-616-add-client-config-json
tvillegas98 May 17, 2024
743bca1
Merge branch 'main' into gh-616-add-client-config-json
AngieDutra May 17, 2024
bdcaa93
Change config
tvillegas98 May 17, 2024
15f4f9f
Change config again
tvillegas98 May 17, 2024
4f1070d
Change config again again again
tvillegas98 May 17, 2024
c6deedc
Modify spike value threshold
tvillegas98 May 17, 2024
7614246
Modify config again
tvillegas98 May 17, 2024
bdd829e
Maybe final config
tvillegas98 May 17, 2024
d033e0b
Maybe final config
tvillegas98 May 17, 2024
a22071e
Merge branch 'main' into gh-616-add-client-config-json
AngieDutra May 20, 2024
96f3e2f
Merge branch 'main' into gh-616-add-client-config-json
saugon May 24, 2024
fd14ba6
Merge remote-tracking branch 'origin/main' into gh-616-add-client-con…
Nico-Sanchez May 27, 2024
8039896
Add temporary fix for fail characters config request to central backend
Nico-Sanchez May 27, 2024
5827737
Change client config due to changes in client PR
Nico-Sanchez May 29, 2024
9c58e8d
Revert "Add temporary fix for fail characters config request to centr…
Nico-Sanchez May 30, 2024
95fbf46
Merge remote-tracking branch 'origin/main' into gh-616-add-client-con…
Nico-Sanchez May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/arena/lib/arena/configuration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ defmodule Arena.Configuration do
config = Jason.decode!(config_json, [{:keys, :atoms}])
skills = parse_skills_config(config.skills)
characters = parse_characters_config(get_characters_config(), skills)
client_config = get_client_config()

%{config | skills: skills}
|> Map.put(:characters, characters)
|> Map.put(:client_config, client_config)
end

defp get_client_config() do
{:ok, config_json} =
Application.app_dir(:arena, "priv/client_config.json")
|> File.read()

Jason.decode!(config_json, [{:keys, :atoms}])
end

defp get_characters_config() do
Expand Down
30 changes: 30 additions & 0 deletions apps/arena/lib/arena/serialization/messages.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ defmodule Arena.Serialization.Configuration do
field(:game, 1, type: Arena.Serialization.ConfigGame)
field(:map, 2, type: Arena.Serialization.ConfigMap)
field(:characters, 3, repeated: true, type: Arena.Serialization.ConfigCharacter)
field(:client_config, 4, type: Arena.Serialization.ClientConfig, json_name: "clientConfig")
end

defmodule Arena.Serialization.ConfigGame do
Expand Down Expand Up @@ -216,6 +217,35 @@ defmodule Arena.Serialization.ConfigCharacter do
)
end

defmodule Arena.Serialization.ClientConfig do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:server_update, 1, type: Arena.Serialization.ConfigServerUpdate, json_name: "serverUpdate")
end

defmodule Arena.Serialization.ConfigServerUpdate do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:timestamp_difference_samples_to_check_warning, 1,
type: :uint64,
json_name: "timestampDifferenceSamplesToCheckWarning"
)

field(:timestamp_differences_samples_max_length, 2,
type: :uint64,
json_name: "timestampDifferencesSamplesMaxLength"
)

field(:show_warning_threshold, 3, type: :uint64, json_name: "showWarningThreshold")
field(:stop_warning_threshold, 4, type: :uint64, json_name: "stopWarningThreshold")
field(:ms_without_update_show_warning, 5, type: :uint64, json_name: "msWithoutUpdateShowWarning")
field(:ms_without_update_disconnect, 6, type: :uint64, json_name: "msWithoutUpdateDisconnect")
end

defmodule Arena.Serialization.ConfigSkill do
@moduledoc false

Expand Down
10 changes: 10 additions & 0 deletions apps/arena/priv/client_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"server_update": {
"timestamp_difference_samples_to_check_warning": 5,
"timestamp_differences_samples_max_length": 30,
"show_warning_threshold": 75,
"stop_warning_threshold": 40,
"ms_without_update_show_warning": 3000,
"ms_without_update_disconnect": 10000
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ defmodule ArenaLoadTest.Serialization.Configuration do
field(:game, 1, type: ArenaLoadTest.Serialization.ConfigGame)
field(:map, 2, type: ArenaLoadTest.Serialization.ConfigMap)
field(:characters, 3, repeated: true, type: ArenaLoadTest.Serialization.ConfigCharacter)

field(:client_config, 4,
type: ArenaLoadTest.Serialization.ClientConfig,
json_name: "clientConfig"
)
end

defmodule ArenaLoadTest.Serialization.ConfigGame do
Expand Down Expand Up @@ -216,6 +221,38 @@ defmodule ArenaLoadTest.Serialization.ConfigCharacter do
)
end

defmodule ArenaLoadTest.Serialization.ClientConfig do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:server_update, 1,
type: ArenaLoadTest.Serialization.ConfigServerUpdate,
json_name: "serverUpdate"
)
end

defmodule ArenaLoadTest.Serialization.ConfigServerUpdate do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:timestamp_difference_samples_to_check_warning, 1,
type: :uint64,
json_name: "timestampDifferenceSamplesToCheckWarning"
)

field(:timestamp_differences_samples_max_length, 2,
type: :uint64,
json_name: "timestampDifferencesSamplesMaxLength"
)

field(:show_warning_threshold, 3, type: :uint64, json_name: "showWarningThreshold")
field(:stop_warning_threshold, 4, type: :uint64, json_name: "stopWarningThreshold")
field(:ms_without_update_show_warning, 5, type: :uint64, json_name: "msWithoutUpdateShowWarning")
field(:ms_without_update_disconnect, 6, type: :uint64, json_name: "msWithoutUpdateDisconnect")
end

defmodule ArenaLoadTest.Serialization.ConfigSkill do
@moduledoc false

Expand Down
30 changes: 30 additions & 0 deletions apps/bot_manager/lib/protobuf/messages.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ defmodule BotManager.Protobuf.Configuration do
field(:game, 1, type: BotManager.Protobuf.ConfigGame)
field(:map, 2, type: BotManager.Protobuf.ConfigMap)
field(:characters, 3, repeated: true, type: BotManager.Protobuf.ConfigCharacter)
field(:client_config, 4, type: BotManager.Protobuf.ClientConfig, json_name: "clientConfig")
end

defmodule BotManager.Protobuf.ConfigGame do
Expand Down Expand Up @@ -216,6 +217,35 @@ defmodule BotManager.Protobuf.ConfigCharacter do
)
end

defmodule BotManager.Protobuf.ClientConfig do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:server_update, 1, type: BotManager.Protobuf.ConfigServerUpdate, json_name: "serverUpdate")
end

defmodule BotManager.Protobuf.ConfigServerUpdate do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:timestamp_difference_samples_to_check_warning, 1,
type: :uint64,
json_name: "timestampDifferenceSamplesToCheckWarning"
)

field(:timestamp_differences_samples_max_length, 2,
type: :uint64,
json_name: "timestampDifferencesSamplesMaxLength"
)

field(:show_warning_threshold, 3, type: :uint64, json_name: "showWarningThreshold")
field(:stop_warning_threshold, 4, type: :uint64, json_name: "stopWarningThreshold")
field(:ms_without_update_show_warning, 5, type: :uint64, json_name: "msWithoutUpdateShowWarning")
field(:ms_without_update_disconnect, 6, type: :uint64, json_name: "msWithoutUpdateDisconnect")
end

defmodule BotManager.Protobuf.ConfigSkill do
@moduledoc false

Expand Down
Loading
Loading