Jump to content
The Dark Mod Forums

Breakable Glass


Springheel

Recommended Posts

 

The blackjack will do that. As long as the glass' health is higher than blackjack damage, you'll get a crack but no shatter.

 

 

Yes, I think that's the way to go. We can set it so that hitting glass with the blackjack doesn't create a noise loud enough to alert AI (which already may be the case), but it causes a crack decal if the glass is breakable. Then, if a crack appears, players can make an informed choice to moss the glass or not before shattering it.

 

It's relatively intuitive, and doesn't require any new mechanics or tools.

 

I'll do some tests with glass set to 5hp. That's enough for two bj hits but a single sword or arrow strike should be sufficient.

Link to comment
Share on other sites

Setting glass to 5 hp requires 4 bj hits to break it (each paints a cracked decal). Still requires 2 sword hits due to the impulse issue. An AI in the same room didn't hear me hitting the glass with the bj until it broke. Sounds like a winner.

 

Still testing how it affects held objects. Breaking the glass by throwing movables seems harder, but I have to run more tests because I could be hitting the metal cross-braces.

 

edit: It looks like throwing and pushing movables still breaks the glass, but how easily it does it is based on the mass of the object? I threw a beer mug 5 times at a window before breaking it, and pushed into the glass for several seconds before it broke. Using a dropped sword broke it faster. One issue though is that throwing held objects doesn't paint a crack decal. Probably should.

 

Crack decals also seem to disappear after a time. Not sure they should.

 

Also, when I mossed the glass and then broke it with my sword, the AI still responded to it--not the full shattering, but he heard the impact sound of the sword hitting glass. I'm not sure that's a bad thing...mossing glass shouldn't make it absolutely silent, should it? Just reduce the sound so only AI immediately nearby can hear?

 

Also, one last gameplay thing...we may want some kind of alert marker so AI can react to broken glass by default. Even after the glass has disappeared, it should be awfully suspicious to find something broken.

Link to comment
Share on other sites

Just curious, is there a way to assign a left over shards prop? Like a static prop that spawns as like shards of glass around the frame's edge?

 

Source has something similar I used for destructible drywall panels, so I figured I throw that one out there as food for thought.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

There is another type of entity that can be used for things like breakable crates. It can spawn flinders.

Link to comment
Share on other sites

There is another type of entity that can be used for things like breakable crates. It can spawn flinders.

 

But nothing that can be tied into an output from the entity you use for the breakable glass? Maybe not important right away, but it adds a whole level of realism when not everything disappears after the initial break.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

You could set the glass to never disappear if you like, though that has performance considerations.

Link to comment
Share on other sites

edit: It looks like throwing and pushing movables still breaks the glass, but how easily it does it is based on the mass of the object? I threw a beer mug 5 times at a window before breaking it, and pushed into the glass for several seconds before it broke. Using a dropped sword broke it faster.

That sounds like a realistic mechanic. We might need to lower the threshold a bit.

 

One issue though is that throwing held objects doesn't paint a crack decal. Probably should.

Already got that on my to do list above :-)

 

 

Crack decals also seem to disappear after a time. Not sure they should.

That rings a bell from when I was working on making decals persist through save games etc. Decals on AI are permanent, but decals on worldspawn and statics have a time out. We can tweak it, or maybe eliminate it. I'll put it on the list.

 

 

Also, one last gameplay thing...we may want some kind of alert marker so AI can react to broken glass by default. Even after the glass has disappeared, it should be awfully suspicious to find something broken.

Yes, a broken glass pane should be deeply suspicious. It'd be easy to spawn an absence marker, but would the barks make sense?

Link to comment
Share on other sites

But nothing that can be tied into an output from the entity you use for the breakable glass? Maybe not important right away, but it adds a whole level of realism when not everything disappears after the initial break.

We could probably make the shards permanent without hurting performance if we make them static once they come to rest. I.e. they no longer interact with one another or move again. They could still have a static clip model.
Link to comment
Share on other sites

You could set the glass to never disappear if you like, though that has performance considerations.

 

I don't know near as much about Id 4 as I'd like, but I'm assuming that entities don't fire outputs based on game-states? At least not this glass entity?

 

Because yeah from the way it sounds, the glass breaking doesn't seem to perform to well on a lot of people's machines. I feel like the left over shards would be something easy to tack onto the entity in code terms but I'm no coder, so I probably ought not say such things. :rolleyes:

 

Otherwise has anyone considered what it might be like, if there were just a smash particle effect in place of the shards? Could at least have something like that as a fill in while the performance hit gets sorted out.

 

EDIT: & SteveL my thoughts are more about how the glass panel looks. Adding the static spawn would just visually make more sense of where the glass broke off from, but is purely for visual effect. Otherwise you get this clean edge, where you can't tell there was ever glass once the shards disappear. If that makes sense anyway.

Edited by Epifire

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

We could probably make the shards permanent without hurting performance if we make them static once they come to rest. I.e. they no longer interact with one another or move again. They could still have a static clip model.

 

 

 

