Welcome Guest ( Log In | Register )

2 Pages V < 1 2  
Reply to this topicStart new topic
> [Request] HV Stamina to Rounds Converter Script, Do you know how stamina works?

 
post Feb 21 2016, 03:27
Post #21
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,659
Joined: 27-November 13
Level 500 (Godslayer)


QUOTE(EnTriel @ Feb 21 2016, 01:18) *
That's an option too (IMG:[invalid] style_emoticons/default/tongue.gif)..
Well, I have a question about the stamina recovery. We know that it recovers 1 point every 1 hour. But how does it work exactly? Do we get a point every hour at hundreds (I mean 1:00, 2:00, 3:00 etc.), or is there a counter dedicated to us which starts counting as soon as we played a turn after a full recovery?

If I learn the answer of this question, I can provide a more accurate script, which would even show the right value at the max stamina 99.

So does anyone know the answer?
QUOTE(mozilla browser @ Feb 14 2016, 07:11) *
You can treat Stamina as though it is stored internally as a floating point even though it is displayed as an integer.
Stamina regeneration is also near continuous. I'd guess 1/50 stamina every 1/50 of an hour, at least that's how I'd set it up since that's the smallest unit there's a point in using.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 03:51
Post #22
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


QUOTE(Superlatanium @ Feb 21 2016, 01:27) *

Stamina regeneration is also near continuous. I'd guess 1/50 stamina every 1/50 of an hour, at least that's how I'd set it up since that's the smallest unit there's a point in using.

Are you sure about that? If so, how does it fare when you are in combat? Because wiki says that it regenerates while you are in combat but does not show it unless you get out of combat.

If Tenboro were to enlighten us, that would be great. but I'm sure that a relatively meaningless script about a game he created just because he was bored, would not interest him that much (IMG:[invalid] style_emoticons/default/smile.gif).
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 03:55
Post #23
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,659
Joined: 27-November 13
Level 500 (Godslayer)


QUOTE(EnTriel @ Feb 21 2016, 01:51) *
Are you sure about that? If so, how does it fare when you are in combat? Because wiki says that it regenerates while you are in combat but does not show it unless you get out of combat.
Yep, that's how it works.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 04:14
Post #24
simrock87



<('.'<) (>'.')> (^'.')>
*****
Group: Members
Posts: 647
Joined: 12-June 11
Level 399 (Godslayer)


QUOTE(Superlatanium @ Feb 21 2016, 01:27) *

Stamina regeneration is also near continuous. I'd guess 1/50 stamina every 1/50 of an hour, at least that's how I'd set it up since that's the smallest unit there's a point in using.

Should also be pretty easy to confirm in any case.
GF until stamina drops, flee battle, wait 5 minutes, if it goes back up, repeat to confirm.

