Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
/BeatTogether.DedicatedServer/appsettings.LocalDevelopment.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using BeatTogether.Core.Enums;
using BeatTogether.DedicatedServer.Kernel.Abstractions;
using System.Diagnostics.CodeAnalysis;
using BeatTogether.Core.Models;

namespace BeatTogether.DedicatedServer.Instancing.Abstractions
{
Expand All @@ -10,6 +11,6 @@ public interface IInstanceRegistry
public bool RemoveInstance(IDedicatedInstance instance);
public bool TryGetInstance(string secret, [MaybeNullWhen(false)] out IDedicatedInstance instance);
public bool TryGetInstanceByCode(string code, [MaybeNullWhen(false)] out IDedicatedInstance instance);
public bool TryGetAvailablePublicServer(InvitePolicy invitePolicy, GameplayServerMode serverMode, SongSelectionMode songMode, GameplayServerControlSettings serverControlSettings, BeatmapDifficultyMask difficultyMask, GameplayModifiersMask modifiersMask, string songPackMasks, [MaybeNullWhen(false)] out IDedicatedInstance instance);
public bool TryGetAvailablePublicServer(InvitePolicy invitePolicy, GameplayServerMode serverMode, SongSelectionMode songMode, GameplayServerControlSettings serverControlSettings, BeatmapDifficultyMask difficultyMask, GameplayModifiersMask modifiersMask, string songPackMasks, VersionRange versionRange, [MaybeNullWhen(false)] out IDedicatedInstance instance);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<Authors>BeatTogether Team</Authors>
<Company>BeatTogether</Company>
<RepositoryUrl>https://github.com/beattogether/BeatTogether.DedicatedServer</RepositoryUrl>
<Version>1.0.0</Version>
<Version>1.1.0</Version>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BeatTogether.Core" Version="1.1.0" />
<PackageReference Include="BeatTogether.Core" Version="1.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ public ServerInstance(IDedicatedInstance serverInstance, IPEndPoint instanceEndP
public bool AllowChroma { get => _ServerInstance._configuration.AllowChroma; set => throw new NotImplementedException(); }
public bool AllowME { get => _ServerInstance._configuration.AllowMappingExtensions; set => throw new NotImplementedException(); }
public bool AllowNE { get => _ServerInstance._configuration.AllowNoodleExtensions; set => throw new NotImplementedException(); }
}
public VersionRange SupportedVersionRange { get => _ServerInstance._configuration.SupportedVersionRange; set => throw new NotImplementedException(); }
}
}
6 changes: 4 additions & 2 deletions BeatTogether.DedicatedServer.Instancing/InstanceRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Diagnostics.CodeAnalysis;
using BeatTogether.Core.Enums;
using System.Linq;
using BeatTogether.Core.Models;

namespace BeatTogether.DedicatedServer.Instancing
{
Expand All @@ -23,7 +24,7 @@ public bool AddInstance(IDedicatedInstance instance){

public bool RemoveInstance(IDedicatedInstance instance) => _instances.TryRemove(instance._configuration.Secret, out _) && _instancesByCode.TryRemove(instance._configuration.Code, out _);

public bool TryGetAvailablePublicServer(InvitePolicy invitePolicy, GameplayServerMode serverMode, SongSelectionMode songMode, GameplayServerControlSettings serverControlSettings, BeatmapDifficultyMask difficultyMask, GameplayModifiersMask modifiersMask, string songPackMasks, [MaybeNullWhen(false)] out IDedicatedInstance instance)
public bool TryGetAvailablePublicServer(InvitePolicy invitePolicy, GameplayServerMode serverMode, SongSelectionMode songMode, GameplayServerControlSettings serverControlSettings, BeatmapDifficultyMask difficultyMask, GameplayModifiersMask modifiersMask, string songPackMasks, VersionRange versionRange, [MaybeNullWhen(false)] out IDedicatedInstance instance)
{
instance = null;
var AvaliableServers = _instances.Values.Where(s =>
Expand All @@ -33,7 +34,8 @@ public bool TryGetAvailablePublicServer(InvitePolicy invitePolicy, GameplayServe
s._configuration.GameplayServerConfiguration.GameplayServerControlSettings == serverControlSettings &&
s._configuration.BeatmapDifficultyMask == difficultyMask &&
s._configuration.GameplayModifiersMask == modifiersMask &&
s._configuration.SongPacksMask == songPackMasks
s._configuration.SongPacksMask == songPackMasks &&
s._configuration.SupportedVersionRange == versionRange
);
if (!AvaliableServers.Any())
return false;
Expand Down
5 changes: 3 additions & 2 deletions BeatTogether.DedicatedServer.Instancing/LayerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Serilog;
using System.Net;
using System.Threading.Tasks;
using BeatTogether.Core.Models;

namespace BeatTogether.DedicatedServer.Instancing
{
Expand Down Expand Up @@ -50,10 +51,10 @@ public Task DisconnectPlayer(string InstanceSecret, string PlayerUserId)
return Task.CompletedTask;
}

public Task<IServerInstance?> GetAvailablePublicServer(InvitePolicy invitePolicy, GameplayServerMode serverMode, SongSelectionMode songMode, GameplayServerControlSettings serverControlSettings, BeatmapDifficultyMask difficultyMask, GameplayModifiersMask modifiersMask, string songPackMasks)
public Task<IServerInstance?> GetAvailablePublicServer(InvitePolicy invitePolicy, GameplayServerMode serverMode, SongSelectionMode songMode, GameplayServerControlSettings serverControlSettings, BeatmapDifficultyMask difficultyMask, GameplayModifiersMask modifiersMask, string songPackMasks, VersionRange versionRange)
{
IServerInstance? serverInstance = null;
if (_instanceRegistry.TryGetAvailablePublicServer(invitePolicy, serverMode, songMode, serverControlSettings, difficultyMask, modifiersMask, songPackMasks, out var instance))
if (_instanceRegistry.TryGetAvailablePublicServer(invitePolicy, serverMode, songMode, serverControlSettings, difficultyMask, modifiersMask, songPackMasks, versionRange, out var instance))
{
serverInstance = new ServerInstance(instance, IPEndPoint.Parse($"{_instancingConfiguration.HostEndpoint}:{instance._configuration.Port}"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Authors>BeatTogether Team</Authors>
<Company>BeatTogether</Company>
<RepositoryUrl>https://github.com/beattogether/BeatTogether.DedicatedServer</RepositoryUrl>
<Version>2.0.2</Version>
<Version>2.1.0</Version>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand All @@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="Autobus.Abstractions" Version="0.1.5" />
<PackageReference Include="BeatTogether.Core" Version="1.0.3" />
<PackageReference Include="BeatTogether.Core" Version="1.2.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BeatTogether.Core" Version="1.1.0" />
<PackageReference Include="BeatTogether.Core" Version="1.2.0" />
<PackageReference Include="BeatTogether.Core.Security" Version="1.2.0" />
<PackageReference Include="BeatTogether.Extensions.Serilog" Version="2.1.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public sealed class InstanceConfiguration
public string SetConstantManagerFromUserId { get; set; } = string.Empty; //If a user creates a server using the api and enteres there userId (eg uses discord bot with linked account))
public bool AllowPerPlayerDifficulties { get; set; } = false;
public bool AllowPerPlayerModifiers { get; set; } = false;

public VersionRange SupportedVersionRange { get; set; } = new();
public CountdownConfig CountdownConfig { get; set; } = new();

public GameplayServerConfiguration GameplayServerConfiguration { get; set; } = new();
Expand Down
2 changes: 2 additions & 0 deletions BeatTogether.DedicatedServer.Kernel/Managers/LobbyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,14 @@ private bool PlayerMapCheck(IPlayer p)
int Votes = 0;
foreach (var item in voteDictionary)
{
_logger.Verbose($"Checking Votes for map '{item.Key.LevelId}' on characteristic '{item.Key.Characteristic}' and difficulty '{item.Key.Difficulty}' votes: {item.Value}");
if (item.Value > Votes)
{
Selected = item.Key;
Votes = item.Value;
}
}
_logger.Verbose($"Vote: selected map '{Selected.LevelId}' characteristic '{Selected.Characteristic}' difficulty '{Selected.Difficulty}'");
return Selected;
case SongSelectionMode.RandomPlayerPicks:
if (CountDownState == CountdownState.CountingDown || CountDownState == CountdownState.NotCountingDown)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BeatTogether.Core" Version="1.1.0" />
<PackageReference Include="BeatTogether.Core" Version="1.2.0" />
<PackageReference Include="BeatTogether.Core.Messaging" Version="1.10.0" />
<PackageReference Include="BeatTogether.Extensions.BinaryRecords" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace BeatTogether.DedicatedServer.Node.Configuration
public sealed class NodeConfiguration
{
public string HostEndpoint { get; set; } = "127.0.0.1";
public Version NodeVersion { get; } = new Version(2,0,0);
public Version NodeVersion { get; } = new Version(2,1,0);
}
}
3 changes: 3 additions & 0 deletions BeatTogether.DedicatedServer.Node/Models/ServerFromMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class ServerFromMessage : IServerInstance

public bool AllowNE { get; set; }

public VersionRange SupportedVersionRange { get; set; }

public IPEndPoint InstanceEndPoint { get; set; } = null!;
public HashSet<string> PlayerHashes { get; set; } = null!;

Expand All @@ -76,6 +78,7 @@ public ServerFromMessage(Core.ServerMessaging.Models.Server instance)
AllowChroma = instance.AllowChroma;
AllowME = instance.AllowME;
AllowNE = instance.AllowNE;
SupportedVersionRange = instance.SupportedVersionRange;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<None Remove="appsettings.Development.json" />
<None Remove="appsettings.*.json" />
<None Remove="appsettings.json" />
<None Update="cert.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand All @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<Content Include="appsettings.Development.json">
<Content Include="appsettings.*.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.json">
Expand Down
11 changes: 11 additions & 0 deletions BeatTogether.DedicatedServer/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"profiles": {
"BeatTogether.DedicatedServer": {
"commandName": "Project",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "LocalDevelopment"
},
"remoteDebugEnabled": false
}
}
}
3 changes: 3 additions & 0 deletions BeatTogether.DedicatedServer/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"RabbitMQ": {
"HostName": "127.0.0.1"
},
"Serilog": {
"MinimumLevel": {
"Default": "Verbose",
Expand Down
9 changes: 6 additions & 3 deletions BeatTogether.DedicatedServer/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"RabbitMQ": {
"HostName": "127.0.0.1"
},
"Serilog": {
"File": {
"Path": "logs/BeatTogether.DedicatedServer-{Date}.log"
},
"ServerConfiguration": {
"HostEndpoint": "127.0.0.1"
}
},
"ServerConfiguration": {
"HostEndpoint": "127.0.0.1"
}
}
Loading