ZFGC

Resources => Coding => Topic started by: Rukiri on May 21, 2008, 02:43:55 am

Title: [GM7] Mode7
Post by: Rukiri on May 21, 2008, 02:43:55 am
MODE 7
Code: [Select]
CODE
{
    // set the projection
    d3d_set_projection(x,y,10, x+cos(direction*pi/180),y-sin(direction*pi/180),10, 0,0,1);
    // set color and transparency
    draw_set_alpha(1);
    draw_set_color(c_white);
    // draw floor and ceiling
    d3d_draw_floor(0,0,0,room_width,room_height,0,
        background_get_texture(background2),10,10);
    d3d_draw_cylinder(room_width*3,room_height*3,833,-room_width*3,-room_height*3,-1000,
        background_get_texture(background4),4,2,true,8);
}

I'm basically trying to create mode7,and well I've had no luck I dunno if it can be fully done in Game Maker...

(http://i32.tinypic.com/1jrknk.png)
As you can see I failed... if anyone wants to help me that'd be great.
Title: Re: [GM7] Mode7
Post by: CrystalAngel04 on May 21, 2008, 02:55:33 am
In order to fit in the "Works in Progress" section it needs to be the game itself with at least 4 screenshots. You seem you be asking for help more than posting  a WIP game so I'm moving it to "Discussion" for now. If you have any issues with the move PM me.
Title: Re: [GM7] Mode7
Post by: mit on May 21, 2008, 10:35:37 am
It can be done, it has been done quite a few times, although I haven't seen anything recently. There used to be a few examples in GM5 floating around. I'll have a look to see if I can find them.

Meanwhile, you might want to consider using basic 3D functions, as in gamemaker, they will actually probably be faster than a scripted, mode7 engine. Plus you can add proper objects and stuff.
Title: Re: [GM7] Mode7
Post by: Rukiri on May 21, 2008, 08:53:45 pm
I have the GM5 examples... but the mario kart one and the GM5 functions are outdated...

Code: [Select]
Track2 = sprite_duplicate(Track_Dirt);
sprite_shift(Track2,160-Mario.x,160-Mario.y);
sprite_resize(Track2,120,120,5);   
sprite_rotate(Track2,90-Mario.direction,1);

for (i=1;i<=60;i+=1) {
    a = 0.7854 + 0.62025*i/60;
    //a = 0.7854 + i/60;
    z = 10 * tan(a);
    d = floor(10 / cos(a));
    draw_sprite_part_ext(Track2,0,
                         60-d,75-z,     //left,top
                         2*d,1,         //width,height
                         0,120-i,       //x,y
                         160/(2*d),1,   //xscale,yscale
                         1);            //alpha
}
sprite_delete(Track2);
Title: Re: [GM7] Mode7
Post by: mit on May 21, 2008, 09:51:53 pm
You could try using surfaces, it'd probably be faster...
Title: Re: [GM7] Mode7
Post by: Rukiri on May 23, 2008, 12:48:18 am
I've tried that, it'll rotate till yo see the greyish background.
Title: Re: [GM7] Mode7
Post by: Rukiri on May 23, 2008, 03:49:36 am
Sorry for the bump but I found the other gm5 M7 demo and I think it's better, Ok here's my edit and the original file.
http://www.megaupload.com/?d=TD74FBHF
   
http://www.megaupload.com/?d=CH6TNT1I
   
I never finished ripping the world, but see the gray background in my edit? I can't seem to fix that at all... and in the original file theres functions where you could add rotating(never got those working)
Maybe you guys can get em working.

Also this does everything that I need if the gray background never showed up and if I could get the rotating functions to work.

My edit is a .gmk, the original is gm5.

Screenshot!
(http://i29.tinypic.com/28mdbud.png)
Title: Re: [GM7] Mode7
Post by: mit on May 23, 2008, 08:36:15 pm
I didn't download those, but I don't think I made it clear just how easy it is to make it using 3D functions.


http://www.kousougames.com/data/downloads/counter.php?file=MarioKartEngine
Title: Re: [GM7] Mode7
Post by: HyperKnight32 on May 23, 2008, 11:49:12 pm
I've always wanted to know how to do Mode 7 style in GM, but I stopped using it ages ago. Wouldn't using 3d functions use up a lot of memory and lower the FPS dramatically if you used a massive world map?

Anyways, I'd love to see if I could remember anything back from when I used GML, but since it's GM7 pro I'm afraid I can't really do much to help  :-\. I still have GM6, but it had a fair few changes from 5, so that didn't work either.
Title: Re: [GM7] Mode7
Post by: mit on May 24, 2008, 10:02:36 am
I've always wanted to know how to do Mode 7 style in GM, but I stopped using it ages ago. Wouldn't using 3d functions use up a lot of memory and lower the FPS dramatically if you used a massive world map?

Anyways, I'd love to see if I could remember anything back from when I used GML, but since it's GM7 pro I'm afraid I can't really do much to help  :-\. I still have GM6, but it had a fair few changes from 5, so that didn't work either.

Not in game maker. Mode 7 has to be scripted, and that's what uses lots of memory. Manually stretching sprites and whatnot. The 3D functions call DirectX functions, which are compiled, and are faster. What would slow it down is if you actually added lots of objects and lots of polygons and so on. You don't need to use any of the main 3D functions for it - as in the example I posted - just position the camera over the room to look at the background at an angle. Stretches it perfectly for you. Very little memory used, and almost no code.

Another advantage is that you can actually add 3D items to it too, such as making the walls 3D instead of having them flat. GM can handle this kind of thing quite I easily, with very little loss in frame rate until things get very complicated.

Me and Atrius are actually working on a couple of 3D games at the moment. He even managed create our own 3D animation program, and managed to load standard model files, such as scenes from OoT: http://img.photobucket.com/albums/v698/AtriusV/Random%20Screens/OoTSceneTest.png

Title: Re: [GM7] Mode7
Post by: Rukiri on May 30, 2008, 05:18:00 am
Thank you very much, this is exactly what I was trying to do!
Title: Re: [GM7] Mode7
Post by: HyperKnight32 on May 30, 2008, 07:42:03 am
That 3d animation program looks very impressive mit ;).

Also the basic mariokart engine, this may prove useful for a Mode 7 styled world map, I've been thinking about making an original console styled rpg for a long time, I shall study GM's 3d functions to gain better understanding.

Do you have any idea if it's possible to have a 3d floor based on tiles places in the room? Or can it only be a background?

I'm glad you posted this topic Shiku, I tried searching for a mode 7 style engine for gm a long time ago with no success, thanks to this topic I now know it's possible :).
Title: Re: [GM7] Mode7
Post by: Rukiri on May 30, 2008, 02:22:20 pm
Actually it's missing 1 important feature, map looping. I don't know how to do it but it just makes an infinite loop of your game map basically it's like you copy and paste in pant and the end.

