Optimization of a script
Re: Optimization of a script
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
One tile is 3x3x[module height] meters.
"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.
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.
There are four types of light, determined by the LightComponent's type field.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 ?
"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.
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.vieuxchat wrote:I thought static shadows = true would be faster than static shadows = false, is it like that or am I wrong ?
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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Optimization of a script
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 ?
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
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
spells don't "die" when you shoot them into the void... they keep existing
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Optimization of a script
You can look here:
viewtopic.php?f=22&t=10014
(or skip to the last posts if you find it too long to read).
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
Yes ! So, that's it.
Thanks for the thread, it is very useful
Thanks for the thread, it is very useful