Sadez Report post Posted January 25, 2005 I have started to add the server part of the buddy list. It's very basic and it's supposed to work like this: 1) There are 2 commands #add_buddy and #delete_buddy. These add or delete a buddy from the list on the server. 2) When someone logins or disconnects from the server, it sends a BUDDY_EVENT(this is already supported on the client) message to the players that have him on the buddy list. Right now it's far from being finished and the only possible things are to add a buddy and get notifications when someone has logged in. Other things that could be added are, different types of budies, a command to list your list, diferent size of the list if p2p or not, notifying sounds, etc. So what do you think, shall I continue this way or someone has a better plan on how to do this? Share this post Link to post Share on other sites
mihaim Report post Posted January 25, 2005 I have started to add the server part of the buddy list. It's very basic and it's supposed to work like this: For BM ? Or we make it compatible and use it in both servers ? Where do you store buddy informations ? Share this post Link to post Share on other sites
Sadez Report post Posted January 25, 2005 Yes, the idea is to make it work on both servers. It is stored as an Uint32 array in player_base. You save the CRC32 of the player name instead of all the string. Share this post Link to post Share on other sites
mihaim Report post Posted January 26, 2005 Yes, the idea is to make it work on both servers.It is stored as an Uint32 array in player_base. You save the CRC32 of the player name instead of all the string. Yep . Let's make a That's a good ideea Saves some space in the player save file . Buddy list should be limited to 20 - 32 buddyes. Things to consider : 1) the list can be used for buddyes or for enemys . We should think of a way to differentiate between buddyes . Let's reserve 1 uchar for buddy type ( friend , enemy , etc ) . As soon as i finish the work on the new mod interface i'll focus on this too. Share this post Link to post Share on other sites
Entropy Report post Posted January 26, 2005 That's how I wanted to make it in the first place (int32 array). However, no CRC, that can lead to problems, instead, each player should have a UID, assign by the server. This UIS thing should be permanent and incremental (first player that logs in has UID=1, then the next one 2, etc.) An UID of 0 means that the player has no UID assigned, so it should be assigned one. Share this post Link to post Share on other sites
Dingar Report post Posted January 26, 2005 Bit of overkill for something that could be easily stored in el.ini, isn't it? That would save server disk space, disk access calls(be they from database reads or player data file opening, don't know your structure) at the expense of a very small addition to traffic when the client queries the list. It would also be extensible, no having to modify player data structure every time you decide to add another buddy type. Putting it in a playername.ini would save the problem of having multiple characters with individual lists and would still leave all the disk access load on the client machine where it will go completely unnoticed. Decide what you like but I think server-side buddy lists are going to wind up being an unnecessary headache if you end up going with them. Share this post Link to post Share on other sites
Hammen Report post Posted January 26, 2005 Bit of overkill for something that could be easily stored in el.ini, isn't it? That would save server disk space, disk access calls(be they from database reads or player data file opening, don't know your structure) at the expense of a very small addition to traffic when the client queries the list. It would also be extensible, no having to modify player data structure every time you decide to add another buddy type. Putting it in a playername.ini would save the problem of having multiple characters with individual lists and would still leave all the disk access load on the client machine where it will go completely unnoticed. Isn't internet traffic much more of a bottleneck than the Server CPU load though? Share this post Link to post Share on other sites
Dingar Report post Posted January 26, 2005 Two packets each query isn't much of a bottleneck compared to storing the who list of every character ever created or the resources required to retrieve and compare the data from a, possibly, insanely large db of player data. And unless you want to keep every online player's list loaded into memory on the server you have to hit the disk for that comparison rather than compare the in-memory list of online players to the temporary list supplied by the player. *shrug* Maybe it's just me being an admin. I hate lusers bogging down servers any more than is truly necessary. Share this post Link to post Share on other sites
Sadez Report post Posted January 26, 2005 That's how I wanted to make it in the first place (int32 array). However, no CRC, that can lead to problems, instead, each player should have a UID, assign by the server. This UIS thing should be permanent and incremental (first player that logs in has UID=1, then the next one 2, etc.)An UID of 0 means that the player has no UID assigned, so it should be assigned one. Added a new variable called uid on player_base. On login the server checks if the uid is 0, if it is it gets the last used id from last_id.bin increments by one, adds the id to the player, saves last_id.bin with the new value and saves player data. Having this id is much better than calculating the CRC, there wont be collisions(2 or more players with same crc) and it removes the overhead of caculating it from the player name. Share this post Link to post Share on other sites
Entropy Report post Posted January 26, 2005 Don't make a whole file for that last_id. Instead, use persistent_data.bin Share this post Link to post Share on other sites
Sadez Report post Posted January 26, 2005 (edited) I used a new file because persistent_data is like 100k, and the file needs to be saved every time a new id given. If we dont save the file each time and a crash happened we could end giving duplicated ids. The buddy list currently has: - Size: 32 players - Commands #add_buddy name type: Adds a player to your buddy list with the specified type. #del_buddy name: Deletes a buddy from your list #clear_buddy: Clears all the buddy list. - You get notifications on login, when other user logs in and when users log out or get disconnected. I'll commit the code in a few minutes. *edit*Commited, for BM only. I left the file last_id.bin, but I'll change it if you say it Edited January 26, 2005 by Sadez Share this post Link to post Share on other sites
Entropy Report post Posted January 26, 2005 Ok, you have a point with the crash and duplicate ids Let it your way then. Share this post Link to post Share on other sites
mihaim Report post Posted January 26, 2005 II'll commit the code in a few minutes.*edit*Commited, for BM only. I left the file last_id.bin, but I'll change it if you say it May i have the code to add to El as well ? if is possible in diff -Naur form Share this post Link to post Share on other sites
Sadez Report post Posted January 27, 2005 I have made a little program to give an id to every player. This way we won't have to check if the player already has an id at login, since the only new ids will be given at character creation. With some small modifications it could be used to create an elulist.txt file with the player name, uid, and guild of every player. With this file we could implement commands to list guild members and all your buddies. What do you think of this? Share this post Link to post Share on other sites
Grum Report post Posted January 27, 2005 I have made a little program to give an id to every player. This way we won't have to check if the player already has an id at login, since the only new ids will be given at character creation. With some small modifications it could be used to create an elulist.txt file with the player name, uid, and guild of every player. With this file we could implement commands to list guild members and all your buddies. What do you think of this? *is not involved in this at all, but speaks up anyway* I think that if you're going the way of a text file, you'll find that one day you want to add another field to this file. If you give every player a unique ID now anyway, why not set up a database with *all* player info? (Note: not, I don't know shit about databases. But it seems to me that especially for BM it could be useful to be able to extract all info about players, guilds, etc. in an easy way.) Share this post Link to post Share on other sites
Sadez Report post Posted January 27, 2005 I think that if you're going the way of a text file, you'll find that one day you want to add another field to this file. If you give every player a unique ID now anyway, why not set up a database with *all* player info? You are right but this will require A LOT of work Share this post Link to post Share on other sites
Entropy Report post Posted January 27, 2005 This method with that list would be nice, but the downside is that it will be much harder to change people's names... But I guess, do it, and we'll dissable the name change (or charge 10 times more for it) Share this post Link to post Share on other sites
Grum Report post Posted January 28, 2005 I think that if you're going the way of a text file, you'll find that one day you want to add another field to this file. If you give every player a unique ID now anyway, why not set up a database with *all* player info? You are right but this will require A LOT of work Probably yes. But I think it might be worth it. Share this post Link to post Share on other sites
Sadez Report post Posted January 28, 2005 This method with that list would be nice, but the downside is that it will be much harder to change people's names...But I guess, do it, and we'll dissable the name change (or charge 10 times more for it) I'll make it possible to refresh the list on server startup so there won't be additional problems with name changes. Share this post Link to post Share on other sites
Sadez Report post Posted January 28, 2005 Added the elulist and a command to list all your buddy list (#list_buddy). Next things to do are commands for listing guild members and deleting not connected members. Share this post Link to post Share on other sites
Entropy Report post Posted January 28, 2005 KK, time to updated my BM CVS, and commit some of my changes Share this post Link to post Share on other sites
Sadez Report post Posted January 28, 2005 Added #list_guild to list guild members. You can also delete offline players if you are the guild master. Share this post Link to post Share on other sites