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

Group domain game projects and tests into a single one #566

Closed
wants to merge 30 commits into from
Closed
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
39cc847
Group multiple projects into one
caioavidal Oct 18, 2023
6ecea37
Remove test
caioavidal Oct 18, 2023
583f33c
Delete empty folders
caioavidal Oct 18, 2023
a9c2f17
Reorganize folders
caioavidal Oct 18, 2023
b667e0a
Add DI framework benchmark
caioavidal Oct 18, 2023
faf8adb
Refact
caioavidal Oct 18, 2023
ee6e830
Add Game project files
caioavidal Oct 18, 2023
59c1fa9
Remove item event subscription classes
caioavidal Oct 24, 2023
cdbfa4b
Create UseItem Feature
caioavidal Oct 26, 2023
eda1e1c
Add UseOnItemCommand
caioavidal Oct 26, 2023
1fae399
Move account handler to application project
caioavidal Oct 27, 2023
1c4c2d3
Move handlers to application project
caioavidal Oct 27, 2023
7a7e176
Fix login
caioavidal Oct 27, 2023
8d41036
Fix use item
caioavidal Oct 28, 2023
5dd445f
Move files around
caioavidal Jan 14, 2024
2320fc3
Chat Code refactor
caioavidal Jan 14, 2024
c77246c
Move classes around
caioavidal Jan 17, 2024
03f824f
Move classes around and rename packet handlers
caioavidal Jan 19, 2024
a8454e1
cleanup
caioavidal Jan 19, 2024
285e2c0
Fix login
caioavidal Jan 19, 2024
df00484
Remove Logout Command
caioavidal Jan 19, 2024
107a58a
Remove commands project
caioavidal Jan 19, 2024
6e9e07a
Delete security project
caioavidal Jan 19, 2024
893bdde
Delete Events project
caioavidal Jan 19, 2024
791bda3
Remove obsolete projects
caioavidal Jan 20, 2024
b0f8f98
Create data entities project
caioavidal Mar 7, 2024
97e5057
Merge branch 'develop' into vertical-slice
caioavidal Mar 7, 2024
2006fa5
Fix compile issues
caioavidal Mar 7, 2024
ef05244
Cleaning up the solution
caioavidal Mar 7, 2024
ff14cc3
Full code cleanup
caioavidal Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
61 changes: 61 additions & 0 deletions benchmarks/NeoServer.Benchmarks/DIFramework/AutoFacVsMicrosoft.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Autofac;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;
using Microsoft.Extensions.DependencyInjection;

namespace NeoServer.Benchmarks.DIFramework;

[SimpleJob(RunStrategy.ColdStart, 5)]
public class AutoFacVsMicrosoft
{
private IContainer _autoFacContainer;
private ServiceProvider _serviceProviderContainer;

public AutoFacVsMicrosoft()
{
SetupAutoFacContainer();
SetupServiceProviderContainer();
}

private void SetupAutoFacContainer()
{
var containerBuilder = new ContainerBuilder();

containerBuilder.RegisterType<SingletonService>().SingleInstance();
containerBuilder.RegisterType<Singleton2Service>().SingleInstance();

_autoFacContainer = containerBuilder.Build();
}

private void SetupServiceProviderContainer()
{
var serviceCollection = new ServiceCollection();

serviceCollection.AddSingleton<SingletonService>();
serviceCollection.AddSingleton<Singleton2Service>();
_serviceProviderContainer = serviceCollection.BuildServiceProvider();
}

[Benchmark]
public void GetInstanceUsingAutofac()
{
for (var i = 0; i < 1_000_000; i++) _ = _autoFacContainer.Resolve<SingletonService>();
}

[Benchmark]
public void GetInstanceUsingServiceProvider()
{
for (var i = 0; i < 1_000_000; i++) _ = _serviceProviderContainer.GetService<SingletonService>();
}
}

public class SingletonService
{
public SingletonService(Singleton2Service singleton2Service)
{
}
}

Check notice on line 58 in benchmarks/NeoServer.Benchmarks/DIFramework/AutoFacVsMicrosoft.cs

View check run for this annotation

codefactor.io / CodeFactor

benchmarks/NeoServer.Benchmarks/DIFramework/AutoFacVsMicrosoft.cs#L58

