Page 1 of 2

[HELP] RoseZa - Health not showing properly

PostPosted: Sun Nov 15, 2015 12:09 pm
by toyz
Hi there,
I'm sorry if this isn't the right place to post this

So basically, There is a bug with my server files with the way the server sends the user's HP and MP.

Let's say i'm in game and have 100% HP, it will say 7,000/7,000
i attack a monster, and i get damage, the HP still remains 7,000/7,000
I tried investigating the issue and realized that when i type "/info"
the server sees my HP as 9,000/9,000
So the monster did damage to me, but in reality the damage is subtracted from the 9,000 and therefore my client doesn't see that damage until it reaches below 7k

(numbers are just for clarification)

I believe it is an issue with how the server files send char packets to the client but i don't know what to look for
I'm just starting out with coding and server files and could really use some guidance and help :(


Sorry for the long post!
Hope someone can help out

Thank you :)

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Mon Nov 16, 2015 3:35 pm
by PurpleYouko
It's not packets. Those are fine.
Your problem is that your server and client are both calculating your stats and they don't agree.
When you send a 0x0799 packet to the client to show damage given it goes to a function which "adjusts" your HP by the amount of damage received. It has no way to know what the server thinks your maxhp is. It just goes on it's own calculated value.
Since the damage packet only contains damage and not totals then all the client can do is display what it thinks is right.

The other half of the problem is the 0x07ec packet which is sent on every game cycle for every character.
This one contains values for your current HP and MP as seen in the server so if the server is sending 9000 - whatever damage was taken (500 for sake of argument) then the client receives a value of 8500 as current HP. It's internal code takes a look at this and sees that it is above its own calculated max so it displays that instead. Therefore you get 7000 almost continuously with just a few blips when damage is actually taken.

There are only 2 possible solutions for this
1) Get a hold of the client source code and fix it so that it only displays what the server tells it to.
2) Fix your server side MaxHP calculations so that they match the ones the client is using.

I'm currently looking into ways to do option 1 using the evo 137 files that were released a couple of years ago but due to the client code architecture it's taking a long time to get it into any kind of usable condition.

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Tue Nov 17, 2015 1:49 am
by toyz
PurpleYouko wrote:It's not packets. Those are fine.
Your problem is that your server and client are both calculating your stats and they don't agree.
When you send a 0x0799 packet to the client to show damage given it goes to a function which "adjusts" your HP by the amount of damage received. It has no way to know what the server thinks your maxhp is. It just goes on it's own calculated value.
Since the damage packet only contains damage and not totals then all the client can do is display what it thinks is right.

The other half of the problem is the 0x07ec packet which is sent on every game cycle for every character.
This one contains values for your current HP and MP as seen in the server so if the server is sending 9000 - whatever damage was taken (500 for sake of argument) then the client receives a value of 8500 as current HP. It's internal code takes a look at this and sees that it is above its own calculated max so it displays that instead. Therefore you get 7000 almost continuously with just a few blips when damage is actually taken.

There are only 2 possible solutions for this
1) Get a hold of the client source code and fix it so that it only displays what the server tells it to.
2) Fix your server side MaxHP calculations so that they match the ones the client is using.

I'm currently looking into ways to do option 1 using the evo 137 files that were released a couple of years ago but due to the client code architecture it's taking a long time to get it into any kind of usable condition.


OH! I had no idea the client calculated stats as well!
Thought it was just server files that handled the calculations.
Honestly, my client editing abilities are limited to what is posted in forums haha, so i can't do 1.
But i will give #2 a shot.

Sorry if this sounds dumb, but how would i use the client's HP calculations instead of server?

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Wed Nov 18, 2015 3:25 pm
by PurpleYouko
You have to use a process of trial and error.
You start with no items equipped on a new character and record the server and client values then start levelling up, adding stats and items until you find a step that makes them different. The you look at the server calculation in playerstats.cpp and figure out how to make them read the same as the client does.

It's extremely time consuming.
I went through the same process for INT effect on buffs a few years back.
I actually made a lookup table that extends to a value of 600. Beyond that it's not really a lot of use.
I'm always telling people to keep their stats lower than that but no, they have to go to 2000 INT or some stupid value then apply a speed buff then complain because the get disconnected when they go through a portal to another map.
I discovered last week that the actual rose client code that I'm working with only calculates these buffs up to about 500. That's why INT above 500 returns a non-linear and unpredictable buff. :D

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Thu Nov 19, 2015 12:50 am
by toyz
Oh yeah? What files are you using? (curious)

AND DAMN... i see, yeah that does sound like a lot of work haha, um but i guess it has to be done. If i figure it out i will post here the solution as well as all the coding i did, might as well give back to the community.

I'll post another reply if i actually managed to figure something out haha.
Time consuming processes i like, i have some time on my hands, i actually adjusted the entire damage system in roseza files so that it is more balanced.. took me 3 days of trial and error
most annoying part was AOE summon dmg lol, apparently (for some strange reason) some summons also do AOE dmg.. and that value was retardedly high
Also most of my battle.cpp is adjustable through website, like pvp or pvm dmgs, skill dmgs, and summon dmgs, also monster dmgs. just in case i need to tweak values in the future

very simple coding, but time consuming :(

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Thu Nov 19, 2015 8:40 pm
by PurpleYouko
The source I'm using is the one that was released at ragezone a couple of years ago.
It would appear that I'm one of the few people who have actually managed to compile the damn thing into a usable rose client :)

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Fri Nov 20, 2015 9:34 am
by toyz
PurpleYouko wrote:The source I'm using is the one that was released at ragezone a couple of years ago.
It would appear that I'm one of the few people who have actually managed to compile the damn thing into a usable rose client :)


Oh wow!
that's kind of my goal with roseza files, it's super fucking hard there are so many little bugs here and there

Would it be okay if i added you on skype? i promise not to bug you everyday
I'd just like your opinion on somethings

if it's okay of course

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Fri Nov 20, 2015 3:23 pm
by PurpleYouko
The problem with doing it with the roseZA files is that you can never quite be sure what the client end is doing. We used to be able to get some feel for it by capturing packets when it was running live from NARose but now the client is just a black box with no way to know what's going on inside

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Thu Jan 21, 2016 7:03 am
by toyz
Was looking at various packets but still no luck.

Really don't feel like adjusting the HP formulas to match the client, but i guess it's the only alternative.
Besides forcing the TRose to accept a packet for HP instead.

I think it's dumb how they designed it to calculate it on its own instead of relaying on the server..

Re: [HELP] RoseZa - Health not showing properly

PostPosted: Thu Jan 21, 2016 5:52 pm
by PurpleYouko
yes it certainly IS dumb.
The client should exist only to graphically display stuff that arrives from the server.
The only kind of calculations it needs to do are things like collision detection and constantly updating the current location of game objects moving from start location to destination location.
It actually does that pretty well except that it also calculates your move speed before it displays intermediate positions.

In my current client code it no longer does this. I can now set Move Speed from the server and the client complies completely. Only bug right now is that it doesn't increase animation speed for high move rates. I'll get back to that later though