cubic-server icon indicating copy to clipboard operation
cubic-server copied to clipboard

Quality of life changes

Open STMiki opened this issue 2 years ago • 7 comments

  • [x] Add a simpler way to add a config entry
  • [x] Logger - the code is... Well... Bad.
  • [ ] Player.cpp file LOL (>1k lines)
  • [x] Force quit when smashing ctrl + c multiple times
  • [x] Remove Global from identifier in types.hpp
  • [ ] Vector return reference on operator overlaod
  • [x] Add logger level NETWORK and maybe DEV
  • [ ] Improve call to Message
  • [ ] Change where the soundSystem is tick
  • [ ] Make all enum streamable
  • [x] Add a common header file for define used everywhere
  • [ ] Change the way the height map are calculated (do a new function set block without height map calculation and an other function update height maps)
  • [ ] Rework some function naming (Player.cpp playerPickupItem())

STMiki avatar Mar 03 '23 22:03 STMiki

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 :/.

emneo-dev avatar Mar 09 '23 08:03 emneo-dev

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

STMiki avatar Mar 09 '23 09:03 STMiki

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).

emneo-dev avatar Mar 09 '23 09:03 emneo-dev

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

Trompettesib avatar Apr 25 '23 00:04 Trompettesib

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

Trompettesib avatar Apr 25 '23 14:04 Trompettesib

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

Trompettesib avatar Apr 25 '23 14:04 Trompettesib

#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

STMiki avatar May 05 '23 17:05 STMiki