Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Client-side timers
#1
I want to add hunger/thirst. Would using client-side timers be a bad idea?
Reply
#2
Yes...
Reply
#3
Midgard has a hunger system. Client side is definitely a bad idea. What I did in midgard was use the existing (and unused) SP stat. The code already exist server side for regenerating HP, MP, and SP periodically. All I did was reverse the formula for SP to make it go backwards. Pretty much just as easy as changing a + to a -
Reply
#4
You never want anything controlled by the client. It is easily hackable.
Reply
#5
Anything client side is bad, unless it's only used to make the client smoother, and the actual calculations and checks are done server-side.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#6
You can have the timer count down on the client, but make sure there's another one counting down on the server as well. Saves packets and what not from being sent every single time it needs to drop a bit.
Reply
#7
I figured as much.

I think copying the HP stuff and using the regen code to take it away is probably my best option. Thanks Rian.
Reply
#8
Rian Wrote:Midgard has a hunger system. Client side is definitely a bad idea. What I did in midgard was use the existing (and unused) SP stat. The code already exist server side for regenerating HP, MP, and SP periodically. All I did was reverse the formula for SP to make it go backwards. Pretty much just as easy as changing a + to a -

Could this same method be applied to stat buffs? When the buff is activated, the SP (for example) starts to decrease, when it reaches 0, the buff is removed.
Reply
#9
Yupp.
Reply
#10
Well, I wouldn't want to remove the buff based on a stat reaching 0. Rather go straight to the source using a gettickcount in the server loop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)