Jump to content
  • Advertisement
  • entries
  • comments
  • views

Week #07 - Breaking stuff and Explosion !



Breakable object physics

Let's talk about physics in the game. We will introduce breakable glass, door and wall to the game to make things not only more alive but also give you more choice about your path to reach each level goal. A building is locked down ? Maybe you just jump through a window to get in ! A door is lock and you haven't found the key ? Maybe you just blow that thing out of your way ! There's no exit ? Well crank your energy up and destroy that wall ! This is the kind of choice you will be able to do as long as you live with the consequence of making a lot of noise and attracting more attention to you and potentially increasing your awareness level. Remember that your global awareness is what make your next level harder and harder. Physics will allow for more interactive game play and better replay-ability. Let be honest to, when a game require you to keep a certain level of stealth, you will eventually want to go destroy everything and play careless so why not make this fun !


Frag, IEM and Gravity bomb

The player, depending on the active character, will have access to a limited amount of grenade. You get a sneek peak about it in the video below. Frag grenade will allow you to destroy glass, door and wall too. 1 character have access to frag, another one have electromagnetic device that will shut down most electronic device and the last one will have a devastating black-hole type of grenade that will serve as a way to grab item at a remote distance or to simply make things vanish in another dimension ! More to come on those soon !

C# Break in parts

Our script rely on unity internal physic engine, which is quite good. Physics can become very CPU intensive so a lot of testing will be required to ensure smooth gameplay. I don't intend to go to far away into destruction. This is not a procedural "red faction" destruction system ! So destruction will happen, but in a limited amount of location. Destroying everything to get through is NOT an option. That said, i'm happy with the script performance and how it work.

Magnitude of an impact

For of all, the script take into account the magnitude of a hit. If the hit is too weak, the object won't break. Each object have their own breaking point which me require to walk into, run into, shoot at it, trow a grenade or use a special ability.

Parts physics

Once an object is broken, it fracture into multiple parts. The glass in the example video is make of 160 rigidbodies and it still perform well. Each part take into consideration their surrounding. Depending on how many piece stick together, the script determine if the piece can hold in place. The system also check for "framed" part. For a window, the framed parts are the object around the edge that would be hold in place by its frame, for a door it would be the part connected to the hinge. Those part don't fall by them self since they are hold in place by another object. Those part need to be hit again to fall and each sets of broken part need to be connected, within a certain range, to a framed part to be considered structurally stable. Basically that mean that a broken part cannot float in the air if it's not link to enough pieces and that a large glass would break realistically even if you hit limited area because the weight and size of the part would make them fall in real life. Then again, this is not a fracture simulator and we can't go too far into reality. It remain a game, so the main goal is to have fun with the system and to have smooth gameplay. The focus is about the gameplay feature or having more choice, more path and more replayability.

Explosion shock-wave !

Each explosion in the game come with a shock-wave effect. The shock-wave, in my own unscientific terms, is the air getting compressed and the explosion expanding over time. That mean that an object closer to an explosion will get hit faster than an object located further. On top of that, we take into consideration the distance between the explosion and the object to determine the amount of force received by the affected object. Obstruction is also considered, if something explode and there is object between you and the explosion, you will receive less damage.

The shock-wave introduce a very important time factor to the game-play. Making thing explode at a distance and have a split second to get out of the way may be a life saver for you or the AI.

See and be seen

The video showcase a turret being able to see you through glass and it shoot at the player destroying the glass. This behavior will of course be extended to AI but be aware that militarised zone or city will benefit from upgraded unit that may have heat sensor and a turret may just decide to kill you through a wall or a door if you are not cautious enough ! Soldier may also be equiped with those special google.  The game AI have nightvision and heat sensor to track you down. More to come on that in a futur post.

