Skip to content

Conversation

@PierreMarguerie
Copy link
Collaborator

Issues closed

this PR closes already closed issues

Summary

Basically changed the whole client architecture.

Changes

The client is now an app featuring a thread safe queue to treat the network input, the network output is treated by a system and a service(encapsulating the queue) to pass in the system contructors.

Breaking changes

  • This code contains breaking changes:

Since IO and Game are not running in the same thread, IO callbacks need to push a function to an actionQueue (thread-safe) that the main thread will pop and execute to avoid concurrency.
Here's how to use this queue (packet spawn for example):

using Callback = std::function<void(HandlerToolbox&)>; // You will find this definition in app.hpp
void handleSpawn(Spawn packet, client::HandlerToolbox& toolbox);

Inside the "registerAllCallbacks" method:

_client.getPacketDispatcher().bind<packet::Spawn>([this] // pass the object in the context of the first lambda
        (const SessionPtr&, const packet::Spawn& packet) // then this in the parameters (standard for a callback)
        {
            _actions.push([packet] // pass the packet to the context of the second lambda
                (HandlerToolbox& tb)
                {
                     packet::handler::handleSpawn(p, tb); // Finally call the "real" handler function
                });
        });

It will then be called like this:

    Callback action;
    while (_actions.pop(action)) {
            action(_toolbox);
    }

Additional Notes

For additional explication about the usage of the different classes, man wiki.

@PierreMarguerie PierreMarguerie added this to the Final product milestone Dec 24, 2025
@PierreMarguerie PierreMarguerie self-assigned this Dec 24, 2025
@ElectronicIV ElectronicIV removed the request for review from Babouye January 1, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants