Jump to content
Eternal Lands Official Forums
Sign in to follow this  
Sadez

Buddy List

Recommended Posts

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

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

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

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

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

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 by Sadez

Share this post


Link to post
Share on other sites
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

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
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
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 :D

Share this post


Link to post
Share on other sites

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
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 :blink:

Probably yes. But I think it might be worth it.

Share this post


Link to post
Share on other sites
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) :blink:

 

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×