Let me know what you think about the feature or share your though about current game that use physics such as RB6  ?



Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Snow AshLand
      Snow Ash Land
      A 2D multiplayer top down shooter 
      Social - MMoRpg - Pvp - Craft - Build
      Hello everyone, this is my first post here, I'm happy to present you today my video games "snow ash land " , I worked hard for more than 3 years to get there, but today in the mass of games, it's difficult to get out of the mass, so I would have liked to find a nice person to join our discord and community.
      The game is already very advanced and will be finished within 6 months maximum ,it is already on steam ,in demo and early access ,we all appreciate constructive feedback ,and hope tohave attracted your curiosity Snow Ash Land is a multiplayer post-apocalyptic top-down shooter game with rpg mechanics and survival in a semi-open world.
      It simulates a reborn society in a post-apocalyptic world.
      Guided by factions with very different ideologies, the player can choose to help rebuild civilization or destroy humanity. There's a lot of interractions between players in multiplayer mode : Guilds, pvp territory wars, resources and information exchanges, language, politics, economy, building...
      STEAM :https://store.steampowered.com/app/977670/Snow_Ash_Land/ DISCORD : https://discord.gg/3j6e33k
      Website: https://snowashland.webnode.fr/ 

    • By jb-dev
      I've recently added a mini map on the right upper corner of the screen.
      With this the player can now see in which room it's currently in.
      That mini map get updated when the player moves to another room.
      In the future most rooms will be hidden until the player discovers it by either moving to a new room or, in the case of hidden rooms break a breakable wall or open the locked door.
    • By Aydin Kerimoglu
      Hi folks,

      My name is Aydin. For a while, i'm developing a game by myself. My profession is actually illustration and animation. I'm just learning coding. So I have no idea how long the process will take. But I'm sure I can finish it. 

      The main theme is the mysterious events that emerged in the 15th century Ottoman Empire. ( Yeg (Baba Yaga), gulyabani (ghoul), itbarak(werewolf), vampires, zombies and witches emerging in Constantiniye (aka İstanbul) etc.) 

      You can review a 20-second preview at the link below.
      I am aware that there is not enough data to evaluate it yet.But, i'm glad to hear that what you're thinking about the first look and the idea.

    • By AlanGameDev
      Hello there.
      I'm not 100% sure this is the appropriate sub-forum but this question is probably more about programming than design.
      I'm making a game with some mechanics loosely inspired by Factorio (plays like Terraria) and since I want to allow the player to build massive machines and factories all the tilemap logic runs in the GPU and the map data stays there in the GPU memory since it's potentially several gigabytes. That implies in many constraints, especially because there's no recursion in compute and overall it's quite limited (I'm using direct compute SM5, OpenCL is too cringy, Sycl is still in its infancy, Cuda is vendor locked and there's no console support for these techs anyway).
      So here's the problem: I want electricity to play a role in the game mechanics. The simplest solution by far is just making it global and adding/removing from it as generators/consumers are ticked, but that's gonna suck terribly, so I've been thinking about decent solutions to that problem that still meet the technical constraints imposed.
      I thought about an electrified 'area' around the power generators and also power lines like Factorio (similar to Sim City). The problem is transmission, I'll have to calculate the electricity flow and that's not simple to perform in the GPU. What I could do is make a bitmask for each power network and then do a bfs on CPU and attribute an ID for each connected power network, then when I'm ticking the power generators and the consumers I get the ID of the power network (for that tile) and add/remove electricity from that network, so the electricity is stored in a value accessed through the ID for that map tile. One of the problems here is when power networks overlap in area but don't interconnect, I think in this case exclusion is acceptable (only one network can supply a tile), or just automatically connecting networks that intersect.
      The real problem though is the potentially catastrophic result of having too many networks. As I said this is a really massive game with possibly hundreds of millions of actively updating 'tiles', and since each network will require not only a bitmask but also an entry in some array that stores the electricity, the number of networks will have to be capped much before a quantity that's reasonable for the overall magnitude of the game. Maybe say 16 or something because passing data to GPU is very slow. So while it's entirely possible to simply arbitrarily limit the number of power networks in the game, that goes against the basic premise of it.
      Maybe you guys have another idea on how to handle that. The usual practices are already taken into account like for example using reduced maps for the power grid and such (2x2 or maybe even 4x4), but those aren't solutions. A 'solution' would be to pass an int32 for each power grid tile (holding the network ID) but that's prohibitive in terms of performance. It is possible to flood fill the networks iteratively in the GPU so no data has to be passed, but that would not only cause some delay in converging to the correct solution but would require double buffering and optimizations aren't going to be trivial, for a starter looping the whole map and allocating values for the worst case scenario could work, but optimizing that is going to be a major pain in the rear (especially compartmentalization) and definitely bug prone because it's a whole other layer dependent on the base map data that has do bee synced.
      So do you guys have any other idea on how that can be done?
    • By Plotnus

      The current questionable design:
      I have lava that kills the player when it hits it.
      The logic to play the death explosion is in the object the player hits.
      When I did this I was influenced by what I read about Sims object design.
      By placing the logic in the object it's easy to add more objects with different logic.
      The downside is that responses are distributed in all the objects.
      The upside is that I don't have to write code for handling damage events and responses, and mapping damage types to death animations etc.
      I do feel this would be inappropriate for things like projectiles, and enemy attacks.
      However because the object it hits is Static I figured it'd be ok.
      The Ask:
      So, what are your thoughts and what would you consider a good design?

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!