Jump to content
The Dark Mod Forums

Breakable Glass


Springheel

Recommended Posts

Anyone have experience with this? I followed these instructions:

 

Create your brush and give it your glass texture
Convert it to a func_fracture entity
Give it the property health with a value (experiment to see how many hits you want it to take before it breaks.)
It automatically produces shards of glass and sound when it breaks.
You can optionally give it the property target to trigger something after it breaks. For instance if it has a frobable object on the other side you don't want the player to be able to frob until it breaks you would use a clip brush atdm:target_set_frobable around the object.

 

 

Works great on a brush. On a model, everything works except it makes the original model looks like it was fractured before any damage was done.

post-9-0-27004100-1436969755_thumb.jpg

Link to comment
Share on other sites

Curious. Does the model version shatter and fall immediately, or do the shards just hang there suspended in space? Do they then fall if you hit them?

 

Is the model version still a func_fracture with all the same spawnargs, just with a "model" spawnarg instead of a brush model? Does your model have a single surface mesh?

 

Brittle fractures get "shattered" into shards at spawn time. The model gets carved up, but until you hit it, those shards should be sitting up where the window is. You don't actually see separate shards until they start to fall. If your shards are hanging in midair, the calculation of the origins of the individual shards must be going wrong when a model is being used instead of a brush. That's the only explanation I can think of.

Link to comment
Share on other sites

I think I can see what's up after trying it in a quick test map. The shards hang in mid-air, until you hit them at which point they react normally.

 

Here are my two func_fractures in DR: the left a brush, the right a straw rug model, which has only 1 surface and has been turned on its side to face the player like a window. In the TDM screenshot the rug model has been divided into shards which have the right orientation but which are placed where they would have been if the rug hadn't been rotated in DR. That'll be the bug. Worldspawn has no "rotate" spawnarg -- when you rotate a brush in DR its verts are moved, it doesn't gain a rotation setting. The game must be ignoring the rotation of the model when it places the shards after carving up the model at spawn time.

 

post-29566-0-83060500-1436983565_thumb.pngpost-29566-0-10995000-1436983564_thumb.jpg

  • Like 1
Link to comment
Share on other sites

Fixed in svn

 

 

Brilliant! Thanks Steve! :) Here's what I plan to do with it:

 

 

 

Everything working hunky-dory, although I'm not sure why it takes multiple hits to break the glass with the sword...I've set the health to "1". This seems to happen sometimes with brush glass too.

Link to comment
Share on other sites

It's visible now. I was maybe just too quick off the mark. That looks fun!

... I'm not sure why it takes multiple hits to break the glass with the sword...I've set the health to "1". This seems to happen sometimes with brush glass too.

? :mellow:

Link to comment
Share on other sites

Also, where are the flinder settings set, anyone know off-hand? I think they disappear a little too soon atm.

Link to comment
Share on other sites

Also, where are the flinder settings set, anyone know off-hand? I think they disappear a little too soon atm.

 

It seems to be hard-coded:

 

const int SHARD_ALIVE_TIME    = 5000;
const int SHARD_FADE_START    = 2000;

which I think must mean that the shard starts to fade after 2 seconds and vanishes after 5.

 

It should be easy enough to replace those constants with a spawnarg that defaults to those values.

Link to comment
Share on other sites

In that example, brushes probably would work. Though it's faster to add a glass model that's customized to fit exactly inside the case model.

 

It should be easy enough to replace those constants with a spawnarg that defaults to those values.

 

 

That would be great---it's a bit jarring to have them completely disappear so quickly.

Link to comment
Share on other sites

Re why 1hp still requires multiple hits. What comes to my mind is the func_destructables have multiple stages of increasing destruction before the final destroyed stage. So I'd first see if func_fractures might not have a similar thing of increasing fracturing (which aren't showing) until the final shatter. That is, the health works in stages.

 

Otherwise, maybe the fracture technically happens but it takes more hits to actually make them fly out. Or the hits are effectively being blunted for some reason. But I'm just randomly speculating now.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Otherwise, maybe the fracture technically happens but it takes more hits to actually make them fly out. Or the hits are effectively being blunted for some reason. But I'm just randomly speculating now.

It might be that the hits must be in an exact spot. Flakebridge Monosteryt iirc

had some breakable tomb covers, which could be broken open in one hit with the jack...but only if they were hit in a exact spot....after much personal frustration

 

Link to comment
Share on other sites

You can hit a func fracture anywhere. Maybe only parts of the objects you mention are func fractures.

 

Otherwise, maybe the fracture technically happens but it takes more hits to actually make them fly out.

 

That's pretty much it. When the item gets "killed", i.e. struck by more damage than it has health, it enters a "broken" state but it doesn't shatter. Once it's in a broken state, any kind of touch will make it shatter, including the player walking in to it. But you do need an extra touch. We could add an "easy_smash" spawnarg if people want to use it :)

Link to comment
Share on other sites

That would be great---it's a bit jarring to have them completely disappear so quickly.

 

Done. There are new "ShardAliveTime" and "ShardFadeStart" spawnargs in DR. I've made the rest of the func_fracture spawnargs visible in DR too, which they weren't before.

 

ShardFadeTime isn't much use. It works the same way that particles fade out, by using vertexColor. So it'll only work on vertexColor materials, which we use a lot for particles but not much for anything else.

Link to comment
Share on other sites

Cool! Considering it is a thieving game, we get to smash display cases surprisingly seldom.

 

Does the AI react to the sound of shattering glass, btw? Would be jarring if it didn't.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

 

That's pretty much it. When the item gets "killed", i.e. struck by more damage than it has health, it enters a "broken" state but it doesn't shatter. Once it's in a broken state, any kind of touch will make it shatter, including the player walking in to it. But you do need an extra touch. We could add an "easy_smash" spawnarg if people want to use it :)

That doesn't really describe what I'm seeing. You can see in the video that the arrow destroys the glass with one hit--that happens every time with projectiles. Mines also shatter them instantly. Melee hits sometimes shatter in one hit, but other times they just paint a crack decal on them.

Link to comment
Share on other sites

Does the AI react to the sound of shattering glass, btw? Would be jarring if it didn't.

 

 

Absolutely. That's why we have the mechanic of shooting moss arrows at glass to break them more quietly (which, as far as I know, has never been used and might not even work).

 

edit: was just testing, and now I'm not sure if AI are reacting to the sound of the sword hitting glass, or the glass breaking. When shot the moss arrow at the window, two bad things happened. One, there was no indication that the window was mossed--the moss behaved the same as if I'd shot it at the wall. Two, nearby AI still reacted as if they heard something when I hit the glass, although the glass made no "shatter" sound when it broke. This mechanic obviously needs some work.

Link to comment
Share on other sites

The arrows and mines are possibly doing a double-tap: damage and force. I'll have a look what's going on.

 

 

 

Some interesting anomolies

 

1. One sword hit causes a "cracked" decal to appear on the glass. The glass, in this state, is now intangible to arrows (they fly right through and damage the glass on the opposite side of the case) and held objects (the held object moves right through the glass). Throwing a junk object also goes through the glass and breaks the glass on the opposite side. A further strike with a sword or bj breaks the glass.

 

2. Held objects can break regular glass just by being pushed against the glass. Thrown objects seem to break the glass first try as well. Neither cause cracked decals.

 

3. The performance affect of having a mine blow up and shatter the glass of five different display cases (4 fracture entities each) at once dropped my framerate to 3 until the glass disappeared. That might be problematic.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...