Probably not the way i'd do it, but since this topic started, i've come up with waaaaaayyy too many ways to store this in a database (IMG:[invalid] style_emoticons/default/biggrin.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 04:25
Post #25
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


QUOTE(Superlatanium @ Feb 21 2016, 01:55) *

Yep, that's how it works.

That's a tough one to keep track of. You keep losing stamina in an arena, but you also keep gaining it without knowing about it(?). That's confusing.

For example if I were to enter a 100 rounds arena at 80 stamina, and stop playing for three hours when I get to 79 stamina, and kept playing after that; would it mean that I will not have the 100% bonus, even though I regenerated the stamina outside of the battle?

As a second question:

For example if I were to enter a 30 rounds arena at 98 stamina just seconds from getting my regeneration to 99 points, and then after playing just 5 rounds stop playing for 90 minutes (outside of battle my stamina would be full now so it would stop regenerating), and then complete the rest of it in 2 hours. What would be my stamina when I get out of that arena?

PS: Sorry, I created a mess out of it but in order to write an accurate script I need to know the details...
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 04:46
Post #26
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,659
Joined: 27-November 13
Level 500 (Godslayer)


QUOTE(EnTriel @ Feb 21 2016, 02:25) *
That's a tough one to keep track of. You keep losing stamina in an arena, but you also keep gaining it without knowing about it(?). That's confusing.

For example if I were to enter a 100 rounds arena at 80 stamina, and stop playing for three hours when I get to 79 stamina, and kept playing after that; would it mean that I will not have the 100% bonus, even though I regenerated the stamina outside of the battle?

As a second question:

For example if I were to enter a 30 rounds arena at 98 stamina just seconds from getting my regeneration to 99 points, and then after playing just 5 rounds stop playing for 90 minutes (outside of battle my stamina would be full now so it would stop regenerating), and then complete the rest of it in 2 hours. What would be my stamina when I get out of that arena?

PS: Sorry, I created a mess out of it but in order to write an accurate script I need to know the details...
You have exactly the bonus displayed in HV, which is determined by the displayed stamina. The effect is what you see, which is intuitive, and you might look at it this way: at the end, you instantly gain (1 stamina * hours_played), a continuous pool which is only added to your stamina once you exit the battle.

Is stamina rounded, or rounded down? I'm pretty sure it's rounded down (80.95 -> displayed 80) but I haven't been at 99 in too long so I wouldn't know. Can't be sure of the exact results of either question unless that's known (or without additional specification).

What can be said, at least: for example, Start grindfest with stamina 90. Don't play for 19 hours, then finish the GF in the last one hour. Stamina goes down by 10 (250 rounds) and then by 5 (750 rounds) = 15, so on round 1000 you see stamina 75. After you finish, the pool of +20 would be added, so you'd see stamina 95. Some time ago I took advantage of this to start DwD even when I couldn't finish it for a long time, just to avoid going over 99 stamina. You can do something similar if you want to make sure only to play at 79 stamina and below, even if you'd get to 80 or more stamina out of battle. (start a GF at 79 stamina, afk for 19 hours, finish in one hour, end up with 79 stamina by the end, nothing wasted)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 05:16
Post #27
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


QUOTE(Superlatanium @ Feb 21 2016, 02:46) *

You have exactly the bonus displayed in HV, which is determined by the displayed stamina. The effect is what you see, which is intuitive, and you might look at it this way: at the end, you instantly gain (1 stamina * hours_played), a continuous pool which is only added to your stamina once you exit the battle.

Is stamina rounded, or rounded down? I'm pretty sure it's rounded down (80.95 -> displayed 80) but I haven't been at 99 in too long so I wouldn't know. Can't be sure of the exact results of either question unless that's known (or without additional specification).

What can be said, at least: for example, Start grindfest with stamina 90. Don't play for 19 hours, then finish the GF in the last one hour. Stamina goes down by 10 (250 rounds) and then by 5 (750 rounds) = 15, so on round 1000 you see stamina 75. After you finish, the pool of +20 would be added, so you'd see stamina 95. Some time ago I took advantage of this to start DwD even when I couldn't finish it for a long time, just to avoid going over 99 stamina. You can do something similar if you want to make sure only to play at 79 stamina and below, even if you'd get to 80 or more stamina out of battle. (start a GF at 79 stamina, afk for 19 hours, finish in one hour, end up with 79 stamina by the end, nothing wasted)


If what you described is true, than my current script only shows the true value after we lost a stamina point in battle.

That's a bummer.

I didn't know that we could avoid going over 99 by leaving the game in a long battle and playing the battle when we came back. Just spend more that you would regenerate and you are safe. That's interesting...

This post has been edited by EnTriel: Feb 21 2016, 05:35
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 05:35
Post #28
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


I should detect start and end of battles and add the regenerated points at the end of battle, I should also keep track of regeneration outside of battle.

Because it seems that we could stay at the same stamina forever if we were to play one round of GF then flee and then wait for a time just to recover one round's worth of stamina points. Am I right?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 21 2016, 12:38
Post #29
f4tal



Veteran Poster
********
Group: Members
Posts: 2,662
Joined: 10-January 13
Level 416 (Godslayer)


Added your script in Compendium & MegaPack ^^

This post has been edited by f4tal: Feb 21 2016, 12:38
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 22 2016, 01:05
Post #30
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


QUOTE(f4tal @ Feb 21 2016, 10:38) *

Added your script in Compendium & MegaPack ^^

Well if you ask me, it needs a lot of work before being ready to be published, but I see that you follow these topic quite closely, so you would probably know it when I had the time to update the script.

So feel free to do as you see fit (IMG:[invalid] style_emoticons/default/smile.gif).

This post has been edited by EnTriel: Feb 22 2016, 01:06
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 22 2016, 10:40
Post #31
f4tal



Veteran Poster
********
Group: Members
Posts: 2,662
Joined: 10-January 13
Level 416 (Godslayer)


QUOTE
before being ready to be published

But script is already published (see first post) xD

I am collecting different versions of script for history and coding practice purpose, so I am posting in Compendium probably everything I can find in Net and forums. ^^
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 23 2016, 20:56
Post #32
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


I have one more question, which would affect a lot in my code.
Does everyone have their own counter for stamina regeneration or there is only one counter which gives 1/50 points of stamina to everyone at the same time?

For example, if I were to be at full stamina, and enter a random encounter, finish it in 10 seconds, would it take another 62 seconds to get that 1/50 back? Or there is a system which gives everyone at the same time 1/50 stamina every 72 seconds?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 23 2016, 21:52
Post #33
f4tal



Veteran Poster
********
Group: Members
Posts: 2,662
Joined: 10-January 13
Level 416 (Godslayer)


QUOTE
Does everyone have their own counter for stamina regeneration or there is only one counter which gives 1/50 points of stamina to everyone at the same time?

This is a very metaphysical question. o_o

I guess, but only guess, - everyone have their own counter. But the truth may only know Tenboro - ask him, only code-wise men may know answer on your question. And I am very interested in answer, too.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 23 2016, 22:55
Post #34
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


QUOTE(f4tal @ Feb 23 2016, 19:52) *

This is a very metaphysical question. o_o

I guess, but only guess, - everyone have their own counter. But the truth may only know Tenboro - ask him, only code-wise men may know answer on your question. And I am very interested in answer, too.

Well, I don't want to disturb him, administrating a community could be a very time consuming job, and I don't want to take even 5 minutes of his time for a script which in fact does not add much to the gaming experience.

I will try to finish the code using the observations of the community. If Tenboro or anybody else who knows the answer wishes to share it with us, they may do so here in this topic. Otherwise I will not ask anyone directly...

This post has been edited by EnTriel: Feb 23 2016, 22:56
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 24 2016, 01:32
Post #35
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,659
Joined: 27-November 13
Level 500 (Godslayer)


QUOTE(EnTriel @ Feb 23 2016, 18:56) *
I have one more question, which would affect a lot in my code.
Does everyone have their own counter for stamina regeneration or there is only one counter which gives 1/50 points of stamina to everyone at the same time?

For example, if I were to be at full stamina, and enter a random encounter, finish it in 10 seconds, would it take another 62 seconds to get that 1/50 back? Or there is a system which gives everyone at the same time 1/50 stamina every 72 seconds?
I don't think anyone knows.

But, it would not be too difficult to test.

We'd first need to figure out how stamina is rounded, and the true cap. Is the cap 99.95 stamina, and 99.95 displays as 99? (So, 98.95 stamina displays as 98, etc?) I'm pretty sure this is the case but I'm not absolutely certain.

Then two players could start at maxed stamina, play some arena within ~10 seconds of each other (and hopefully not close to a %72 seconds of an hour), and look at the results. Then, once time comes close to the point where displayed stamina is expected to increase by one point, both players constantly refresh HV every 2 seconds.

If the counter is individual, one player will get the +1 stamina 10 seconds before the other. If the counter is shared, they will both get the +1 stamina at the same time, between the later player's expected time and up to 72 seconds later.

A tiny script with a setTimeout(), XMLHttpRequest, and use of localStorage would reduce errors if players aren't sure of their ability to refresh and check every couple seconds.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 24 2016, 02:10
Post #36
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


QUOTE(Superlatanium @ Feb 23 2016, 23:32) *

I don't think anyone knows.

But, it would not be too difficult to test.

We'd first need to figure out how stamina is rounded, and the true cap. Is the cap 99.95 stamina, and 99.95 displays as 99? (So, 98.95 stamina displays as 98, etc?) I'm pretty sure this is the case but I'm not absolutely certain.

Then two players could start at maxed stamina, play some arena within ~10 seconds of each other (and hopefully not close to a %72 seconds of an hour), and look at the results. Then, once time comes close to the point where displayed stamina is expected to increase by one point, both players constantly refresh HV every 2 seconds.

If the counter is individual, one player will get the +1 stamina 10 seconds before the other. If the counter is shared, they will both get the +1 stamina at the same time, between the later player's expected time and up to 72 seconds later.

A tiny script with a setTimeout(), XMLHttpRequest, and use of localStorage would reduce errors if players aren't sure of their ability to refresh and check every couple seconds.


These tests take a lot of time you know :S. And I have died so many times trying to keep track of the script instead of my health.
Anyways, the new version with recovery functionality(in and out of battle) is coded now. Check the first post for it.
It's the best I could do with the information we have (IMG:[invalid] style_emoticons/default/smile.gif), well almost the best. There is always room for improvements.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 24 2016, 02:26
Post #37
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,659
Joined: 27-November 13
Level 500 (Godslayer)


QUOTE(EnTriel @ Feb 24 2016, 00:10) *
These tests take a lot of time you know :S. And I have died so many times trying to keep track of the script instead of my health.
Spark + Spirit Shield + Spark alert + 1h = invulnerable

If I had 99 stamina I'd be happy to be one of the participants, but I don't (IMG:[invalid] style_emoticons/default/sad.gif)

It shouldn't take that long, all you really need is an arena that'll leave you more than 1 stamina down after finishing. Note an exact start point, play normally without looking at stamina, finish normally, wait until near the time stamina should increase, constantly refresh HV page, and you have the answer.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 24 2016, 03:35
Post #38
simrock87



<('.'<) (>'.')> (^'.')>
*****
Group: Members
Posts: 647
Joined: 12-June 11
Level 399 (Godslayer)


Little Manual Test

Max Stamina, displayed 99
- switched over to 98 after end of round 25
- fled the battle (started 02:05, battle lasted 06:56)
- stamina went back to 99
- Started new battle at 02:15
- Switchover to 98 stam after end of round 5 (battle lasted 41s, finish 02:16)
- Stamina outside is 98
- Switchover 02:18 to 99
- started battle at 02:18, stamina lasted 1 round before switchover to 98

I don't have seconds, but it seems clear, to me at least, that stamina/rounds get restored one at a time.
It also seems to take longer than 72s or so to restore from 98 to 99, which makes sense as double stamina is consumed.
Can't test below 80 right now, but i'd guess the delay here would be those 72s

Theory, that kind of makes sense from a DB POV would be to store stamina not as stamina, but as rounds and then add 1 round every 72s for every entry that's not maxed (also has the advantage of doing away with any floating point ickyness). Having a timer for every player seems impractical.
During battle you'd do some double entry bookkeeping, substract from a stamina value that's only kept for the current battle, but also add/substract to/from the "real" stamina value, so you end up with roughly the correct amount. This part could probably easily verified by playing T&T to round 50, then go do sth else for 3h (would overcap stamina), then finish the last 50 rounds before the 4th hour is up. If you're at 97/98 stam it's double entry, if it's 98/99 it gets stored up ^^
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 24 2016, 03:44
Post #39
Superlatanium



Dreaming of optimizing the system
**********
Group: Gold Star Club
Posts: 7,659
Joined: 27-November 13
Level 500 (Godslayer)


Keep in mind that a correct measured "starting point" would depend on the second at which you finish the first round (rather than when you start the battle).

This is annoying, why can't stamina just be displayed as what it actually is rather than all this silliness (IMG:[invalid] style_emoticons/default/anime_cry.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Feb 27 2016, 01:19
Post #40
EnTriel



Casual Poster
***
Group: Members
Posts: 244
Joined: 23-December 15
Level 246 (Godslayer)


QUOTE(simrock87 @ Feb 24 2016, 01:35) *

Little Manual Test

Max Stamina, displayed 99
- switched over to 98 after end of round 25
- fled the battle (started 02:05, battle lasted 06:56)
- stamina went back to 99
- Started new battle at 02:15
- Switchover to 98 stam after end of round 5 (battle lasted 41s, finish 02:16)
- Stamina outside is 98
- Switchover 02:18 to 99
- started battle at 02:18, stamina lasted 1 round before switchover to 98

I don't have seconds, but it seems clear, to me at least, that stamina/rounds get restored one at a time.
It also seems to take longer than 72s or so to restore from 98 to 99, which makes sense as double stamina is consumed.
Can't test below 80 right now, but i'd guess the delay here would be those 72s

Theory, that kind of makes sense from a DB POV would be to store stamina not as stamina, but as rounds and then add 1 round every 72s for every entry that's not maxed (also has the advantage of doing away with any floating point ickyness). Having a timer for every player seems impractical.
During battle you'd do some double entry bookkeeping, substract from a stamina value that's only kept for the current battle, but also add/substract to/from the "real" stamina value, so you end up with roughly the correct amount. This part could probably easily verified by playing T&T to round 50, then go do sth else for 3h (would overcap stamina), then finish the last 50 rounds before the 4th hour is up. If you're at 97/98 stam it's double entry, if it's 98/99 it gets stored up ^^

Thanks for the info you provided, unfortunately I'm so busy at the work these days (often working after hours), I will not be able to work on the script anymore.

Well if you ask me from a DB POV, I think having a counter which updates about 3 million rows every 72 second would be very inefficient. Instead of that you could keep a last stamina update date(LSUD) for every player and when they asks for information or start a stamina consuming task, you can calculate the new value, send it to them, update the value in db and update the LSUD. This way you would access the database only when it is needed, and you would not be updating rows of passive users unnecessarily.
So yeah, correct implementation should be along these lines if not exactly that.

For battles we are probably entering them with a copy instance of our player objects and at the end of battle our real player instances gets updated according to battle log.This part may be implemented different though.


QUOTE(Superlatanium @ Feb 24 2016, 01:44) *

Keep in mind that a correct measured "starting point" would depend on the second at which you finish the first round (rather than when you start the battle).

This is annoying, why can't stamina just be displayed as what it actually is rather than all this silliness (IMG:[invalid] style_emoticons/default/anime_cry.gif)


I agree, if you are intrigued, feel free to take the script and modify it anyway you see fit. As ı mentioned, I don't have much free time in my hands right now :S.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


2 Pages V < 1 2
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 6th November 2025 - 00:32