Skip to content

Conversation

MeikelLP
Copy link
Owner

@MeikelLP MeikelLP commented Nov 6, 2024

Implemented a single binary to be executed which includes all dependencies required to run QCX (no external dependencies).

Goal

Top notch user experience by having them just run simple binary to startup a server. This is not recommended for production usage but is valid for testing or developing purposes. This greatly reduces setup required to run QCX as developer or as a user.

The only thing required for now is the atlasinfo.txt in the data/ dir

Dependencies

The following dependencies have been mocked / replaced inside the "Single" binary:

  • Redis: In memory dictionary: InMemoryRedisStore
  • Database: Sqlite

How does it work?

  • The "Single" binary starts the Auth and the Game server as IHostedService which are handled by Microsoft.Extensions.Hosting as with the Auth and Game executables themselves.
  • Some adjustments had to be made for shared resources like the HostingOptions. These where converted to NamedOptions to allow multiple configurations in one service collection.
  • It was also required to move logic from Executables/Game and Exectuables/Auth to separate projects because referencing a executable project from another executable project can cause a lot of issues. Thus Game.Server and Auth.Server are now the place for their respective code and Game and Auth are just wrappers setting up everything required for the executable only.

Points of Interest

  • ServiceExtensions because many services have to be adjusted for this change. Since named options are scoped some services had to be made scoped too.
  • Removed IpUtils for now. Converting IPAddress to int is too easy (BitConverter.ToInt32(host.Ip.GetAddressBytes())). May be reintroduced by feature: listen on multiple addresses #200
  • World has its Load split into LoadAsync and InitAsync due to a dependency loop issue when loading in parallel to other services
  • InMemoryRedisListWrapper
  • InMemoryRedisSubscriber
  • InMemoryRedisStore - may have race condition issues? Not sure - needs to be tested - good enough for now

Other notes

  • Even if git says so: I did not touch any packets. This is just due to moving the Game & Auth project + indent changes. You can ignore those changes
  • Sadly a lot of indent changes have been made. Maybe it's time for an .editorconfig ...
  • I changed how most of the managers behave when they cannot load (config missing): They output a warning but continue to work

TODOs

  • When the PR is going to be merged (approved) adjust the CI pipeline to only run on master

# Conflicts:
#	src/Core/Core/Networking/ServerBase.cs
#	src/Core/Extensions/ServiceExtensions.cs
#	src/Executables/Auth/AuthServer.cs
#	src/Executables/Auth/Extensions/ServiceExtensions.cs
#	src/Executables/Auth/appsettings.json
#	src/Executables/Game/Extensions/ServiceExtensions.cs
#	src/Executables/Game/Game.csproj
#	src/Executables/Game/GameConnection.cs
#	src/Executables/Game/GameServer.cs
#	src/Executables/Game/appsettings.json
#	src/QuantumCore.sln
Executables are now just a tiny wrapper around the library to make QuantumCore.Single not depend on executables (causes many issues with build output)
Additionally removed the proto loaders and merged them with their respective manager
# Conflicts:
#	src/Libraries/Game.Server/AnimationManager.cs
#	src/Libraries/Game.Server/GameServer.cs
#	src/Libraries/Game.Server/ItemManager.cs
#	src/Libraries/Game.Server/MonsterManager.cs
#	src/Libraries/Game.Server/PlayerUtils/ExperienceManager.cs
#	src/Libraries/Game.Server/Services/DropProvider.cs
#	src/Libraries/Game.Server/Services/IDropProvider.cs
#	src/Libraries/Game.Server/Services/ParserService.cs
#	src/Libraries/Game.Server/Services/SpawnGroupProvider.cs
#	src/Libraries/Game.Server/SkillManager.cs
#	src/Libraries/Game.Server/Types/ItemProtoLoader.cs
#	src/Libraries/Game.Server/Types/MobProtoLoader.cs
#	src/Libraries/Game.Server/Types/StructuredFile.cs
Bumped FluentAssertions to 7.0.0-alpha.5 for fluentassertions/fluentassertions#2565
# Conflicts:
#	src/Core.Networking/PacketReader.cs
#	src/Executables/Game/Game.csproj
#	src/Executables/Game/MonsterManager.cs
#	src/Executables/Game/Packets/Character.cs
#	src/Executables/Game/Packets/CharacterDetails.cs
#	src/Executables/Game/Packets/CharacterInfo.cs
#	src/Executables/Game/Packets/CreateCharacter.cs
#	src/Libraries/Game.Server/Extensions/GameExtensions.cs
#	src/Libraries/Game.Server/Extensions/GuildExtensions.cs
#	src/Libraries/Game.Server/Extensions/GuildPacketExtensions.cs
#	src/Libraries/Game.Server/GameServer.cs
#	src/Libraries/Game.Server/ItemManager.cs
#	src/Libraries/Game.Server/PacketHandlers/TokenLoginHandler.cs
#	src/Libraries/Game.Server/Packets/ItemOwnership.cs
#	src/Libraries/Game.Server/PlayerUtils/ExperienceManager.cs
#	src/Libraries/Game.Server/PlayerUtils/GuildExperienceManager.cs
#	src/Libraries/Game.Server/Services/DropProvider.cs
#	src/Libraries/Game.Server/Services/ParserService.cs
#	src/Libraries/Game.Server/Services/SpawnGroupProvider.cs
#	src/Libraries/Game.Server/SkillManager.cs
#	src/Tests/Core.Tests/NetworkingTests.cs
#	src/Tests/Game.Tests/Game.Tests.csproj
@MeikelLP MeikelLP added type/feature New content area/docs Improvements or additions to documentation area/game The game app is affected area/auth The authentication app is affected area/dev The developer experience is affected area/hosting The infrastructure is affected labels Nov 6, 2024
@MeikelLP MeikelLP requested a review from uutkukorkmaz November 6, 2024 15:29
@MeikelLP MeikelLP merged commit 83d7fd5 into master Nov 16, 2024
5 checks passed
@MeikelLP MeikelLP deleted the feature/all-in-one branch November 16, 2024 21:26
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/auth The authentication app is affected area/dev The developer experience is affected area/docs Improvements or additions to documentation area/game The game app is affected area/hosting The infrastructure is affected type/feature New content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants