LoG Sky System [BETA]
Posted: Wed May 08, 2013 4:57 pm
Hello folks, so, due to popluar demand, here's the sky system I've developped for LoG: https://docs.google.com/file/d/0B-rVman ... sp=sharing.
See video here: http://youtu.be/RyX7iUs9eFA
You'll find in the above archive a example dungeon source which shows how to implement it. It's still in beta state and needs more tweaking, I call here to the forum community in helping further development of the project. Required elements for this to work:
1. LoG framework installed
2. the dx_sky_system folder in mod_assets, which contains all the required objects, models and textures for the sky system. You have to import dx_sky_system\dx_sky_system.lua in your init.lua.
3. the skyScript script_entity in the dungeon editor, where all the functions are.
4. the initialization section at the bottom of that script where you define ambiances and interior objects.
5. a wallset with an invisible ceiling. You can simply replace the ceiling line with this in the wallset definition:
So the system revolves around that concept of ambiance. For example:
Ambiances are defined with skyScript.defineAmbiance{properties}, and switched with skyScript.setAmbiance(name). Included with the file actually you can find: "day", "night", "dark_night" (less light & cloudy), "rainy_day" and "rainy_night". Someone must definitely add "snowy_day" and "snowy_night", at least. There are test scrolls in the first champion inventory which show how you can switch ambiances.
A quick run-through of ambiance properties:
name = the name of the ambiance
skySphere = if you want, the name of the projectile object for the background color. There's a blue and a grey one included, and you can make your own. If ommited, background is default black.
skyLightColor = RGB color table of the global light.
skyLightBrightness = brightness of the global light.
skyLightParticleSystem = a particle system for the light source. One is included for the sun, look above in the "day" ambiance. If ommited there won't be a particle system with the light.
clouds = the projectile object with the clouds texture. There are two white clouds, one grey and one dark grey included, and you can make your own. If omitted, there won't be clouds.
cloudsFrequence = a number between 3 and 12 approx, on how many clouds to randomly distribute across the level.
stars = the name of the particle system to use to generate stars. None if omitted. Included are stars and dark_stars.
weather = the particle sysstem to use for weather. Only rain is included now. None if omitted.
weatherRadius = how many tiles around the party to generate weather (for performance issues)
thunder = the name of the sound to play for thunder. None if omitted.
thunderFrequence = the frequence of the random thunder. 0.08 is used in the actual rain ambiances.
the interiorObjects = {} table at the end of the skyScript defines which objects should the script look for to define as "interior" so that it doesn't spawn weather on those tiles. In the example dungeon, there's a dungeon_ceiling object in objects.lua used for that purpose.
For more technical details on how all this works, see my post here: viewtopic.php?f=14&t=4741&start=100#p56648
What's left to do?
- For some reason, when the weather radius is set to 3, turning around 180 degrees and moving forward crashes with a duplicate id on the weather objects
- Ambiance is generated on a single level. It would be good to make code that can destroy and respawn ambiances when taking stairs. Probably just calling setAmbiance from a hidden pressure plate on the new level should work, at it cleanes up any previous skyScript objects, needs testing.
- The skkylight is generated as an fx, and might not stay after save/reload. setAmbiance(currentAmbiance) must be called on reload, I remember that someone made a load detection script somewhere.
- When looking at an "interior" more than 7 squares away, you'll see the sky. There's a dx_skyblocker_black object which is just a black panel, which has to be generated and moved dynamically on those tiles, maybe using the isInterior(level, x, y) function. This, or design the dungeon so that you cannot see deep inside the interior from the exterior.
- Moving skySphere was out of sync with the party sometimes, and there's no code yet to check for slower movement due to weight.
So feel free to tweak it! I don't have time to fix all those issues, but I'll be glad to answer questions on how the code works - I think I wrote in a legible enough way with clear variable and function naming.
See video here: http://youtu.be/RyX7iUs9eFA
You'll find in the above archive a example dungeon source which shows how to implement it. It's still in beta state and needs more tweaking, I call here to the forum community in helping further development of the project. Required elements for this to work:
1. LoG framework installed
2. the dx_sky_system folder in mod_assets, which contains all the required objects, models and textures for the sky system. You have to import dx_sky_system\dx_sky_system.lua in your init.lua.
3. the skyScript script_entity in the dungeon editor, where all the functions are.
4. the initialization section at the bottom of that script where you define ambiances and interior objects.
5. a wallset with an invisible ceiling. You can simply replace the ceiling line with this in the wallset definition:
Code: Select all
ceilings = {
"mod_assets/dx_sky_system/dx_remove_ceiling.fbx", 1,
},Code: Select all
defineAmbiance{
name = "rainy_day",
skySphere = "dx_skysphere_grey",
skyLightColor = {0.9, 0.9, 0.9},
skyLightBrightness = 8,
skyLightParticleSystem = "dx_sun_clouds",
weather = "dx_rain_2",
weatherRadius = 2,
thunder = "lightning_bolt_hit",
thunderFrequence = 0.08,
clouds = "dx_clouds_grey",
cloudsFrequence = 9,
}A quick run-through of ambiance properties:
name = the name of the ambiance
skySphere = if you want, the name of the projectile object for the background color. There's a blue and a grey one included, and you can make your own. If ommited, background is default black.
skyLightColor = RGB color table of the global light.
skyLightBrightness = brightness of the global light.
skyLightParticleSystem = a particle system for the light source. One is included for the sun, look above in the "day" ambiance. If ommited there won't be a particle system with the light.
clouds = the projectile object with the clouds texture. There are two white clouds, one grey and one dark grey included, and you can make your own. If omitted, there won't be clouds.
cloudsFrequence = a number between 3 and 12 approx, on how many clouds to randomly distribute across the level.
stars = the name of the particle system to use to generate stars. None if omitted. Included are stars and dark_stars.
weather = the particle sysstem to use for weather. Only rain is included now. None if omitted.
weatherRadius = how many tiles around the party to generate weather (for performance issues)
thunder = the name of the sound to play for thunder. None if omitted.
thunderFrequence = the frequence of the random thunder. 0.08 is used in the actual rain ambiances.
the interiorObjects = {} table at the end of the skyScript defines which objects should the script look for to define as "interior" so that it doesn't spawn weather on those tiles. In the example dungeon, there's a dungeon_ceiling object in objects.lua used for that purpose.
For more technical details on how all this works, see my post here: viewtopic.php?f=14&t=4741&start=100#p56648
What's left to do?
- For some reason, when the weather radius is set to 3, turning around 180 degrees and moving forward crashes with a duplicate id on the weather objects
- Ambiance is generated on a single level. It would be good to make code that can destroy and respawn ambiances when taking stairs. Probably just calling setAmbiance from a hidden pressure plate on the new level should work, at it cleanes up any previous skyScript objects, needs testing.
- The skkylight is generated as an fx, and might not stay after save/reload. setAmbiance(currentAmbiance) must be called on reload, I remember that someone made a load detection script somewhere.
- When looking at an "interior" more than 7 squares away, you'll see the sky. There's a dx_skyblocker_black object which is just a black panel, which has to be generated and moved dynamically on those tiles, maybe using the isInterior(level, x, y) function. This, or design the dungeon so that you cannot see deep inside the interior from the exterior.
- Moving skySphere was out of sync with the party sometimes, and there's no code yet to check for slower movement due to weight.
So feel free to tweak it! I don't have time to fix all those issues, but I'll be glad to answer questions on how the code works - I think I wrote in a legible enough way with clear variable and function naming.