HP Bar for players
#1

I am creating the code to implement a life bar above the characters. My question is: Does anyone know if the server constantly send the life values of the other characters?

On the server side I found:

if(ch->IsSearchLife() == true)
{
if(ch->m_targetPC != NULL && ch->m_targetPC->m_type != MSG_CHAR_UNKNOWN)
{
CPC* targetPC = ch->m_targetPC;
CNetMsg::SP rmsg(new CNetMsg);
UpdateClient::CharHpInfoMsg(rmsg, targetPC->m_index, targetPC->m_maxHP, targetPC->m_hp);
SEND_Q(rmsg, ch->m_desc);
}
}

I know that the server sends the values if a target is selected and you have the life searcher activated, but apart from that, the server sends the values constantly or only if the client requests them?

 

--UPDATE--

I came to the conclusion that the server only sends hp values in 3 cases, If the life searcher object is activated, If a player attacks another Or if a player enters the render range of another player(AppearMsg), so Showing these values would imply sending packets constantly and possibly consuming considerable bandwidth...

#2


4 hours ago, nicolasg said:




I am creating the code to implement a life bar above the characters. My question is: Does anyone know if the server constantly send the life values of the other characters?



On the server side I found:


if(ch->IsSearchLife() == true)
{
if(ch->m_targetPC != NULL && ch->m_targetPC->m_type != MSG_CHAR_UNKNOWN)
{
CPC* targetPC = ch->m_targetPC;
CNetMsg::SP rmsg(new CNetMsg);
UpdateClient::CharHpInfoMsg(rmsg, targetPC->m_index, targetPC->m_maxHP, targetPC->m_hp);
SEND_Q(rmsg, ch->m_desc);
}
}


I know that the server sends the values if a target is selected and you have the life searcher activated, but apart from that, the server sends the values constantly or only if the client requests them?



 



--UPDATE--



I came to the conclusion that the server only sends hp values in 3 cases, If the life searcher object is activated, If a player attacks another Or if a player enters the render range of another player(AppearMsg), so Showing these values would imply sending packets constantly and possibly consuming considerable bandwidth...




As for your question about if client store a list of other clients attribute inside, of course the reply is: no.

 

That's because is a server side task of course, is usless interrogate the server (which already has tons of other works to do) to send unused data. Of course, every client just load the information regarding the current char, otherwise it need to ask at the server what it needed, also because the server update all the stats in real time which should be sended at all clients, and that became a lot of resources lost, for something which probably will never be used.

 

So, in my opinion, implementation of HP bar is pretty stupid idea (also because you only interact with 1 object at time, and even in the PVP where you can think is useful, instead it may confuse the player with tons of HUD which already exist like title/nick/guild/effect...) ... at most you can restrict that and load the data of entities inside the radar (which should be the object reachable by the user), but still tons of data, and usless work for the server for a stupid system imo 

#3


47 minutes ago, Scura said:




As for your question about if client store a list of other clients attribute inside, of course the reply is: no.



 



That's because is a server side task of course, is usless interrogate the server (which already has tons of other works to do) to send unused data. Of course, every client just load the information regarding the current char, otherwise it need to ask at the server what it need, also because the server update all the stats in real time which should be sended at all client, and that became a lot of resources lost, for something which probably will never be used.



 



So, in my opinion, implementation of HP bar is pretty stupid idea (also because you only interact with 1 object at time, and even in the PVP where you can think is useful, instead it may confuse the player with tons of HUD which already exist like title/nick/guild/effect...) ... at most you can restrict that and load the data of entities inside the radar (which should be the object reachable by the user), but still tons of data, and usless work for the server for a stupid system imo 




Now that you mention it, I hadn't thought about it, the amount of shit on the screen would just be very annoying for the user, however I think I could just implement the bar for the selected target, with it the player don't need look to the top of screen to see char life... Thanks for answering my question and for the idea^^

#4

/index.php?/profile/14423-nicolasg/&do=hovercard" data-mentionid="14423" href="/index.php?/profile/14423-nicolasg/" rel="">@nicolasg

If the client Says to the server, I have a target on that Player and I want to get real time update of that player without direct interaction (normal attack, skill, or in-out range) there is something out of the box already done?

#5


1 hour ago, Andrein95 said:




/index.php?/profile/14423-nicolasg/&do=hovercard" data-mentionid="14423" href="/index.php?/profile/14423-nicolasg/" rel="">@nicolasg

If the client Says to the server, I have a target on that Player and I want to get real time update of that player without direct interaction (normal attack, skill, or in-out range) there is something out of the box already done?




The closest thing to that would be the life searcher



Forum Jump:


Users browsing this thread: 2 Guest(s)