a nice cavern filled with lava

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: a nice cavern filled with lava

Post by AndakRainor »

I tried that:

Code: Select all

defineObject{
  name = "eruption",
  components = {
    {
      class = "Light",
      offset = vec(0, -0.5, 0),
      range = 10,
      color = vec(2.8, 1.2, 0.7),
      brightness = 1,
      fadeOut = 6,
      castShadow = false,
      destroyObject = true,
    },
    {
      class = "Particle",
      particleSystem = "eruption",
    },
    {
      class = "Projectile",
      spawnOffsetY = 0,
      velocity = 1,
      radius = 0.1,
      gravity = 4,
      fallingVelocity = 4,
      destroyOnImpact = false,
      onProjectileHit = function(self, what, entity)
        self.go.particle:stop()
      end,
      onInit = function(self)
        self.go:setSubtileOffset(math.random()-0.5, math.random()-0.5)
        self:setFallingVelocity(math.random()*2+3)
        self:setVelocity(math.random()*2)
      end,
    },
    --{
      --class = "Sound",
      --sound = "fire_pit",
      --volume = 0.5,
    --},
  },
  placement = "floor",
  editorIcon = 88,
}

defineParticleSystem{
  name = "eruption",
  emitters = {
    -- star
    {
      --spawnBurst = true,
      emissionRate = 200,
      emissionTime = 3,
      maxParticles = 700,
      boxMin = {0,0,0},
      boxMax = {0,0,0},
      sprayAngle = {0,0},
      velocity = {0,0},
      objectSpace = false,
      texture = "assets/textures/particles/candle_glow.tga",
      lifetime = {1,1},
      color0 = {4, 0.4, 0.2},
      opacity = 1,
      fadeIn = 0,
      fadeOut = 1,
      size = {0.05, 0.1},
      gravity = {0,0,0},
      airResistance = 0.1,
      rotationSpeed = 5,
      blendMode = "Additive",
    },
  }
}
then add this in onActivate function of the timer component of the lava_effects object:

Code: Select all

for f = 0,3 do spawn("eruption", self.go.level, self.go.x, self.go.y, f, self.go.elevation) end
What do you think ? Is there a way to make those projectiles move with random starting angles instead of tiles orientation ?
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: a nice cavern filled with lava

Post by bongobeat »

This is nice! Great work!

Well I have no idea on how to do that, but this looks enough for me. No need to customize it more.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: a nice cavern filled with lava

Post by bongobeat »

Here is a couple of screenshot for outside test:

can't be used with a forest_day_sky, too much light, or with the ambiant field desactivated.

by day:
SpoilerShow
Image
by night:
SpoilerShow
Image
with the swamp sky:
fog particle desactivated:

day:
SpoilerShow
Image
night:
SpoilerShow
Image
with a custom sky, ambiant desactivated:

day:
SpoilerShow
Image
night:
SpoilerShow
Image
while the test, the amplitude gets higher, I don't know why. After reloading the editor this "issue" disappeared.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: a nice cavern filled with lava

Post by AndakRainor »

My fault for the waves getting higher with time :P In my last code on the previous page I used a material with the default shader for flat lava. I did not get something that works with the ocean shader or the fire wall one. The issue with the ocean shader is that the waves are slowly reduced until they disappear. I tried to compensate by increasing the wave amplitude parameter over time but as you see, it's too much :lol:

For the daylight environments, maybe the diffuse map is too bright yellow... I mainly tested it for underground scenes. I think it could work better if we replace it with something more similar to the emissive map; a simple mix of the 2 could be the solution...
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: a nice cavern filled with lava

Post by bongobeat »

thank you, did you optimize it for an outside environment?

it looks better with the forest day sky but again too bright.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: a nice cavern filled with lava

Post by AndakRainor »

I did not try it with the forest sky, but this diffusion map is very similar to the emissive map, just a bit brighter. So if you update the file and reload the dungeon completely, I don't see how it could still be too bright with this sky. I will try it tonight to see how it renders...
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: a nice cavern filled with lava

Post by Duncan1246 »

AndakRainor wrote:
Now you have a definition for water tiles and another for a stand alone ocean like object. When I tried to put water and lava on the same map I realized it was not possible without using an ocean object; two WaterSurfaceMesh can't be used in a map or be swaped dynamically. So you will have to choose, only lava and no water on a level, or else use "lava_surface" object as you use the ocean one.

In both case you should put "lava_effects" objects on each lava tile at elevation 0. You will see that those objects spawn "under_lava_effects" under them down to the floor.

Don't forget the texture in the previous post. Type "lava" in the editor filter to see all objects. Now with explosions (Bubbles were really not convincing) ! Let me know what you think of it !
Hi Andak,
I have used your lava defs in my mod, and it works well, thanks for your very good job!
But I am not sure to understand what you have said above: water AND lava on the same level are they truly compatibles? I tried, and water look like lava without flames... What is the trick to have normal water color?
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: a nice cavern filled with lava

Post by AndakRainor »

Hi!
You have two ways to put lava in a map :
- The "lava_surface" object is similar to the ocean object, so you place it anywhere and you get a giant surface totally independent from water tiles.
- The "lava_surface_tiles" is used as you use the water surface tiles object, you place it anywhere in a map and it alters all your water tiles.

So if you want both lava and water in a map, you should not use "lava_surface_tiles" but instead place manually your "lava_surface" object where it will not overlap your normal water. Is it more clear that way? :)
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: a nice cavern filled with lava

Post by Duncan1246 »

AndakRainor wrote:Hi!
You have two ways to put lava in a map :
- The "lava_surface" object is similar to the ocean object, so you place it anywhere and you get a giant surface totally independent from water tiles.
- The "lava_surface_tiles" is used as you use the water surface tiles object, you place it anywhere in a map and it alters all your water tiles.

So if you want both lava and water in a map, you should not use "lava_surface_tiles" but instead place manually your "lava_surface" object where it will not overlap your normal water. Is it more clear that way? :)
I believed that ocean tiles were necessary, I understand now, thanks!
Another question: I thinks about using lava in a map with elevation -5 instead of fire_emitters_tiles. This map have no water at all. Do you think this can works (like water_surface_custom) :
SpoilerShow

Code: Select all

 defineObject{
      name = "lava_surface_tiles",
      baseObject = "base_floor_decoration",
      components = {
        {
          -- updates global reflection and refraction maps
          class = "WaterSurface",
          planeY = -15.4,
          fogColor = math.saturation(vec(0.26, 0.09, 0.042), 0.5) * 0.5,
          fogDensity = 0.4,
          reflectionColor = vec(1.5, 0.9, 0.27) * 0.9,
          refractionColor = vec(1.5,1.0,0.5),
        },
        {
          -- builds a continuous mesh from underwater tiles
          class = "WaterSurfaceMesh",
          material = "lava_surface_tiles",
          underwaterMaterial = "lava_surface_tiles",
          offset = vec(0, -15.4, 0),
        },
      },
      dontAdjustHeight = false,
      editorIcon = 264,
    }
I havn't tried this yet, because it seems too simple ...
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
Post Reply