MinetestForFun / server-minetestforfun-hungry_games

Repository of the subgame and mods of "MinetestForFun Hunger Games" server
https://www.xorhub.com
3 stars 1 forks source link

Reduce the refill of chests time #69

Closed BetterToAutomateTheWorld closed 9 years ago

BetterToAutomateTheWorld commented 9 years ago

@LeMagnesium

After the merge of the server which was 10 minutes ago => the chests refill isn't faster, it's the same refill time compared to earlier !

Lymkwi commented 9 years ago

I could not manage to find the way refill worked, nor how to modify the time of the first refill after the game started, it's hardcoded in hungry_games/engine.

ghost commented 9 years ago

fixed https://github.com/MinetestForFun/server-minetestforfun-hungry_games/commit/235fa9ad657b97d37821459847d4f9b39166a089 and https://github.com/MinetestForFun/server-minetestforfun-hungry_games/commit/4ace504a755a80e45745cd8748e85f7fda10e4a1

BetterToAutomateTheWorld commented 9 years ago

Thank you @crabman77

Can you confirm me in this way chests are deleted and after refilled ?

ghost commented 9 years ago

yes the chest are deleted, and refilled instantly. but during the game, they are refilled without being deleted before, it may be a problem now delete them? https://github.com/MinetestForFun/server-minetestforfun-hungry_games/blob/master/mods/hungry_games/engine.lua#L83

BetterToAutomateTheWorld commented 9 years ago

Yes, it may be a problem, during the game, it's better to delete -> refill the chests

For the "instantly delete/refill" at the start of the game it's not good, we need to wait at least 5 or 10sec for a refill, before it was 30sec, so it was a really to big amount of time

This refill delay is for avoid an usebug, players can't take items from chests before the start of the game with it (you know, after the trompets)

Lymkwi commented 9 years ago

There was no way for us to know how much time had to elapse between the moment the grace period started and the moment chests refilled. Random_chest was litterally doing 20 calls every 0.5 seconds, spending a random amount of time refilling. I can now add a minetest.after before calling the chest refill to put 7 seconds to wait for after grace period started. I will also try to find a way to use the same functions when first filling and refilling, so that chests' content is deleted before refilling.

EDIT: Just a quick clarification here,

(you know, after the trompets)

Are you talking about the trompets announcing the end of the grace period or the prestart?

Lymkwi commented 9 years ago

Okay, so, after I dug a bit into random_chests' code, I found out that I could simply delay the refill to the end of prestart. So now, chests are filled at the first second of the grace period. https://github.com/MinetestForFun/server-minetestforfun-hungry_games/commit/f2aeb16de5cb259abbe17d59399202e782feac47

If you want to modify that you just need to add +n | -n after hungry_games.countdown to reduce/increase the delay.