I would like to create a small game about battles in the Middle Ages. Imagine a procedurally generated 2d map with rivers, fields, and a small castle.

Two sides. One player will attack the castle, and the second player defends it.

The whole game will be with a view - top down. I like this look (and maybe it will simplify the work).

Imagine a player's cannon approaching the castle and attacking it.The cannon fires (e.g., into a tower) and the tower starts to fall apart. How to make this process more interesting? With various effects (for example, to the place where the gun fell off a piece of wall, and on the roof of the tower there was a crack).

I like the process of destruction in AE defenite edition, but it looks the same for all types of buildings (sooner or later they will turn it into the same bunch).

The example what I'm mean when say 2d castle in top down view:

How to break this castle into chips?

P.S I hope you see the author's patron, from his patron this picture could be downloaded for free. He has many other amazing pictures.

enter image description here

ADD some visual guide:

enter image description hereenter image description here

enter image description here

enter image description here

  • \$\begingroup\$ It's unclear to me what you want this destruction to look like and where you've run into trouble achieving that effect. \$\endgroup\$
    – DMGregory
    Sep 8 '20 at 20:47
  • \$\begingroup\$ I would like to achieve this without drawing "stages of destruction" for each tower or wall or other building.I'm still new to gaming programming and so far I don't know how to work with destructiveness. So my problem is how to do it. \$\endgroup\$ Sep 8 '20 at 20:56
  • \$\begingroup\$ How to do it depends on the look you want to achieve. So you'll need to establish some kind of visual guide first, before we can recommend ways to accomplish something similar. \$\endgroup\$
    – DMGregory
    Sep 8 '20 at 21:12
  • \$\begingroup\$ Add some new information (sry not so good at drawing) Once again, I would not like to draw all these pieces (I would have to make them for each object on the map: walls, towers, buildings). \$\endgroup\$ Sep 8 '20 at 22:38
  • \$\begingroup\$ A general effect won't really look good if you want to have different ways to deal dmg. Your fire arrows won't leave a cracked roof, your cannon against a tree won't set it on fire and cracks on water just don't feel right. First you should identify what kind of dmg and matching visual you want. You will need to split up your image into smaller parts to be able to apply the effect nicely. For most impact dmg decals can look nice or a bit of smoke effect and fire particles. \$\endgroup\$
    – Zibelas
    Sep 9 '20 at 7:18


Try to think about what happens when a cannon ball traveling through the air hits something. The ball will have a certain mass and velocity, and thus a certain amount of kinetic energy that can potentially do damage.

What happens with the cannon ball itself after a collision? Does it bounce, fall down, break apart, roll, catch fire or explode? It could bounce (for example, if it hits the ground at a grazing angle), but if it hits a stone wall it is likely to just lose all its kinetic energy, fall down, and maybe roll away.

What happens at the point of impact? A stone wall reacts differently from a wooden roof. And there is a small chance that you hit a person or some piece of equipment. As mentioned by Zibelas, all these things might need to be handled differently.

As for materials that crack when hit by a cannon ball, you could perform a detailed simulation of how the material reacts, but I don't think that will fit with your visual style, and will be a lot of work to code and to run. Instead make some simplifications. Keep some basic physics in mind: a cannon ball has a limited amount of kinetic energy that it can impact. When this energy is transfered into the material, there are several ways that this energy can be distributed, including:

  • The object as a whole can inherit the kinetic energy, and thus start moving
  • The energy can be fully dissapted as heat
  • A crack can be created

Usually, it will be a combination of all of the above. Ok, now looking just at cracks, depending on the material there is a preference for the direction of a crack, and once a crack starts, it will likely continue in the same direction. But typical materials have impurities, and there will be points where it becomes more favourable to change the direction of a crack. To simulate this, I would use the following algorithm:

  • From the point of impact, spend a fraction of the energy for a crack that continues approximately in the direction of impact. The amount of energy spent determines the length of that crack.
  • Then, make a random choice at the end of that crack:
    1. Change the direction of the crack
    2. Split into two branches, each going in their own direction
  • Then repeatedly advance all the cracks until you have spent all energy.

You can tweak the parameters, such as the chance to bifurcate a crack, until you find it generates a pleasing crack pattern.

Apart from that, you want to check whether a crack line intersects an existing crack or if it hits the edge of the object that is cracking. In that case, there will be a piece of material that has now become completely loose. You can decide to give it a bit of kinetic energy from your remaining energy budget, and send it flying.


It seems like you can just draw the crack lines using a black line with similar properties as the outlines used in the drawing of the castle. But cracks just don't suddenly appear in one go. Creating a convincing animation might be hard. However, think again of the physics of a cannon ball impact: there will be dust and fine particles that will be disturbed, and could form a small smoke-like cloud. This cloud will dissipate in a few seconds, and might move along the direction of the wind. The cloud will hide the crack formation, so you don't have to worry about that. You can also make a few small particles erupt from the point of impact to give it a more dynamic look. It should be easy to add some randomization to these things, so they will look different every time.

  • \$\begingroup\$ Thank you very much for your advice! Where can I read more about it? I have to add the int cinematic energy parameter to each object (for buildings it means how many times you have to hit it to completely destroy it). I have a question to you to explain in more detail how to draw the cracks (because the cracks for the tower, walls and houses must be different, because the building or wall has no black stripe around) and what about the flying pieces? The walls and towers are built of stone, but the rest of the building is made of wood or other materials. \$\endgroup\$ Sep 9 '20 at 12:05
  • \$\begingroup\$ @SergoLongid As I mentioned, you can tweak the parameters of the algorithm. So you can use different parameters for different materials. How to draw depends on what best matches your art style. But cracks in general are just thin, dark lines. Just use the color of the material but darken it, and adjust the thickness until it looks good. \$\endgroup\$
    – G. Sliepen
    Sep 10 '20 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .