Destructible Terrain [ENIGMA PROPAGANDA]

Posted by ludamad on June 8, 2008, 1:10 p.m.

I'M A DONG

Hello, time for some ENIGMA propaganda to make you all drool. It's just too easy to talk about how much ENIGMA has over GM.

Today's topic, and an area where Colligma totally rocks GM's collision system: Destructible Terrain.

I was looking at the Game Maker wiki's article about the issue. Here are the proposed solutions (for 2D collisions) in Game Maker:

-Many Objects (the worst probably)

-Sprite Modification (not much better)

-Surface manipulation, creating sprites out of surfaces (the function lags significantly, very memory hogging compared to colligma)

Many objects fails for obvious reasons. In order to get pixel perfect manipulation, you need 1 object for every pixel. This is horrible. Each object has its own code that needs to be run (tons of time right there), its own default variables (tons of memory right there). Even bigger objects are slower, and they sacrifice accuracy even.

Sprite modification and surface usage:

The functions are really slow, and a sprite is a bad way to store collision information. Not taking graphical considerations into account, all you really need is an array of bits.

And that is exactly what colligma has.

Say you create a room with 32x32 blocks. You can give them all their own collision mask, or make them share one. Anything that will be changed, however, needs its own. I would reccomend only created a collision mask once you need to modify the object. Once you have a collision mask created, it is just a matter of using colligma's mask manipulation functions to remove, or add, parts to the mask. How you want to show it graphically is up to you, however. Very easily with colligma you can make a player sized hole in the ground, it takes elementary functions, unlike GM's unwieldy solutions.

Comments

NoodleNog 16 years, 5 months ago

ENIGMA objects should be fast enough for the user to be able to have every turret its own instance anyway, but its still a good idea and it would be possible in ENIGMA. It may not have built in support for it, but im pretty sure the system will be flexible enough for the user to implement it themselves.

(A better example is a complex boss where damage taken by certain parts would cause different reactions, etc.)

ludamad 16 years, 5 months ago

noodlenog is pretty correct. With some coding you can have multiple masks per object. As far as built-in functionality, its a bit messy to do, probably not for r3 either way.

s 16 years, 5 months ago

It would be easy enough for the user to store an array of maskIDs and an XY and then loop through them and check for collisions

Juju 16 years, 5 months ago

Ok, time for some clarification on GM's methods. Many objects is rubbish, yes. Sprite modification is actually pretty damn good, with an entire 640x480 sprite hardly causing slow down at all. Surface manipulation allows for some nicer effects but is actually just a litte faster than sprite modification… But its easier to understand and far easier to code without using some pretty crude hacks. I would like to point out that, in practice, surface manipulation is effectively sprite modification - you are directly adjusting the appearance of the sprite, just going through a buffer layer first.

The best method, strangely enough, combines all three. Multiple objects in a grid with independant sprites that are edited through a buffer layer.

Ok, now that's all done, I want to congratulate you on Colligma. Really, good job. I can't wait to get my new laptop and program ZG in ENIGMA to show people wait it is capable of.

Zac1790 16 years, 5 months ago

*drools*

Uhuhuh….

*wipes drool*

Cool.

Juju 16 years, 5 months ago

Lovely, Zac xD

MMOnologueguy 16 years, 4 months ago

hey, if YoYoGames walked up to you, gave you some ice cream, and asked for Enigma, would you give it to them?

panzercretin 16 years, 2 months ago

hey, if YoYoGames walked up to you, gave you Enigma, and asked for some ice cream, would you give it to them?