Weather model ideas

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

Weather model ideas

Post by Whicker »

I've been thinking about ways to make a weather model that could be used to create multiple different types of weather of a set amount of time.

one idea is to have a 30 day period that has all the basic different weather events in it - so maybe it is clear the first day and then a light storm comes thru, clears up, then a moderate storm comes thru, then a severe storm etc. Maybe a few days are mostly clear but then a quick storm comes thru. Also a week of night and morning low clouds (obviously morning could would be different over a large area).

So you could make a manual model with all that, with weather changing gradually every 30 minutes or so. But that would be a huge file - 1500 sets of 4 weather characteristics.

If you had something like that, the designer could say ` I like the way weather that happens starting on day 4 at 3pm` and then set that to happen at the start of that scen.

The other idea I have is a random model using something like perlin noise where it is random, but the randomness is based on the prior value and can only vary slightly from the previous value. But this would not really give me what I want, which is a known weather event - weather isn't really random in the real world, forecasting seems pretty good for 3-4 days out. Perlin noise I think is sort of like a sine wave though, so maybe you could define the weather based on where you are on the sine wave? lowest point is sunny and clear, highest is massive storm? maybe the amplitude could be a setting to determine how severe a storm is?

or a set of functions, one for each model?

In the long run I would like something where the designer could say - I want the weather to start out in the middle of a moderate storm and then clear up - and they could set that somehow in the scen load set up event. The first idea is the most like this. Maybe I need to make a trial run to see how large a file that would be. Seems like it would be too large.

Any ideas?
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: Weather model ideas

Post by Whicker »

a key to any of this is that I would want there to be a good way to do a forecast every x hours. I kind of like the sine wave idea, but it may be difficult to know what the weather will be in advance?

If you thought of weather as a sine wave maybe the 4 weather attributes could have their own wave, each with their own amplitude?

And maybe they could also have their own frequency/wave length?
User avatar
tjhkkr
Posts: 2430
Joined: Wed Jun 02, 2010 11:15 pm
Contact:

RE: Weather model ideas

Post by tjhkkr »

Hello...
I have been working on this for a very long time.
I use a table variable plus the random function.

One of the suggestions I had for developers was to use the NAV zone principle to create weather within a certain area...

Tip: the longer a scenario is, the more difficult it is.

THE LUA is crude and I am still working on it, but I am willing to share if it would be helpful.
Remember that the evil which is now in the world will become yet more powerful, and that it is not evil which conquers evil, but only love -- Olga Romanov.
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: Weather model ideas

Post by Whicker »

sure you can post it here and I'll have a look. Last year I made sample scen for night and morning low clouds that worked really well - but it was limited to that particular type of weather.

The more I looked at this the more I realized how little I know about how weather effects things. Does temp even matter for example? and if it is partly cloudy what does that actually mean as far as sensors are concerned? and if you are attacking ground units the elevation they are at matters as well i think.

I still like the sine wave idea, not sure I have the math knowledge to make it happen though.

I think that Apache may have made a moving weather system in Sakura Blue but I never saw it happen. I don't think you need a no nav zone, you might be able to do with a unit enters/remains in area and have the area move around. Each unit has a weather attribute, so as they move into the area you might be able to set that units weather to something different than the game weather. Not sure how well it would work, never seen it actually used but it may work. Could also ground AC if the weather is bad - or make it less safe to fly/lower proficiency.
Whicker
Posts: 664
Joined: Tue Jun 19, 2018 9:54 pm

RE: Weather model ideas

Post by Whicker »

it looks like the sine wave isn't too hard, it is a little confusing, pi*2 is one full rotation of a wave - so 0 to 1, back down to 0 and then to -1 and back to 0.

So far I can tell it how many hours half the wave should be and it will go from 0 to 1 and back to 0 which I think is all I want. Just need to plug that into something else to change the weather based on some other variables. I can see this working. Needs a lot of work to make it functional, but it is kind of neat. I might be able to make something work, but it may not be all that understandable to someone else, that will be the hard part. Basic idea will be to tell it the min and max for say clouds, and then it will go from one to the other and back depending on how long you want it to take. Then it could either repeat or stop.

-------------------
function round(num, numDecimalPlaces)
if numDecimalPlaces and numDecimalPlaces>0 then
local mult = 10^numDecimalPlaces
return math.floor(num * mult + 0.5) / mult
end
return math.floor(num + 0.5)
end

--local weatherStart = .2
--local weatherMax = .5
local weatherStartTime = 0--in hours
local weatherTime = 36 --how long it lasts in hours
local increment = round(math.pi/weatherTime,2)
local angle = weatherStartTime*increment

for i=1,60 do
--print("angle: "..angle)
local sin = math.sin(angle)
print(i..') sin: '..sin..' angle: '..angle)
angle=angle + increment
end
print '--------------------------------------------'
User avatar
Gunner98
Posts: 5881
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: Weather model ideas

Post by Gunner98 »

Deleted
Attachments
LuaHistory..190424.txt
(7.63 KiB) Downloaded 14 times
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
Post Reply

Return to “Lua Legion”