CubicMC / cubic-server

A fast and extensible C++ Minecraft server implementation
https://cubicmc.org
GNU General Public License v3.0
53 stars 6 forks source link

Quality of life changes #117

Closed STMiki closed 4 months ago

STMiki commented 1 year ago
emneo-dev commented 1 year ago

I was thinking of maybe change to a external log library altogether (spdlog for example, which we can add sinks to make the gui code better than currently).

For player.cpp I don't think we can do much about it, because it makes sense to have all that code here. It is kinda painful to go through but overall I don't see how we can change that :/.

STMiki commented 1 year ago

For the Player.cpp I think there are parts that can be optimized (the registry cough cough). But most of the code are event handling, so we can reduce it a little, but not by much unfortunately

emneo-dev commented 1 year ago

The registry is already planned to be reworked, but for the event handling I think that it is fine. Putting that stuff in other folders might just make the code less maintainable overall (Just a supposition).

Trompettesib commented 1 year ago

Sound System is ticked in the worldGroup running cycle https://github.com/CubicMC/cubic-server/blob/ad0f0ab975fc308786653893c6d2cbc3f7dbc67f/cubic-server/WorldGroup.cpp#L35

Trompettesib commented 1 year ago

Make all enum's streamable to be able to use them in the logger without having to cast everywhere.

Trompettesib commented 1 year ago

change where some define are to put them all in a specific file (like UNUSED who is in Server.hpp)

STMiki commented 1 year ago
#define _SEND_PACKET_DECLARATION(packet, debug)                 \
    void Player::send##packet(const protocol::packet &data) \
    {                                                    \
        auto pck = protocol::create##packet(data);          \
        _cli->_sendData(*pck);                           \
        LDEBUG(debug);              \
    }

#define SEND_PACKET_DECLARATION_WITH_DEBUG(packet, debug) _SEND_PACKET_DECLARATION(packet, debug)
#define SEND_PACKET_DECLARATION(packet) _SEND_PACKET_DECLARATION(packet, "Sent a" #packet " packet")

Idea for reducing the size of player.cpp