A C# document may only contain a single class at the root level unless all of the classes are partial and are of the same type. (SA1402)
public class Singleton2Service
{
}
10 changes: 6 additions & 4 deletions benchmarks/NeoServer.Benchmarks/NeoServer.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5"/>
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.5"/>
<PackageReference Include="Autofac" Version="7.1.0"/>
<PackageReference Include="BenchmarkDotNet" Version="0.13.9"/>
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.9"/>
<PackageReference Include="CS-Script" Version="4.8.10"/>
<PackageReference Include="MoonSharp" Version="2.0.0"/>
<PackageReference Include="NLua" Version="1.6.3"/>
<PackageReference Include="System.IO.Pipelines" Version="7.0.0"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game.Creatures\NeoServer.Game.Creatures.csproj"/>
<ProjectReference Include="..\..\src\NeoServer.Data\NeoServer.Data.csproj"/>
<ProjectReference Include="..\..\src\NetworkingServer\NeoServer.Networking.Packets\NeoServer.Networking.Packets.csproj"/>
<ProjectReference Include="..\..\src\ApplicationServer\NeoServer.Server\NeoServer.Server.csproj"/>
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions benchmarks/NeoServer.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using BenchmarkDotNet.Running;
using NeoServer.Benchmarks.Collections;
using NeoServer.Benchmarks.Script;

namespace NeoServer.Benchmarks;

Expand All @@ -9,7 +9,7 @@ internal class Program
private static void Main(string[] args)
{
// BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new DebugBuildConfig());
BenchmarkRunner.Run<StackVsListInsertZeroIndex>();
BenchmarkRunner.Run<LuaVsCsScriptBenchmark>();

Console.ReadKey();
}
Expand Down
43 changes: 43 additions & 0 deletions benchmarks/NeoServer.Benchmarks/Script/LuaVsCsScriptBenchmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;
using CSScriptLib;
using NLua;

namespace NeoServer.Benchmarks.Script;

[SimpleJob(RunStrategy.ColdStart, 1)]
public class LuaVsCsScriptBenchmark
{
private readonly Lua _lua = new();

private readonly dynamic _script = CSScript.Evaluator
.LoadMethod("""
void Product()
{
for(int i = 0; i < 100; i++)
for(int j = 0; j < 100; j++)
_ = i+j;
}
""");

[Benchmark]
public void Lua()
{
for (var i = 0; i < 10_000; i++)
_ = _lua.DoString("""
for i = 1, 100 do
for j = 1, 100 do
y = i+j
end
end

""");
}


[Benchmark]
public void CsScript()
{
for (var i = 0; i < 10_000; i++) _script.Product();
}
}
4 changes: 2 additions & 2 deletions benchmarks/NeoServer.Benchmarks/Tasks/SchedulerBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Engines;
using NeoServer.Server.Common.Contracts.Tasks;
using NeoServer.Server.Tasks;
using NeoServer.Application.Common.Contracts.Tasks;
using NeoServer.Application.Infrastructure.Thread;

namespace NeoServer.Benchmarks.Tasks;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Threading.Channels;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using NeoServer.Server.Common.Contracts.Tasks;
using NeoServer.Server.Tasks;
using NeoServer.Application.Common.Contracts.Tasks;
using NeoServer.Application.Infrastructure.Thread;

namespace NeoServer.Benchmarks.Tasks;

Expand Down
2 changes: 1 addition & 1 deletion data/extensions/AttachEventLoaders.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NeoServer.Application.Common.Contracts;
using NeoServer.Game.Common.Contracts.Creatures;
using NeoServer.Server.Common.Contracts;

namespace NeoServer.Extensions;

Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Chat/DeathChannel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using NeoServer.Game.Chats;
using NeoServer.Game.Chats.Rules;
using NeoServer.Game.Chat.Channels;
using NeoServer.Game.Chat.Rules;
using NeoServer.Game.Common.Chats;

namespace NeoServer.Extensions.Chat;
Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Chat/LootChannel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using NeoServer.Game.Chats;
using NeoServer.Game.Chats.Rules;
using NeoServer.Game.Chat.Channels;
using NeoServer.Game.Chat.Rules;
using NeoServer.Game.Common.Chats;

namespace NeoServer.Extensions.Chat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using NeoServer.Game.Common.Contracts.Creatures;
using NeoServer.Game.Common.Contracts.Items;
using NeoServer.Game.Common.Services;
using NeoServer.Game.Creatures.Monster.Summon;
using NeoServer.Game.Creature.Monster.Summon;

