Chuk
Member
Hello,
Got a couple of ideas on reworking the PSOBB server.
First of all, keeping these goals in mind :
Target platforms (cross platform is always better but can make stability an issue)
Operation systems
Database
Now for the software itself, I came up with a basic but solid class system on how to tackle this in a more object oriented way. Here is a brief and simple description about how the classes could be organized :
Classes
Login
This class will handle the login of the clients and make the different ships selectable. It will also keep track of the number of players logged in, the logouts and create the initial character packets that need to be sent to the client when they join the game.
Patcher
To update new content or small changes to the game like skins or lobby music we will need this class to update all changes to the different installed clients. We must make sure the patcher forces all clients to update.
PacketHandler
This class sends/receives the packets, encrypts/decrypts, filters them and sends them to the right subclass. ItÔÇÖs possible to turn on or off logging of packets in this class and it also checks for malformed packets. It also has an option to visualize packets in a human readable way. I would like to reduce the amount of dealing with raw packets in other classes to a minimum. This could cost us a bit of performance BUT will keep the code a lot cleaner. Packets could also easily be formed using enums to make working with them much easier.
DatabaseHandler
This class loads and stores everything the server needs. It needs simple functions that can be used by the other classes to quickly store and load data. It will also check the data before it saves it to prevent storing corrupted data.
ConfigurationLoader
This class should handle the various configurations the server needs, like the drops, rare monster settings, etc. Preferably store the configurations with xml or another clear human readable format. The configurations must be read on ship startup but also reloadable when the ship is already running.
CommandHandler
This class will include all commands users and GMs can use. It also checks the permissions and logs the used commands in a both raw format and human readable way. I suggest this class passes on the ÔÇÿworkÔÇÖ to the other classes but just handles the command invocation and throughput.
ServerView
This is an optional class that will wrap up the interface visually for easy managing and configuration of the server. Any option that is available here should also be available through command line. Perhaps this could even work remotely but this is also optional.
Player
This class holds all the information of the currently logged on player. When the login is successful, the login creates an instance of this class to easily store and pass data to other classes. This class contains ALL information the player needs to play as well as extra information that is useful for the server.
Ship
This class contains the configurations/settings that were loaded by the ConfigurationLoader and contains basic data like the ÔÇÿplayers onlineÔÇÖ on the ship, the rooms that are up etc. Unlike in the tethalla project, this class holds more functional data than actual methods to process packets. (there can be a few though). It would be good if a list of online players could be pulled in xml and updated frequently so we could display it on a webpage.
Item
This is more a class that stores the information of the item but itÔÇÖs not a struct because there can be methods in this class that alter the item. For example a method to change the special or stats of the weapon. Perhaps make a few subclasses depending on the item type, following the liskov substitution principle.
Sublcasses
DamageManager
This will handle the damage dealt to the objects. Between players and other players, players and enemies, enemies and enemies, etc. This also handles the kills, negative statuses and anything related to this. Perhaps also interaction between players like Resta, buffs, etc. or we can make another class for those.
ItemManager
This class will manage the item transactions and will make following subclasses work together (this could eventually be replaced if we do the managing in the ship class after all )
TradeManager
The tradewindow gets managed by this class. Trading items between player in a safe way to prevent corruption, ghosting or item scamming.
BankManager
This handles anything related to bank transactions, storing / withdrawing items and meseta.
ShopManager
Anything related to selling and buying things in the shop are handled here. Who knows we could some nifty options to the shop later on like selling rare items for PDs.
InventoryManager
Picking up an item, dropping an item, sorting your inventory, equipping an item must be regulated in this class. ( Also combining items. )
GameManager
This class handles joining rooms, setting passwords, keeping an eye on the difficulty, locking rooms with a quest, changing lobbies, etc.
QuestManager
Loading the quests, sending them to the players, keep an eye on the reward system. Perhaps we could also somehow keep track of the quest progress to let the users join a quest in progress, with some limitations ofcourse.
ChallengeManager
Everything that is needed in challenge mode will be handled here.
BattleManager
Everything that is needed in battle mode will be handled here.
EventManager
Setting a specific event and applying all changes that come with this will be handled here, it would be nice if we can somehow create and store event configurations and load them in this class.
CommunicationManager
Sending messages, chatting in the lobby, announcements, logging messages on the client side, all this must be regulated here. Perhaps we could also add a function to support chatting from outside the game.
Open for any feedback and remarks.
Got a couple of ideas on reworking the PSOBB server.
First of all, keeping these goals in mind :
Stability
Simplicity
Customizability
Anti-cheat prevention
Target platforms (cross platform is always better but can make stability an issue)
Operation systems
- Windows
Linux
Database
- PostgreSQL
MySQL
Now for the software itself, I came up with a basic but solid class system on how to tackle this in a more object oriented way. Here is a brief and simple description about how the classes could be organized :
Classes
Login
This class will handle the login of the clients and make the different ships selectable. It will also keep track of the number of players logged in, the logouts and create the initial character packets that need to be sent to the client when they join the game.
Patcher
To update new content or small changes to the game like skins or lobby music we will need this class to update all changes to the different installed clients. We must make sure the patcher forces all clients to update.
PacketHandler
This class sends/receives the packets, encrypts/decrypts, filters them and sends them to the right subclass. ItÔÇÖs possible to turn on or off logging of packets in this class and it also checks for malformed packets. It also has an option to visualize packets in a human readable way. I would like to reduce the amount of dealing with raw packets in other classes to a minimum. This could cost us a bit of performance BUT will keep the code a lot cleaner. Packets could also easily be formed using enums to make working with them much easier.
DatabaseHandler
This class loads and stores everything the server needs. It needs simple functions that can be used by the other classes to quickly store and load data. It will also check the data before it saves it to prevent storing corrupted data.
ConfigurationLoader
This class should handle the various configurations the server needs, like the drops, rare monster settings, etc. Preferably store the configurations with xml or another clear human readable format. The configurations must be read on ship startup but also reloadable when the ship is already running.
CommandHandler
This class will include all commands users and GMs can use. It also checks the permissions and logs the used commands in a both raw format and human readable way. I suggest this class passes on the ÔÇÿworkÔÇÖ to the other classes but just handles the command invocation and throughput.
ServerView
This is an optional class that will wrap up the interface visually for easy managing and configuration of the server. Any option that is available here should also be available through command line. Perhaps this could even work remotely but this is also optional.
Player
This class holds all the information of the currently logged on player. When the login is successful, the login creates an instance of this class to easily store and pass data to other classes. This class contains ALL information the player needs to play as well as extra information that is useful for the server.
Ship
This class contains the configurations/settings that were loaded by the ConfigurationLoader and contains basic data like the ÔÇÿplayers onlineÔÇÖ on the ship, the rooms that are up etc. Unlike in the tethalla project, this class holds more functional data than actual methods to process packets. (there can be a few though). It would be good if a list of online players could be pulled in xml and updated frequently so we could display it on a webpage.
Item
This is more a class that stores the information of the item but itÔÇÖs not a struct because there can be methods in this class that alter the item. For example a method to change the special or stats of the weapon. Perhaps make a few subclasses depending on the item type, following the liskov substitution principle.
Sublcasses
DamageManager
This will handle the damage dealt to the objects. Between players and other players, players and enemies, enemies and enemies, etc. This also handles the kills, negative statuses and anything related to this. Perhaps also interaction between players like Resta, buffs, etc. or we can make another class for those.
ItemManager
This class will manage the item transactions and will make following subclasses work together (this could eventually be replaced if we do the managing in the ship class after all )
TradeManager
The tradewindow gets managed by this class. Trading items between player in a safe way to prevent corruption, ghosting or item scamming.
BankManager
This handles anything related to bank transactions, storing / withdrawing items and meseta.
ShopManager
Anything related to selling and buying things in the shop are handled here. Who knows we could some nifty options to the shop later on like selling rare items for PDs.
InventoryManager
Picking up an item, dropping an item, sorting your inventory, equipping an item must be regulated in this class. ( Also combining items. )
GameManager
This class handles joining rooms, setting passwords, keeping an eye on the difficulty, locking rooms with a quest, changing lobbies, etc.
QuestManager
Loading the quests, sending them to the players, keep an eye on the reward system. Perhaps we could also somehow keep track of the quest progress to let the users join a quest in progress, with some limitations ofcourse.
ChallengeManager
Everything that is needed in challenge mode will be handled here.
BattleManager
Everything that is needed in battle mode will be handled here.
EventManager
Setting a specific event and applying all changes that come with this will be handled here, it would be nice if we can somehow create and store event configurations and load them in this class.
CommunicationManager
Sending messages, chatting in the lobby, announcements, logging messages on the client side, all this must be regulated here. Perhaps we could also add a function to support chatting from outside the game.
Open for any feedback and remarks.