• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Mode 7?

I’m wondering how one could pull off a Mode 7 effect in GMS2 with sprites and tilemaps. I’ve been doing some research on Mode 7 and it appears to be an affine transformation that is done with some kind of matrix. Now that GMS2 can use matrixes I was thinking of either drawing a tilemap on a custom camera and applying a matrix to the camera, or drawing a tilemap with a matrix applied to it?
 
L

Lonewolff

Guest
I’m wondering how one could pull off a Mode 7 effect in GMS2 with sprites and tilemaps. I’ve been doing some research on Mode 7 and it appears to be an affine transformation that is done with some kind of matrix. Now that GMS2 can use matrixes I was thinking of either drawing a tilemap on a custom camera and applying a matrix to the camera, or drawing a tilemap with a matrix applied to it?
Yep, that should work.

FWIW - GMS1 has always been able to do matrices also.
 

Yal

🐧 *penguin noises*
GMC Elder
FWIW - GMS1 has always been able to do matrices also.
Not quite - there's 2D arrays and there's d3d_transform_* functions, but there's no link between them. There might have been a function to construct an arbitrary view matrix being added in eventually, but it definitely wasn't in 1.0 (and even after it was added in, it was mostly a workaround added in as an afterthought). I've personally only simulated Mode7 using the "proper" 3D system, but it's probably way less CPU/GPU-efficient than the real deal.
 

Khao

Member
They said I was crazy, but I faked a 3D sky by individually drawing each line in a sprite separately from top to bottom, each line drawn with a smaller scale than the previous one, and it slowly drifted to the right with each line moving at a different speed.

Performance was complete and total 💩💩💩💩, but it was one of the only things on the scene so it was never an issue, haha.

If I wanted to do it a bit more efficiently, I think I'd start looking towards primitives. I'm not sure how exactly drawing tilemaps works, but if you could add the tilemap into a primitive's texture, I think that'd work perfectly.
 
Easiest way is to use a 3D projection and draw a flat plane. This is also the fastest way.
I actually didn't even think of that, that does sound nice and easy.
If I wanted to have a simple mix of 2D and 3D (like a 2D sidescroller with a spinning background or something) then I'd just need to apply the perspective, draw the tilemap, then turn off the perspective and draw everything else right?
 
T

trashnerd

Guest
I actually didn't even think of that, that does sound nice and easy.
If I wanted to have a simple mix of 2D and 3D (like a 2D sidescroller with a spinning background or something) then I'd just need to apply the perspective, draw the tilemap, then turn off the perspective and draw everything else right?
sorry to dig up an old thread, but i'm curious if you've gotten it to work?
 

Yal

🐧 *penguin noises*
GMC Elder
sorry to dig up an old thread, but i'm curious if you've gotten it to work?
I was going to say something like "that guy hasn't been active since april 2018", but turns out SQGT was around just a couple days ago. Derp. I wouldn't be surprised if they've forgotten all about their 2018 project's inner workings 2 years later, though. And also, you shouldn't have asked just a yes / no question, because the answer to that isn't gonna help you either way :p
 
D

dannyjenn

Guest
There has been mode7 in GameMaker since the days of GM5.3, maybe earlier. I don't know how it worked (as it was a bit advanced and I didn't understand the code at the time), but I think I still have the file lying around somewhere.

These days you could probably achieve a similar effect with shaders and surfaces.
 
Last edited by a moderator:
Top