namespace NeoServer.Extensions.Events.Creatures;

Expand Down
2 changes: 1 addition & 1 deletion data/extensions/Events/Startup/VocationConverter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NeoServer.Application.Common.Contracts;
using NeoServer.Game.Common.Contracts.DataStores;
using NeoServer.Game.Common.Item;
using NeoServer.Server.Common.Contracts;
using Serilog;

namespace NeoServer.Extensions.Events.Startup;
Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Items/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Common.Services;
using NeoServer.Game.Common.Texts;
using NeoServer.Game.Items.Bases;
using NeoServer.Game.Items.Factories;
using NeoServer.Game.Item.Bases;
using NeoServer.Game.Item.Factories;
using NeoServer.Game.World.Map;
using NeoServer.Game.World.Models.Tiles;

Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Items/Lever.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using NeoServer.Game.Common.Contracts.Items;
using NeoServer.Game.Common.Item;
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Items.Bases;
using NeoServer.Game.Items.Factories;
using NeoServer.Game.Item.Bases;
using NeoServer.Game.Item.Factories;
using NeoServer.Game.World.Map;
using NeoServer.Game.World.Models.Tiles;

Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Items/Tools/Rope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Common.Services;
using NeoServer.Game.Common.Texts;
using NeoServer.Game.Creatures;
using NeoServer.Game.Items.Items.UsableItems;
using NeoServer.Game.Creature;
using NeoServer.Game.Item.Items.UsableItems;
using NeoServer.Game.World.Map;
using NeoServer.Game.World.Services;

Expand Down
6 changes: 4 additions & 2 deletions data/extensions/Items/Tools/Shovel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NeoServer.Application.Common;
using NeoServer.Application.Features.Item.Decay;
using NeoServer.Game.Common.Contracts.Creatures;
using NeoServer.Game.Common.Contracts.Items;
using NeoServer.Game.Common.Contracts.Items.Types.Usable;
Expand All @@ -10,9 +12,8 @@
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Common.Services;
using NeoServer.Game.Common.Texts;
using NeoServer.Game.Items.Items.UsableItems;
using NeoServer.Game.Item.Items.UsableItems;
using NeoServer.Game.World.Map;
using NeoServer.Server.Helpers;

namespace NeoServer.Extensions.Items.Tools;

Expand Down Expand Up @@ -59,6 +60,7 @@ private bool OpenCaveHole(ICreature usedBy, IItem item)
transformService.Transform(player, tile.Ground, tile.Ground.Metadata.TransformTo);

tile.Ground.Decay?.StartDecay();
IoC.GetInstance<IItemDecayTracker>().Track(tile.Ground);

Map.Instance.TryMoveCreature(usedBy, tile.Location);

Expand Down
14 changes: 2 additions & 12 deletions data/extensions/NeoServer.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>default</LangVersion>

</PropertyGroup>

Expand All @@ -10,22 +11,11 @@
<PackageReference Include="System.Collections.Immutable" Version="7.0.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ApplicationServer\NeoServer.Server.Contracts\NeoServer.Server.Common.csproj"/>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game.Chats\NeoServer.Game.Chats.csproj"/>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game.Combat\NeoServer.Game.Combat.csproj"/>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game.Common\NeoServer.Game.Common.csproj"/>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game.Creatures\NeoServer.Game.Creatures.csproj"/>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game.Items\NeoServer.Game.Items.csproj"/>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game.World\NeoServer.Game.World.csproj"/>
<ProjectReference Include="..\..\src\GameWorldSimulator\NeoServer.Game\NeoServer.Game.csproj"/>
<ProjectReference Include="..\..\src\Loaders\NeoServer.Loaders\NeoServer.Loaders.csproj"/>
<ProjectReference Include="..\..\src\Standalone\NeoServer.Server.Standalone.csproj"/>
<ProjectReference Include="..\..\src\NetworkingServer\NeoServer.Networking.Handlers\NeoServer.Networking.Handlers.csproj"/>
<ProjectReference Include="..\..\src\NetworkingServer\NeoServer.Networking\NeoServer.Networking.csproj"/>
<ProjectReference Include="..\..\src\ApplicationServer\NeoServer.Server.Commands\NeoServer.Server.Commands.csproj"/>
<ProjectReference Include="..\..\src\ApplicationServer\NeoServer.Server.Contracts\NeoServer.Server.Common.csproj"/>
<ProjectReference Include="..\..\src\ApplicationServer\NeoServer.Server.Events\NeoServer.Server.Events.csproj"/>
<ProjectReference Include="..\..\src\ApplicationServer\NeoServer.Server.Jobs\NeoServer.Server.Jobs.csproj"/>
<ProjectReference Include="..\..\src\ApplicationServer\NeoServer.Server\NeoServer.Server.csproj"/>
</ItemGroup>
<ItemGroup>
<Compile Remove="Items\Sign.cs"/>
Expand Down
2 changes: 1 addition & 1 deletion data/extensions/Npcs/Rookgaard/Cipfried.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using NeoServer.Game.Common.Chats;
using NeoServer.Game.Common.Contracts.Creatures;
using NeoServer.Game.Common.Contracts.World;
using NeoServer.Game.Creatures.Npcs;
using NeoServer.Game.Creature.Npcs;

