#SD3 sun

1 messages · Page 1 of 1 (latest)

vagrant lake
#

Ugh when will we get atmospheric refraction? FeelsWaitingMan

vague finch
vagrant lake
#

Maybe physgun can set you up with a dual-cpu refraction calculation server

waxen sage
#

The same calculations can be used to make a realistic ant-burning magnifying glass swep

#

Just think of all the applications

vague finch
#

Currently I'm just winging it, but to get the true sunset and sunrise, you need to calculate it 96 times pr day for a pr 15min basics. For atmo refraction

vague finch
#

Only to be +-1 minute more precise

vagrant lake
#

Well do you want it to be correct or not?

#

no compromises

waxen sage
shut otter
#

The return hinting goes type varname so "The" is being taken as both return value names

vagrant lake
#

Lol yeah that gets me a lot

waxen sage
#

---@return number # The sunrise time in seconds.

shut otter
waxen sage
#

That doesn't look so bad... should it?

#

A little float multiplication never hurt anyone

vague finch
#

I only use math.* functions 48 times this_is_fine_fire

waxen sage
#

I'll admit that's not great

#

Every frame, I assume?

vague finch
#

For all sun info, yes. But will be able to remove a lot of them. You don't need to know the sunset and sunrise every frame. Only the sun-pos

waxen sage
#

If it's a real performance problem, there are some micro-optimizations you could make around math.rad and math.deg

#

Curious to see how the performance is in practice

vagrant lake
#

Send code + inputs

vague finch
# vagrant lake I bet I could chew through that

Does this look right?

local n = 0
local t = 0

for i = 1, 100 do
  local s = os.clock()
  sunrise_sunset(2024, month, day, 6 * 60, lat,lon, UTCoff)
  n = n + (os.clock() - s)
  t = t + 1
end
print(string.format("%f", n / t))```
#

Cause it reports 0.000018 sec. Think JIT loves math

vagrant lake
#

As long as you don't use any NYI yeah jit will zoom zoom

#

Maybe use the return value though

vague finch
vagrant lake
#

I think I heard something about jit skipping functions that have no effect (they do nothing and their return isn't used)

#

Then what were you worried about?

#

You can run that baby 5k times a second

waxen sage
vague finch
#

But fair

vagrant lake
vagrant lake
vague finch
waxen sage
#

We can't save everyone

#

Some people will have a bad time

#

Just hopefully not very many

vagrant lake
#

That's what we call "not included in the target demographic"

waxen sage
#

OoS (Out of Scope)

vague finch
#

@vagrant lake Tried the south pole
Sunrise and Sunset

#

Forgot the sun come back Sep 21

#

So that kinda works

waxen sage
#

When is the update that calculates the output of solar panel entities based on the sun's position and weather?

#

I'm joking, but now that I say it that seems like it might be do-able

vague finch
#

Already kinda did that, no need for this. Just vector.cross env_sun data with position

waxen sage
#

You'd need to sample the surface of the panel to check for shadows