Conception for a weather mod
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Conception for a weather mod
Hello everyone!
What do you think about this laggy way to create rain?
http://ompldr.org/vZjVxcQ/weather.zip
Start/stop rain with the command /rain
What do you think about this laggy way to create rain?
http://ompldr.org/vZjVxcQ/weather.zip
Start/stop rain with the command /rain
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Is it sprites in 3d, or a image animation overlay?
image animation overlay is less laggy:
http://minetest.net/forum/viewtopic.php ... 583#p33583
image animation overlay is less laggy:
http://minetest.net/forum/viewtopic.php ... 583#p33583
Last edited by rubenwardy on Sun Aug 19, 2012 21:07, edited 1 time in total.
-
- Member
- Posts: 211
- Joined: Tue Jul 31, 2012 20:37
- VanessaE
- Moderator
- Posts: 4655
- Joined: Sun Apr 01, 2012 12:38
- GitHub: VanessaE
- IRC: VanessaE
- In-game: VanessaE
- Location: Western NC
- Contact:
Very impressive! It looks like you're basically replacing all air nodes with an animated rain node. I might suggest adding a small random number to each raindrop's initial X/Z position to get rid of the moire pattern. Also, I would suggest a smoother animation - at least 4x as many frames (but with the same length of time for the loop).
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
But how to do this in lua?rubenwardy wrote:Is it sprites in 3d, or a image animation overlay?
image animation overlay is less laggy:
http://minetest.net/forum/viewtopic.php ... 583#p33583
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
This is not a mod so the graphics are very basic.VanessaE wrote:Very impressive! It looks like you're basically replacing all air nodes with an animated rain node. I might suggest adding a small random number to each raindrop's initial X/Z position to get rid of the moire pattern. Also, I would suggest a smoother animation - at least 4x as many frames (but with the same length of time for the loop).
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
isnt there a minetest.drawimageonscreen or similar command?PilzAdam wrote:But how to do this in lua?rubenwardy wrote:Is it sprites in 3d, or a image animation overlay?
image animation overlay is less laggy:
http://minetest.net/forum/viewtopic.php ... 583#p33583
In the minecraft rain and snow effects seems to be just a textures on a 4 plains which "surround" player.
So I suggest following:
- create 4 entities 1x2x0 (plains)
- apply to each of them some animated rain texture on the one side and tranparent texture on the other (see "animated torches" mos)
- make this entities to face the player (see "snow" mod)
- re-place that entities around player on every server time tick
- coordinates should be like so: {-0.5, 0.5, -0.5} for the 1st one, {0.5, 0.5, -0.5} for the second, {-0.5, 0.5, 0.5} for the 3rd and {0.5, 0.5, 0.5} for the last one:
This way every player would see animated side of his "raining entity" and would "see" empty "back side" of the other players' "raining entities".
I tried to do this on my own, but I'm not so good at lua or modding for minetest...
Someone with skill may check above things to make lightweight but working weather.
So I suggest following:
- create 4 entities 1x2x0 (plains)
- apply to each of them some animated rain texture on the one side and tranparent texture on the other (see "animated torches" mos)
- make this entities to face the player (see "snow" mod)
- re-place that entities around player on every server time tick
- coordinates should be like so: {-0.5, 0.5, -0.5} for the 1st one, {0.5, 0.5, -0.5} for the second, {-0.5, 0.5, 0.5} for the 3rd and {0.5, 0.5, 0.5} for the last one:
Code: Select all
__ __ __
| | | |
|__|/\|__|
| /|PP|\ |
|_\|__|/_|
| |\/| |
|__|__|__|
I tried to draw 9 blocks, PP = player and the diagonal lines = 4 entities, placed in rhombus-like shape.
This way every player would see animated side of his "raining entity" and would "see" empty "back side" of the other players' "raining entities".
I tried to do this on my own, but I'm not so good at lua or modding for minetest...
Someone with skill may check above things to make lightweight but working weather.
Last edited by 4aiman on Sat Nov 24, 2012 17:11, edited 1 time in total.
I managed to add entity in the player's position, but:
1. animation for texture didn't work, when I write smth like this:
2. I ended up in need to add "owner" property, so that if player goes offline, entities would be destroyed.
1. animation for texture didn't work, when I write smth like this:
Code: Select all
textures = {
{name="rainanim.png"},
{name="rainanim.png", animation={type="vertical_frames", aspect_w=48, aspect_h=48, length=3.0}},
},
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
There are no stupid questions, just stupid answers ;-)4aiman wrote:Sorry for stupid question, but....
You cant set the animation as a parameter in set_properties(). You need to setup a timer in on_step() like this:4aiman wrote:Do I need to change textures property in the on_step() event or I should use set_properties and pass textures table as a parameter?
Code: Select all
timer = 0,
on_step = function(self, dtime)
self.timer = self.timer + dtime
if self.timer < 0.25 then
return
end
self.timer = 0
end,
Code: Select all
local animation_frames = 8
[...]
timer = 0,
anim_step = 0,
on_step = function(self, dtime)
self.timer = self.timer + dtime
if self.timer < 0.25 then
return
end
self.timer = 0
self.anim_step = (self.anim_step+1)%animation_frames
self.object:set_properties({
textures = {
"rain_inside_animated.png^[verticalframe:"..16*animation_frames..":"..self.anim_step},
"rain_outside_animated.png^[verticalframe:"..16*animation_frames..":"..self.anim_step},
},
})
end,
Last edited by PilzAdam on Mon Nov 26, 2012 09:26, edited 1 time in total.
- Likwid H-Craft
- Member
- Posts: 1113
- Joined: Sun Jan 06, 2013 14:20
- Location: Lost in Crypt
Hey Adam I made my own rain textures for my, texture pack so if you like use it you can:D
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)
http://likwidtest.hj.cx/ (Not Done)
- Casimir
- Member
- Posts: 1207
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
@PilzAdam
I tested that code, and it works so far that it is an animation. But it does not show a complete picture but only one horizontal line stretched. To be precise the lines 1 to 8.
It seems to me that those lines are incomplete:
edit:
Found it. It has to be
I tested that code, and it works so far that it is an animation. But it does not show a complete picture but only one horizontal line stretched. To be precise the lines 1 to 8.
It seems to me that those lines are incomplete:
( replace }, at the end of the lines with .."]" to make it work)PilzAdam wrote:Code: Select all
textures = { "rain_inside_animated.png^[verticalframe:"..16*animation_frames..":"..self.anim_step}, "rain_outside_animated.png^[verticalframe:"..16*animation_frames..":"..self.anim_step}, },
edit:
Found it. It has to be
Code: Select all
"rain_inside_animated.png^[verticalframe:"..animation_frames..":"..self.anim_step.."]"
Last edited by Casimir on Thu Feb 14, 2013 17:23, edited 1 time in total.
-
- Member
- Posts: 117
- Joined: Thu Jan 03, 2013 16:56
- Location: Everywhere.
- nomohakon
- Member
- Posts: 219
- Joined: Fri Aug 10, 2012 16:34
- IRC: nomohakon
- In-game: nomohakon
- Location: VanessaE's servers
I guess acid rain will be better.chase programer wrote:i want lava rain for fun =0 [img]dog[/img]
"To learn who rules over you, simply find out who you are not allowed to criticize." - Voltaire
"Knowledge, like air, is vital to life. Like air, no one should be denied it." - Alan Moore, V for Vendetta
- - -
"To never die... and to conquer all, that is winning." ―Illyria
"Knowledge, like air, is vital to life. Like air, no one should be denied it." - Alan Moore, V for Vendetta
- - -
"To never die... and to conquer all, that is winning." ―Illyria
Who is online
Users browsing this forum: Ahrefs [Bot] and 28 guests