That has potential. We'd have to be careful that they don't block anything important or float in the air though.

 

Decals on AI are permanent, but decals on worldspawn and statics have a time out. We can tweak it, or maybe eliminate it. I'll put it on the list.

 

 

Ah, so they would be controlled by the same spawnarg that handles scorch marks from fire arrows?

 

It'd be easy to spawn an absence marker, but would the barks make sense?

 

 

Not an absence marker, since that would trigger "we've been robbed" barks. The mapper can always put that on whatever is inside the case if they want that behaviour. We want something that triggers the kind of "general suspicious" reaction that AI have to rope arrows.

 

By default, AI probably shouldn't treat it as clear evidence of an intruder (meaning they pull their sword out and go to full alert mode), since the player has pretty limited options for controlling that alert. They can either break the glass or not, but once they do there is no way to hide it, unlike bodies or blood or whatever. So we probably need the AI to be more forgiving--they should definitely comment about it, but perhaps not go to full alert--something similar to the reaction they have to a rope arrow. Perhaps mappers could choose to increase the affect using a spawnarg?

Link to comment
Share on other sites

where you can't tell there was ever glass once the shards disappear. If that makes sense anyway.

 

 

I see what you're getting that. I was planning to address it by trying to set up a skin swap, so that after the glass is broken the display case switches to skin with jagged leftovers of glass. But that wouldn't work if the mapper set up a custom func_fracture.

Link to comment
Share on other sites

Also, one last gameplay thing...we may want some kind of alert marker so AI can react to broken glass by default. Even after the glass has disappeared, it should be awfully suspicious to find something broken.

If an object emits a visual stim, and has this spawnarg:

 

"AIUse" "AIUSE_BROKEN_ITEM"

 

then AI should become concerned. I doubt this has ever been tested, but the code is all there. You just have to leave something behind that satisfies those two requirements. A new invisible marker similar to the missing item marker should do it.

Link to comment
Share on other sites

By default, AI probably shouldn't treat it as clear evidence of an intruder (meaning they pull their sword out and go to full alert mode), since the player has pretty limited options for controlling that alert. They can either break the glass or not, but once they do there is no way to hide it, unlike bodies or blood or whatever. So we probably need the AI to be more forgiving--they should definitely comment about it, but perhaps not go to full alert--something similar to the reaction they have to a rope arrow. Perhaps mappers could choose to increase the affect using a spawnarg?

Broken items take the AI to Searching (just under Agitated Searching), so they wouldn't immediately draw a weapon.

 

However, when they return to Idle State, they'll shift to Alert Idle, so they'll draw their weapon at that point.

 

It would be best to get the broken item recognized (new marker) before changing any of the reaction code. It might suffice as is, or if it doesn't look right, then change the reaction code, which is a simple matter.

  • Like 1
Link to comment
Share on other sites

You should create other categories of markers to spawn, suspicious_marker, broken_marker. But is it possible a mapper could make their own marker and specify the categories of barks they want by spawnarg?

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

I've committed a couple more fixes. Updated list:

 

Fixed in svn

  • Let models be shatterable, not just brushes / patches
  • Spawnargs to control shard life time
  • Thrown objects pass straight through glass that's down to 0 health
  • Wrong sound when breakables are struck

Bugs to-do

  • Damage effects should be applied by any damage to glass, not just melee weapon damage
  • Melee weapons should be able to break glass in one hit

Under discussion / investigation

  • Moss should stick to func_fractures, even when they are vertical. Use decals?
  • Leaving behind some edge shards
  • Make fallen shards permanent, either with static clipmodel or non-physical
  • Decal cracks disappearing
  • AI awareness -- test AI reactions to brokenitem

Peformance issues

  • Are moss blobs physically interacting with the shards?
  • Like 2
Link to comment
Share on other sites

We could probably make the shards permanent without hurting performance if we make them static once they come to rest. I.e. they no longer interact with one another or move again. They could still have a static clip model.

 

IMO glass shards should not interact with one another in the first place, they should only care about the world geometry and other meshes, is better for performance that way and enables the use of more shards, yes they will interpenetrate each other but imo is something that does not break immersion that much, that is also how Nvidia PhysX does its particles effects and people don't seem to mind.

Link to comment
Share on other sites

 

IMO glass shards should not interact with one another in the first place, they should only care about the world geometry and other meshes, is better for performance that way and enables the use of more shards, yes they will interpenetrate each other but imo is something that does not break immersion that much, that is also how Nvidia PhysX does its particles effects and people don't seem to mind.

 

 

If the glass shards are small enough it shouldn't visually effect all that much. But if there's only about six chunks in all you're gonna notice that more.

 

Btw, I know I'm sorta new to the whole Id 4 tools but would a glass shatter particle effect be that hard to try? I'm not into vfx creation myself, but I know with some systems you can attach meshes (aka glass shards) and the game can process that easier vs physics props. Depends on how the engine handles ti's physics.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

re: performance. Originally I had each pane of glass as 6-sided. When I made it only a single plane, setting off a mine wasn't nearly so bad.

