Page 2 of 2

Re: Optimization of a script

Posted: Sun Feb 19, 2017 10:20 am
by Isaac
I would assume, that one cell equals 3.048 meters, but the game's internal coordinate system could suggest that it's 1.8288 meters per cell.

Re: Optimization of a script

Posted: Sun Feb 19, 2017 12:36 pm
by minmay
One tile is 3x3x[module height] meters.
vieuxchat wrote:In fact I'm not sure I really understand what is the difference between a directionnal light and a point one.
Would a directionnal light always follow the direction of the party ?
There are four types of light, determined by the LightComponent's type field.
"point" - The default. Light is cast in all directions from the LightComponent's position and falls off with distance (the distance depending on the LightComponent's range).
"spot" - Light is cast in a cone from the LightComponent's position. The spotAngle field determines the radius of the cone and the spotSharpness field determines the distance from the axis of the cone at which light falloff starts (0 is immediately, 1 is no falloff at all). The component's rotation determines the direction of the cone, and the range determines the height of the cone. This is used a lot by ceiling shaft lights in the standard assets. Also, they don't render correctly in Wine for some reason.
"ambient" - Light is applied to all triangles on the level. Position and range are not meaningful for ambient lights, and there's no shadow casting. This is what sky objects use for their ambient lights. Note that ambient lighting, while not tremendously demanding, also isn't free, so don't use multiple ambient lights on the same level; combine the colors and intensity into one ambient light instead.
"directional" - You might have heard this kind of light referred to as a "sun" in 3D graphics jargon, and indeed it's what sky objects use for the direct sunlight. Imagine a point or plane which is infinitely distant, and emits uniform light that does not fall off with distance - but does cast shadows. That's the best way I can explain directional lights. (You could also just try one and see.) Position and range are not meaningful for directional lights, but rotation is, since it determines the direction in which the light is cast.
vieuxchat wrote:I thought static shadows = true would be faster than static shadows = false, is it like that or am I wrong ?
Close! You're confusing staticShadow with staticShadowDistance. staticShadow determines whether static shadows are cast by the light at all; staticShadowDistance is the distance in meters from the camera at which point the light will stop casting dynamic shadows. The default static shadow distance is 25m, which happens to exactly match the far clip of the default camera on levels with no SkyComponent.
You can stop a light from casting dynamic shadows at all, but still get static shadows by setting staticShadows = true and staticShadowDistance = 0. This is what the forest_lantern object in the standard assets does.
Also, if the player has shadow quality set to Low in the game options, dynamic shadows aren't cast at all, only static ones, regardless of staticShadowDistance.

Re: Optimization of a script

Posted: Sun Feb 19, 2017 4:18 pm
by vieuxchat
Thanks for the info about light, it's very useful.

Another people has the same slow down but without having its video card doing any noise. So it may be not what I thought it was.
I may have another hint : does a fireball "dies" if it doesn't hit anything ?

Re: Optimization of a script

Posted: Sun Feb 19, 2017 6:32 pm
by kelly1111
From what I have read somewhere on these forums, cant remember where...
spells don't "die" when you shoot them into the void... they keep existing

Re: Optimization of a script

Posted: Sun Feb 19, 2017 7:55 pm
by AndakRainor
You can look here:
viewtopic.php?f=22&t=10014
(or skip to the last posts if you find it too long to read).

Re: Optimization of a script

Posted: Sun Feb 19, 2017 8:17 pm
by vieuxchat
Yes ! So, that's it.
Thanks for the thread, it is very useful :)