Mirage Source
Client-side timers - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Help Wanted (https://mirage-engine.uk/forums/forumdisplay.php?fid=50)
+---- Thread: Client-side timers (/showthread.php?tid=2754)



Client-side timers - Xlithan - 17-04-2009

I want to add hunger/thirst. Would using client-side timers be a bad idea?


Re: Client-side timers - GIAKEN - 17-04-2009

Yes...


Re: Client-side timers - Rian - 17-04-2009

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 -


Re: Client-side timers - Jacob - 17-04-2009

You never want anything controlled by the client. It is easily hackable.


Re: Client-side timers - Robin - 17-04-2009

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.


Re: Client-side timers - Matt - 17-04-2009

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.


Re: Client-side timers - Xlithan - 17-04-2009

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.


Re: Client-side timers - Xlithan - 17-04-2009

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.


Re: Client-side timers - Matt - 17-04-2009

Yupp.


Re: Client-side timers - Rian - 17-04-2009

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.