Link to comment
Share on other sites

That has potential. We'd have to be careful that they don't block anything important or float in the air though.

 

We could turn off the physics entirely. Probably the only way to ensure that fallen shards don't block things that they shouldn't. But it would be nice to have the player footsteps using a broken glass sound when walking over them. Hmmm.

 

Ah, so they would be controlled by the same spawnarg that handles scorch marks from fire arrows?

Yes. I need to refresh my memory on how that timeout system works.

 

 

IMO glass shards should not interact with one another in the first place, they should only care about the world geometry and other meshes, is better for performance that way and enables the use of more shards, yes they will interpenetrate each other but imo is something that does not break immersion that much, that is also how Nvidia PhysX does its particles effects and people don't seem to mind.

Agreed, that's the first thing we should try if we find performance problems after we've finished tweaking it. The only downside would be the glass pile ending up more flat as the shards won't sit on top of one another.

 

Btw, I know I'm sorta new to the whole Id 4 tools but would a glass shatter particle effect be that hard to try? I'm not into vfx creation myself, but I know with some systems you can attach meshes (aka glass shards) and the game can process that easier vs physics props. Depends on how the engine handles ti's physics.

IdTech4 particles don't have any physics at all, so we can't use them for this effect. They'd just pass through the floor instead of bouncing and settling. The current effect is implemented similarly to particles, except that the placement of the shards is done by the physics system instead of being a fixed path.

Link to comment
Share on other sites

  • 2 weeks later...

Crack decals also seem to disappear after a time. Not sure they should.

Hmm, how were you testing this? Decals sprayed on worldspawn or static entities will time out, but breakable glass uses its own method of applying a decal, that doesn't time out. The decal should stick around until the shard it's attached to falls and vanishes.

 

I've done a few more fixes. Updated list:

 

Fixed in svn

  • Let models be shatterable, not just brushes / patches
  • Spawnargs to control shard life time
  • Thrown objects pass straight through glass that's down to 0 health
  • Wrong sound when breakables are struck
  • Damage effects should be applied by any damage to glass, not just melee weapon damage
  • Melee weapons should be able to break glass in one hit

Bugs to-do

Under discussion / investigation

  • Moss should stick to func_fractures, even when they are vertical. Use decals?
  • Leaving behind some edge shards -- This already happens, as long as you make only 1 surface of your brush a visible surface, and the rest is nodraw. Some glass shards will stay put at the unconnected edges until you touch them.
  • Make fallen shards permanent, either with static clipmodel or non-physical
  • Decal cracks disappearing -- Might not be a problem, see above.
  • AI awareness -- test AI reactions to brokenitem

Peformance issues

  • Are moss blobs physically interacting with the shards?

 

Do we have a material that we could try as a mossy decal? We can use the existing code that applies the crack decal to do that. although it'll mean full coverage of the glass alongside the existing moss blobs. The decal will have to look right side-by-side with the moss blobs. An alpha-tested decal would be best.

 

Edit: Pretty sure we've got an ivy texture that's quite 3d-looking and has alpha gaps. That'd do for a test.

Edited by SteveL
  • Like 1
Link to comment
Share on other sites

Hmm, how were you testing this? Decals sprayed on worldspawn or static entities will time out, but breakable glass uses its own method of applying a decal, that doesn't time out. The decal should stick around until the shard it's attached to falls and vanishes.

 

 

I can't remember now, but I think I cracked a glass, left the room for a minute and when I came back the glass was clear.

edit: just trying it now and can't reproduce it.

 

This already happens, as long as you make only 1 surface of your brush a visible surface, and the rest is nodraw. Some glass shards will stay put at the unconnected edges until you touch them.

 

 

This has not been my experience...the broken glass shards fade out after a short time, regardless of whether they fell or remained in place (unless this is due to a recent change).

Link to comment
Share on other sites

  • 2 weeks later...

Regarding the "jagged edge", what could help would be some sort of better "pre-computing" the shards:

 

Make a difference between "internal shards" and "edge ones". The internal ones are only touching other shards, but not world or other geometry. That bit of information can be computed when the shards are computed.

 

During the cracking, the shards can have different "stay in place" lifetimes. At the edge, a lot longer (they could even stay until you touch them), while the inner shards will fall away as soon as a neighbour shard falls.

 

The effect could even be changed that one shard only falls if it is either the point of contact (initial shard), or connected to that shard (propagate the impact to neighbour shards). I think the current model is "every shard falls as soon as the pane breaks" and that is not only unrealistic, but also very performance heavy.

 

If only the shards near the impact point would fall, you get much less physics engine strain, and the jagged edge, AND for bonus points you get the " play needs to clear out the glass" effect.

 

 

As for the alert to AI: is there a reason to not always send out a "borken object" stim once the object is broken? Ok, in the currently algorithm the glass vanishes, so this is unrealistic, but if the shards only fell in "stages", the stim could be sent until all of them are gone.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

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

    • 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.
      · 0 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
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...