19.01.2016, 18:11
My guess is, you plan to have a maximum of 2000 accounts on your server and keep the entire friendlist for all players loaded at all times?
What happens if you get 10000 accounts?
You would need to increase the array to Friends[10000][10000][isFriend].
There is no need to let the server hold all player's friends in memory all the time.
Most of the time, not all of your players will be online, so why keep all that data loaded?
Just set a maximum limit to everyone's friendlist, say 100 friends per player.
Then you can use PlayerData[playerid][FriendList][100].
When the player logs on, search the database for all his friends and load them in this enum field.
With 50 players online at a time, you only need 50 * 100 ID's in the server memory.
Even if you allow 2000 friends per player and you allow 100 players online at a time, it's still alot smaller (2000 * 100) compared to 2000*2000.
You can even use a loop to check if the loaded friend-ID's are online or offline when displaying the list in a dialog or something.
What happens if you get 10000 accounts?
You would need to increase the array to Friends[10000][10000][isFriend].
There is no need to let the server hold all player's friends in memory all the time.
Most of the time, not all of your players will be online, so why keep all that data loaded?
Just set a maximum limit to everyone's friendlist, say 100 friends per player.
Then you can use PlayerData[playerid][FriendList][100].
When the player logs on, search the database for all his friends and load them in this enum field.
With 50 players online at a time, you only need 50 * 100 ID's in the server memory.
Even if you allow 2000 friends per player and you allow 100 players online at a time, it's still alot smaller (2000 * 100) compared to 2000*2000.
You can even use a loop to check if the loaded friend-ID's are online or offline when displaying the list in a dialog or something.