[Effect] mode7

Share your Construct 2 effect files

Post » Sat Feb 20, 2016 7:58 pm

R0J0hound wrote:@zebbi
I'm not sure I follow, the object would need two sets of positions, one for it's top view position and one for how it will be on the mode7 view. I'm pretty sure the behavior only converts the top view position to the mode7 one.

Well, on the example mode7fx_objs theres four sprites and each one has both a m7x and m7y variable which is set to it's physical positioning on the plane, am I correct? The actual position of it in top-down space doesn't appear to correspond to how it appears in 3d.
B
29
S
7
G
3
Posts: 568
Reputation: 4,283

Post » Sun Feb 21, 2016 3:06 am

@zebbi
It's just how you look at it. To me those variables define the top view position and the actual position is irrelevant since the behavior will set that.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun Feb 21, 2016 9:09 am

R0J0hound wrote:@zebbi
It's just how you look at it. To me those variables define the top view position and the actual position is irrelevant since the behavior will set that.

So, it's not possible to design a map using the position of the objects in the layout, all of the objects have to be manually set using the co-ordinates in the variables?
B
29
S
7
G
3
Posts: 568
Reputation: 4,283

Post » Sun Feb 21, 2016 6:49 pm

It is possible, I didn't say it wasn't.

Put two objects in a container, Sprite and SpriteMode7. Position the Sprite objects in the layout editor to define the object positions. Then in the event sheet use the behavior or whatnot to set the SpriteMode7 object's position from the Sprite's position. You then move around the Sprite objects and the SpriteMode7 object will update accordingly.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun Feb 21, 2016 7:37 pm

R0J0hound wrote:It is possible, I didn't say it wasn't.

Put two objects in a container, Sprite and SpriteMode7. Position the Sprite objects in the layout editor to define the object positions. Then in the event sheet use the behavior or whatnot to set the SpriteMode7 object's position from the Sprite's position. You then move around the Sprite objects and the SpriteMode7 object will update accordingly.

So, would all objects (in this case it would be walls and doors) need to have two objects (Sprite and SpriteMode7) made in the layout or could the spritemode7 objects be automatically created at runtime? The example just seems to have the sprites and instance variables for x and y. Couldn't it be possible to have the positions on the layout define the x/y variables either at the start for fixed sprites and every tick for moving sprites (like enemies, etc)?
B
29
S
7
G
3
Posts: 568
Reputation: 4,283

Post » Sun Feb 21, 2016 11:41 pm

@zebbi
If the objects are in a container, the other would be created automatically. And yes you could just use variables instead of a second object if you wanted.

Basically you can set it up any way you want. The ideas I have should work, or the ideas you're presenting would also work. In the end you only need one object type that is positioned on the mode7 plane. Anything else is purely for convenience or just to make other things easier to do.

Having two objects in a container for instance makes collision detection actually possible. Consider if you had only objects on the mode7 plane, how would you do collision detection? You could try using the overlapping conditions, but really you'd get bad results. By having another object in a top view perspective, you can do collision detection with them in an easy way, plus all the movement behaviors can be used there.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Mon Feb 22, 2016 12:10 am

R0J0hound wrote:@zebbi
If the objects are in a container, the other would be created automatically. And yes you could just use variables instead of a second object if you wanted.

Basically you can set it up any way you want. The ideas I have should work, or the ideas you're presenting would also work. In the end you only need one object type that is positioned on the mode7 plane. Anything else is purely for convenience or just to make other things easier to do.

Having two objects in a container for instance makes collision detection actually possible. Consider if you had only objects on the mode7 plane, how would you do collision detection? You could try using the overlapping conditions, but really you'd get bad results. By having another object in a top view perspective, you can do collision detection with them in an easy way, plus all the movement behaviors can be used there.

Would it be too cheeky to ask for you to mock-up a quick capx to show how this could work, I could embellish it to see how far I can take it but I'm having a bit of trouble getting my head around collisions with container objects.
B
29
S
7
G
3
Posts: 568
Reputation: 4,283

Post » Mon Feb 22, 2016 1:53 am

@zebbi
I suppose that would be helpful. I have an example earlier in this topic that did that somewhat. I don't have an exact example using this effect though. Currently I don't use effects at all, and I haven't used rex's behavior. In a nutshell it's because webgl is slower on my machine if used and I need to modify C2's runtime to actually be able to use it, so I don't.

I have had a go at non effect version, a week or so ago, which may or may not be useful. It uses the paster object instead, but it does follow the pattern where the game map is defined on the "map" layer. That is where everything is moved around and everything from there is mapped to a 3d perspective.

The events have three parts to it. The "position objects" section, which would be similar to what rex's behavior does, except it also calculates the relative angle of other objects so the correct frame is used. The "ground render" section is what the mode7 effect does (however there's a math error in there I haven't tracked down yet). Finally the "control" section controls the movement in a custom way that I liked.

https://dl.dropboxusercontent.com/u/542 ... ce3d2.capx

Rabbit trail aside, that was after a week of tinkering and I'm at the point where I need to rework the math to correct the ground texturing alignment. Even with the effect and the behavior there would be work to match things up imo. Even though this is thought of as pseudo 3d, in reality it requires full on 3d math with perspective transformations.

A very useful reference is here:
http://www.coranac.com/tonc/text/mode7.htm
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Tue Feb 23, 2016 6:02 pm

R0J0hound wrote:@zebbi
I suppose that would be helpful. I have an example earlier in this topic that did that somewhat. I don't have an exact example using this effect though. Currently I don't use effects at all, and I haven't used rex's behavior. In a nutshell it's because webgl is slower on my machine if used and I need to modify C2's runtime to actually be able to use it, so I don't.

I have had a go at non effect version, a week or so ago, which may or may not be useful. It uses the paster object instead, but it does follow the pattern where the game map is defined on the "map" layer. That is where everything is moved around and everything from there is mapped to a 3d perspective.

The events have three parts to it. The "position objects" section, which would be similar to what rex's behavior does, except it also calculates the relative angle of other objects so the correct frame is used. The "ground render" section is what the mode7 effect does (however there's a math error in there I haven't tracked down yet). Finally the "control" section controls the movement in a custom way that I liked.

https://dl.dropboxusercontent.com/u/542 ... ce3d2.capx

Rabbit trail aside, that was after a week of tinkering and I'm at the point where I need to rework the math to correct the ground texturing alignment. Even with the effect and the behavior there would be work to match things up imo. Even though this is thought of as pseudo 3d, in reality it requires full on 3d math with perspective transformations.

A very useful reference is here:
http://www.coranac.com/tonc/text/mode7.htm

Thanks for the example, I noticed there's some events in yours that aren't as obfuscated as they are in rex's, is it possible for me to mix and match to be able to make for the cleanest possible example of these plugins?
B
29
S
7
G
3
Posts: 568
Reputation: 4,283

Post » Tue Feb 23, 2016 8:25 pm

@zebbi
I don't think so, the projection math is slightly different.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

PreviousNext

Return to Effects

Who is online

Users browsing this forum: No registered users and 2 guests