Anyone here played an indie game called Cortex Command?
It's a pretty broken, albeit fun 2d side scrolling shooter with fully destructible terrains AND characters, which IMO is its main selling point that sets it apart from most of the other games in the genre. I won't delve into describing in detail how the game's engine works, since that wouldn't get the point across that well, so here, have a couple of random animated .gif images showcasing some of the destruction possible:
Seeing as this game is 2D and that Construct 2 is also made specifically for creating 2D games got me wondering:
Would it be possible to recreate a dynamic damage system like this in C2?
Now, obviously none of us have 11 years to spend making an engine this sophisticated and detailed (yes, that game did take that long to be developed), but i think that with the current state of C2 it might just be possible to pull off something in the spirit of CC, but in a simplified manner.
So, the question that remains is: "WAT DO???"
Well, this thread is made for discussing methods of how one might implement this and what problems one would encounter while doing so, so here's my ideas so far...
Terrain.
Possibly the simplest part of the puzzle, should be pretty straightforward to do.
1.) I would approach this by creating a tilemap which would represent the whole game map, and once some sort of deformation would need to occur, i would clear the affected tiles and create sprites which have a physics behaviour in their place, and apply force or rotation to them as needed. Once their velocity drops below a certain threshold, i'd detect their position relative to the tilemap, create the specific tile in their location and destroy the sprites.
Pros: Relatively simple implementation, decent performance and not very high memory use, should be pretty easy to save the map too.
Cons: No support for rotation of the static tiles (does this even matter at smaller resolutions?).
Vehicles and characters.
This is where the problems begin. While making or characters that are composed of multiple parts (e.g. skeleton animations) and can also be broken up as needed should be possible, albeit a bit tricky to implement, the hard part is creating layers of armor / flesh, that can be removed dynamically.
1.) One way to accomplish this would be by creating a file of some sorts, which contains information of what your characters are composed of (e.g. which pixels should be made out of flesh, which out of bones, where the eyes should be, where the internal organs or whatever other meaning you can think of giving to slightly differently colored pixels) and once a bullet impact happens, compare the location of the hit with the file and spawn a small, possibly a couple of pixels wide sprite at the location of impact, change its animation frame to the needed one and pin it to the character.
Pros: Good resolution, no need to change the base character sprite.
Cons: Performance gets progressively worse as more of these sprites are spawned, no ability to "erase" pixels of the base sprite, this sort of system would also be pretty complicated.
2.) Another way that one could solve this issue would be to adjust the base sprite by loading it into the canvas, then applying any needed transformations and replacing the base sprite with the adjusted one.
Pros: Ability to adjust the original sprite, without creating additional ones.
Cons: Because of how C2 manages sprites, each character would need to have their own sprite (frame?), which makes this option impossible to use without terrible memory management issues, as this would probably have some ridiculous limitations on character numbers.
3.) Also, one could possibly create a system similar to one described in the first character creation method, just instead of using sprites that represent whole character parts, use many smaller sprites to represent the pixels of each of the character sprites (a bit like making a character out of voxels) and modify these directly, as needed. One way to explain how this would work is to imagine a character represented by a tilemap, that can be rotated and moved (like a sprite). Although probably the most sophisticated method to implement, it would probably be the most versatile and closest to the system in Cortex Command.
Pros: The most versatile and complete of the approaches listed.
Cons: Hard to implement, and probably higher base memory usage, would need more CPU resources due to more sprites to manage.
Ideas on how to do this in other ways? Your suggestions, things to look out for? Example .capx files, even?