Deformation: Screenies!

Posted by TDOT on Nov. 6, 2008, 5:05 p.m.

Hey guys. In my last blog I wrote about how I was gonna focus on programming. My project at the top of the list was simple 2D terrain deformation. I've been working on this for a while now and FINALLY fixed the stupid glitch in my code. After that, things just started rolling and I've gotten a pretty good amount done.

So far I've programmed a simple terrain creator, which I plan on working on as I go. I can make any terrain I want with the mouse, and then export the terrain to an array which is easily read in GM. Right now, it's really only fit for me and testing purposes, but eventually it will be a decent tool to use with the engine.

The basic idea behind my engine is that the character doesn't really interact with the terrain itself. Position and collisions (that's right, the character collisions are pretty much fully functional) are calculated through a series of points (vertex points for the polygon which is the terrain) and character location. This works very well with the engine. Since the position is updated at all times, and calculated through the points, when the terrain deforms, the character moves with it.

Currently, I have a simple polygon with various points which can be deformed upward at the click of a mouse. The character moves over the terrain relatively smoothly. Jumping (and more importantly landing) work fine (except jumping doesn't work when walking down a slope, only when not moving, or going up).

Here's a quick list of immediate things to do:

[x]Implement "deformerator" instead of mouse manipulation.

[x]Code collision for the "deformerator" projectile.

[ ]Fix jumping glitch.

[x]Add downward deformation (beyond easy).

Next blog, expect screens and possibly a tech demo.

Shot down 5260 n00bs at time of blog

Ok, so I thought about posting another blog with the screens, but considering this one's only about 4th from the top or so, I'm just gonna edit.

I've got about 8 screens, so I'm gonna post 2 or 3, then just link to the rest.

So here we've got a….relatively….flat terrain.

Now, here's what happens after I fire the deformerator once.

Of course, we've also gotta have craters. Not just mountains.

See that little dot there? For now that's what the deformerator fires. Red means crater, blue means mountain. Right now it's firing a crater shot at the mountain I made earlier.

Screen 4

And the after effect.

Screen 5

So we've got a big crater. Now I'm firing a blue shot (which will make a mountain).

Screen 6

And now the after.

Screen 7

So I think that pretty much showcases it. Here's an extra one after I just played around and made a couple mountains.

Final

FAR from the flat terrain it started with.

As far as the tech demo goes, I may post it in the WIPs section in the next couple of days so keep an eye out.

Shot down 5355 n00bs at time of edit

Comments

biggoron 16 years, 1 month ago

I thought it was a new Resident Evil game ):

TDOT 16 years, 1 month ago

Ah, I gotcha. Cause of the "T" virus? Yeah, sorry :P

Maybe I should just write terrain XD

noshenim 16 years, 1 month ago

5300th noob.

get us some screens :P

Ferret 16 years, 1 month ago

OHHH! Just like fracture, I like that game.

DesertFox 16 years, 1 month ago

You know whats more awesome than the T-virus? The Mr T-virus.

It pities da foo that it infects.

Juju 16 years, 1 month ago

Can you make caves with the deformer? Come back when you can =)

Carlos508 16 years, 1 month ago

To fix the jumping thing, maybe try this:

Quote:

var canJump; 'Determines if we can jump

var dist; 'Determines max space underneath us we can have before we can no longer jump

canJump = collision_line(x, y, x, y+dist, obj, 1, 1); 'Check underneath us

if canJump{

[Jump Code Here]

}

That's just psuedo code, but it could help.

TDOT 16 years, 1 month ago

@_Player_

Expect screens over the weekend =D

@Ferret,

Yup! Fracture was my inspiration for this. Hopefull I can capture at least a little bit of that fun :p

@Dee,

XD

@Juju,

Haha, not quite yet. But I hope to eventually have it capable of doing things like that.

@Carlos,

Actually, my jump code is VERY similar. Except I created my own function for checking what's under the character. The only thing I can figure, is that, for whatever reason, when walking down a slope, the character is about 1px above the terrain. I should have it fixed soon though.

Thanks for all the comments! Been working on adding my equivalent of the entrencher.

Juju 16 years, 1 month ago

I've been plugging away at deformable polygon terrain for a while now and I've realised it is really very hard. The stage you've got to is good but not quite the whole story.

TDOT 16 years, 1 month ago

Yeah, I know what you mean. Now that I've got most of the engine fairly complete, I've been thinking about ways of expanding it. There's a few problems (namely keeping the terrain from overlapping on itself) that look like they could be trouble.