namespace NeoServer.Extensions.Npcs.Rookgaard;

Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Players/Loaders/GodLoader.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using NeoServer.Data.Entities;
using NeoServer.Game.Chats;
using NeoServer.Game.Chat.Channels;
using NeoServer.Game.Common;
using NeoServer.Game.Common.Contracts.Creatures;
using NeoServer.Game.Common.Contracts.DataStores;
using NeoServer.Game.Common.Contracts.Items;
using NeoServer.Game.Common.Contracts.World;
using NeoServer.Game.Common.Helpers;
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Creatures.Player;
using NeoServer.Game.Creature.Player;
using NeoServer.Game.World;
using NeoServer.Loaders.Players;
using Serilog;
Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Players/Loaders/TutorLoader.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using NeoServer.Data.Entities;
using NeoServer.Game.Chats;
using NeoServer.Game.Chat.Channels;
using NeoServer.Game.Common;
using NeoServer.Game.Common.Contracts.Creatures;
using NeoServer.Game.Common.Contracts.DataStores;
using NeoServer.Game.Common.Contracts.Items;
using NeoServer.Game.Common.Contracts.World;
using NeoServer.Game.Common.Helpers;
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Creatures.Player;
using NeoServer.Game.Creature.Player;
using NeoServer.Game.World;
using NeoServer.Loaders.Players;
using Serilog;
Expand Down
2 changes: 1 addition & 1 deletion data/extensions/Players/Tutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using NeoServer.Game.Common.Creatures;
using NeoServer.Game.Common.Creatures.Players;
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Creatures.Player;
using NeoServer.Game.Creature.Player;

namespace NeoServer.Extensions.Players;

Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Runes/HealingRune.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
using NeoServer.Game.Common.Helpers;
using NeoServer.Game.Common.Item;
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Game.Items.Items.UsableItems.Runes;
using NeoServer.Game.Item.Items.UsableItems.Runes;

namespace NeoServer.Extensions.Runes;

public class HealingRune : Rune, IConsumable, IUsableOnCreature, IUsableOn
public class HealingRune : Rune, IConsumable
{
public HealingRune(IItemType type, Location location, IDictionary<ItemAttribute, IConvertible> attributes) :
base(type, location, attributes)
Expand Down
6 changes: 3 additions & 3 deletions data/extensions/Services/EffectService.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using NeoServer.Game.Common.Contracts.World;
using NeoServer.Application.Common;
using NeoServer.Application.Common.Contracts;
using NeoServer.Game.Common.Contracts.World;
using NeoServer.Game.Common.Creatures;
using NeoServer.Game.Common.Location.Structs;
using NeoServer.Networking.Packets.Outgoing.Effect;
using NeoServer.Server.Common.Contracts;
using NeoServer.Server.Helpers;

namespace NeoServer.Extensions.Services;

Expand Down
4 changes: 2 additions & 2 deletions data/extensions/Spells/Attack/WaveSpell.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using NeoServer.Game.Combat.Attacks;
using NeoServer.Application.Common;
using NeoServer.Game.Combat.Attacks;
using NeoServer.Game.Combat.Spells;
using NeoServer.Game.Common;
using NeoServer.Game.Common.Contracts.Creatures;
using NeoServer.Game.Common.Contracts.DataStores;
using NeoServer.Server.Helpers;

namespace NeoServer.Extensions.Spells.Attack;

Expand Down
Loading
Loading