Page 1 of 2

[WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 4:26 pm
by JohnWordsworth
Hey guys, just felt like posting a 50% complete WIP on a water /thirst system for Grimrock. Currently, there is an additional HUD drawn in onDrawInventory and you can modify the water amount / consume water in a similar fashion to food (script_thirst:consumeWater(championOrdinal, amount), script_thirst:modifyWater(championOrdinal, amount)). Players can drink from water_flasks to replenish their water and I've setup a basic water fountain (code wise) which can be used to replenish water flasks from empty flasks. Different races consume water at different rates and it works on a 'dt' system - so even though the timer is on floor 1, it'll always consume dt*waterConsumedPerSecond every time the timer ticks (be it once a frame, or once a second).
SpoilerShow
Image
However... The Water Fountain model packaged with the game was clearly unfinished (as it was unused in the game), so I find myself asking politely if any of the fantastic modellers here would be able to spare a bit of time to work with me on this 'modders resource' and create a water fountain model or some other realistic source of water. While I could have a stab myself, it undoubtedly won't look as good!

Any help/suggestions greatly appreciated!

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 5:01 pm
by Skuggasveinn
I will take a step at creating a water fountain
I'm thinking 2 wall fountains for temple and dungeon tileset.
floor placement also for both tilesets

I was thinking of using the daemon head and a bowl, so the water is flowing from the mouth into the bowl, or something like that.
Don't know if that's going to work but if you don't shoot for the stars you will never reach the sky :D

Skuggasveinn.

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 7:05 pm
by Skuggasveinn
Here as a quick one, I think this will work nicely. (do you like this approach ?)
Image
I like this method really much, to take existing assets and modify them. That why the model never sticks out, it just belongs.
This could be an alcove, that only takes empty bottles or something, and when you use it script it to return to the mouse pointer full water bottle or something like that.

I will UV map it later today and have a couple of versions ready this weekend.

Skuggasveinn.

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 7:09 pm
by Neikun
Welp that pretty much blows my idea out of the water. I was going to use the crown model on to of a slightly hollowed pregenerated blender cylinder.

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 7:50 pm
by Komag
that preview looks great! I really wouldn't want much HUD though, only something extremely non-intrusive, needs to be small or very translucent, something that pretty much seems invisible unless I want to look and check it real quick. That's my personal preference, I like minimalist HUDs for immersion's sake

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 7:56 pm
by Brodie301
Different races consume water at different rates and it works on a 'dt' system - so even though the timer is on floor 1, it'll always consume dt*waterConsumedPerSecond every time the timer ticks (be it once a frame, or once a second).
Keep in mind a timer on different floor works slower, I know Komag has a work around but I couldn't find it to link.

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 8:01 pm
by Komag
Well I used to use a script which always checked whether the party was still on the same floor, and if not then it would destroy the old timer, create a new one on the now-current-floor, and continue the ticking from there.

But I've abandoned that approach as not being accurate enough, in favor of having a full set of master timers, one on every floor, constantly ticking, and whatever script you need to tie into them just checks which floor you're on and only allows that floor's timer to affect the tick.

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 8:12 pm
by thomson
Looks cool. Are you planning to make the water flowing? If that could be done, it would be rather easy to create 3 types of that fountain: flowing, with standing water and dried up. This would offer many new opportunities. Flowing water is an endless supply. With standing water, you could drink/fill bottles only X times before it dries up.

Also, you may consider to creating a polluted water version. Relatively simple to do - just use colorized textures. This could be used as a plot element in some dungeons - land is cursed and there is almost not drinkable water left.

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Fri Dec 28, 2012 9:25 pm
by LordYig
This is really cool !
Both the Gui part from John and the preview of the model by Skuggasveinn !

IMHO, the flowing water can be done purely with animation.
Particles system AFAIK can't properly simulate this kind of effect.
The only problem here is what kind of object can be used to display the animation continuously...

Re: [WIP] Water / Thirst Script and Fountain Model Request!

Posted: Sat Dec 29, 2012 4:50 am
by JohnWordsworth
@Skuggasveinn: That looks awesome! Very fitting for the LoG setting and very good looking :).

@Komag: The water meter only appears while the inventory is showing, so should not get in the way or break immersion!

@Brodie301: In the timer tick function I use the getStat("play_time") function to get the number of seconds the game has been running and subtract the same statistic from the previous tick. This should mean whether it's 1 frame or 60 since the last tick it doesn't actually matter :).

Code: Select all

local lastTickTime = getStat("play_time");
local somethingsPerSecond = 10;

function onTick() 
  local tickTime = getStat("play_time");
  local dt = tickTime - lastTickTime;
  lastTickTime = tickTime;

  local numberOfSomethingsSinceLastTick = dt * somethingsPerSecond;
end
@Thomson / @lordyig: Re: Animated Water. Have been pondering this! The fountain is currently an alcove, but can really be anything the user can interact with. I think a particle system could be nice for a slow flow / foamy water fountain.

@thomson: Love the idea of empty, partial and unlimited fountain alternatives.