If you were at the top you'd see allot of water if you kept going straight that way you'd eventually reach the bottom of the map(I dunno if it's a teleport feature) but in Rpg-Maker you can do an infinite loop of your map even if you did a 20X15 map.

Oh yea, I'm trying to get this projection in the newmode7 gm file.
(http://i29.tinypic.com/28mdbud.png)

And here's what I have(in the newmode7 gm file)
(http://i25.tinypic.com/296g4ue.png)
Title: Re: [GM7] Mode7
Post by: mit on May 30, 2008, 03:10:43 pm
Hmm, first, you can try experimenting with the camera position to get the projection the same as the first pic.

For map looping, the easiest way I can think of is to make it draw the map a couple of times more on each side, and loop your X and Y coordinates.


About the tiles, it's quite possible you could get it to draw them correctly in real time, but it might just be easier to make the background texture by taking a screenshot of the room before the game starts / before the camera is positioned.
Title: Re: [GM7] Mode7
Post by: Rukiri on May 30, 2008, 08:35:07 pm
I've messed with the background settings, it never seems to loop... As for the projection I can't get it like the first screen I showed you.
Title: Re: [GM7] Mode7
Post by: Rukiri on July 04, 2008, 10:09:57 am
Hey, my friend coded mode7 for me, but we're still having problems making it so the background will draw seamlessly and we won't see the background color at all.
(http://i26.tinypic.com/dxxn2t.jpg)
You see the gray background? well on the right is the drawn background, it does draw seamlessly but I don't want it to move over so many spaces, I just want it to draw infinity like it does but without seeing that gray background in games.

You can download it here.
http://www.ion-gamemaker.com/downloads/mode7.gmk (http://"http://www.ion-gamemaker.com/downloads/mode7.gmk")

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved