Jump to content


Photo
- - - - -

Thesnidr's Mode 7


  • Please log in to reply
70 replies to this topic

#61 esco

esco

    GMC Member

  • GMC Member
  • 209 posts

Posted 26 October 2011 - 06:15 AM

This is an amazing engine! Excellent work Snidr, you are obviously very talented! :biggrin:

I can use some advice too if anyone can assist me, I plan to use this in my 2d game. It is a side scrolling platformer (a remake of Castlevania: Symphony of the night), and the view will always follow the player object.I do not use d3d at all in my game. I intend to use this engine to get some 2d cloud sprites to appear like they are coming DIRECTLY at the screen. However I am having trouble setting up the camera to do this.

I do not understand the coordinate values I need to put into fps_set_projection. Can someone please, PLEASE advise me on this? I have tried all sorts of combinations and it still does not work.

Edited by esco, 26 October 2011 - 06:16 AM.

  • 0

#62 Dantheman888

Dantheman888

    GMC Member

  • GMC Member
  • 1 posts

Posted 31 January 2012 - 09:40 PM

Hi, I just downloaded de engine and I have a problem. I´ve got the background (of a track), the camera, and the rotating sprite of the car, all just like your example, but, when I start the game, all I see is a black background... ¿What I'm Missing?


I'm having the same problem. I don't even know why. I even got it to work by making a duplicate project and replacing the mario kart resources with my own, but then, when I try the same thing on a new project, it just shows black boxes indicating the backgrounds.

Edit: Found the problem. You need the following lines of code:

draw_set_color(c_white)
draw_set_halign(fa_left)
draw_set_alpha(1)

To initialize the primitive drawing. Otherwise, it stays at the default color (black).

Edited by Dantheman888, 01 February 2012 - 02:16 AM.

  • 0

#63 A.R.T.games

A.R.T.games

    GMC Member

  • GMC Member
  • 395 posts
  • Version:GM:Studio

Posted 17 May 2012 - 09:37 PM

I really like it. I want to use it for wolfenstein like game. The only question I have is: is there a way to draw a textured ceiling?
  • 0

#64 Furling

Furling

    GMC Member

  • GMC Member
  • 2 posts
  • Version:GM8

Posted 14 June 2012 - 11:23 PM

How I can make shape of player character, you made the tower shape something like that?
EDIT: I can't find the script the tower up and down move.

This wrong post, I found the thread correct one.

Edited by Furling, 15 June 2012 - 02:29 PM.

  • 0

#65 Dr. Coconut

Dr. Coconut

    GMC Member

  • New Member
  • 10 posts
  • Version:GM8

Posted 18 June 2012 - 06:16 PM

  • Title: TheSnidr's Mode7
  • Description: A 3D system not using GM's d3d. Also fakes the SNES' background scaling mode 7!
  • GM Version: GM 8
  • Registered: Yes
  • File Type: .rar
  • File Size: 816kb
  • File Link:
    http://host-a.net/u/playway/Mode7.zip
  • Please comment if you download :)

Additional Info
Hi, and thanks for showing interest in my fake 3d first person/ mode 7 engine!
This engine provides an oldschool effect called Mode 7, a background scaling technique that gives an illusion of 3D space, without entering game maker's 3D mode at all! Take Mario Kart for the SNES as an example.

Please give credit when used!

Posted Image

It also comes with functions for drawing different primitives and sprites.

This is based on the "Wannabe 3D" engine, which was made for use with topdown and platform games.

How to use
Before calling any of the other scrips, you must call fps_set_projection. This script creates all the variables needed to make the engine work.
fps_set_projection(camera_x,camera_y,camera_z,camera_angle,camera_tilt,camera_offset,view_scale,max_dist,min_dist)
  • camera_x/y/z: The position of the viewer in the room
  • camera_angle: The direction you're looking, in degrees
  • camera_tilt: Tilt the camera slightly up and down. Note, you cannot look directly up or down. For default setting, write 0
  • camera_offset: Set to a negative value to place camera behind player, and positive to place it in front. For default setting, write 0
  • view_scale: The scale of the world around you. A scale of 1 makes things appear the same size they are in the room editor. I usually use a scale of 10 or greater.
  • max_dist: The maximum drawing distance in pixels. Things further away than this won't be drawn
  • min_dist: This argument is rather abstract, but it basically moves the minimum drawing distance. It's a relative scale, and doesn't have a meaningful measure. Positive numbers move it in front of the camera, negative move it behind the camera. For default setting, write 0
This script should be placed in the create event of the camera object. To update it in real time, something you usually want to do, you should also place it in end step event of the same object.

Now that you've set the projection, you can start adding content. The fps_draw_sprite script has pretty much the same arguments as the function draw_sprite, except it adds 3 arguments:
fps_draw_sprite(sprite_index,image_index,x,y,z,xscale,yscale)
  • Sprite_index/image_index: The image of the sprite that is to be drawn
  • x/y/z: The position of the origin of the sprite
  • xscale/yscale: The scale of the sprite. Use 1 for default

Here's how to draw a wall
fps_draw_wall(texture,x1,y1,z1,x2,y2,z2)
  • texture: Supply a texture index. Find the texture index of a sprite by using sprite_get_texture(sprite_index,image_index)
  • x1,y1,z1/x2,y2,z2: Similar to the function draw_rectangle, only in 3 dimensions: Draws a textured rectangle with lower left corner at (x1,y1,z1) and upper right corner at (x2,y2,z2).

The engine also comes with a script for drawing with background scaling mode 7, a scaling method that's been popular since 3D games on SNES (mario kart, f-zero).
Here's how to use it:
fps_draw_mode7(texture_index,quality,repeat,z,width,height)
  • texture: Supply a texture index. Find the texture index of a sprite by using sprite_get_texture(sprite_index,image_index)
  • quality: A relative scale, where higher means better, but slower. I usually use a quality of 3 or 4.
  • repeat: Whether or not to repeat the texture, drawing them tiled.
  • z: The z-value, hopefully this needs no explanation
  • width/height: The width and height of the texture in the room, as seen from above. To make it fill the whole room, write "room_width,room_height"

Games made with this engine
Doom
Airfighter
Mario Kart

Affine texture mapping
As some of you know, game maker uses affine texture mapping. For those who didn't know, here's the difference between affine and correct mapping: http://upload.wikime...ure_mapping.jpg
This is the reason for "waves" or morphing appears on the ground or on fake 3d walls. As you can see on the picture of the mario kart track, the area close to the camera is a little wavy. That's the doing of the affine texture mapping.
More triangles will fix this problem though - but too many will slow your game down.
Your job will be to find the perfect scale between looks and speed.
Good luck!

So, can it only do pseudo 3D effects, or can it do distortion effects too? (Like when you enter the time machine in Chronotriger)
  • 0

#66 TheSnidr

TheSnidr

    That guy

  • Global Moderators
  • 2435 posts
  • Version:GM:Studio

Posted 19 June 2012 - 10:52 AM

This is just the 3D plane effect. I don't know what the time machine effect looks like, but no matter what, there would probably be better ways to do it than with this engine!
  • 0

#67 jtn0514

jtn0514

    GMC Member

  • GMC Member
  • 72 posts
  • Version:GM:Studio

Posted 09 October 2012 - 12:40 PM

Anyone run into the issue with the fps_draw_background script giving issues with the transparency of a sprite for the parallaxed background?

Seems that other sprites that should not show up, "bleed" into these sprites. Im unsure if this is due to drawing multiple sprites in one object or the ordering or what really. Im using studio so im not sure what the deal is.
  • 0

#68 dmal

dmal

    GMC Member

  • GMC Member
  • 37 posts
  • Version:GM:HTML5

Posted 26 October 2012 - 11:08 AM

Hi,
Did anyone try to make it work in Studio?
I'm trying to get this to work in html5.
I believe the Great Assembly can work, based on the failed code fixes I've been doing. The Mario Kart might work too.

Here is what I've found out:
The variable_* functions are obsolete, and won't return, because they don't work on all devices. You can work around this by using a ds_map with the items you want to test existence for, using the "variable name" as the key and the "variable value" as the value for that key in the map.

If you're using the variable_* functions in the create event to prevent that the create event values override values set in creation code of some instances, you'd be relieved to know the order of create event and creation code has now been swapped which means the creation code comes after Create event and so, values set in creation code override values set in Create.
  • 0

#69 jtn0514

jtn0514

    GMC Member

  • GMC Member
  • 72 posts
  • Version:GM:Studio

Posted 29 October 2012 - 02:19 AM

Hi,
Did anyone try to make it work in Studio?
I'm trying to get this to work in html5.
I believe the Great Assembly can work, based on the failed code fixes I've been doing. The Mario Kart might work too.

Here is what I've found out:
The variable_* functions are obsolete, and won't return, because they don't work on all devices. You can work around this by using a ds_map with the items you want to test existence for, using the "variable name" as the key and the "variable value" as the value for that key in the map.

If you're using the variable_* functions in the create event to prevent that the create event values override values set in creation code of some instances, you'd be relieved to know the order of create event and creation code has now been swapped which means the creation code comes after Create event and so, values set in creation code override values set in Create.



It works in studio. Ive managed to fix all the issues up front but the backgrounds (sky, trees) are still quite odd... ive managed to fix them somewhat but not quite perfect. seems the textures bleed off into foreverness from the mode 7 floor on some sides but not all as well.
  • 0

#70 dmal

dmal

    GMC Member

  • GMC Member
  • 37 posts
  • Version:GM:HTML5

Posted 29 October 2012 - 06:09 PM

It works in studio. Ive managed to fix all the issues up front but the backgrounds (sky, trees) are still quite odd... ive managed to fix them somewhat but not quite perfect. seems the textures bleed off into foreverness from the mode 7 floor on some sides but not all as well.


That's great! How did you fix all the issues? I'm quite a newb, and I'm just reading all the scripts and I cannot understand how they fit together, much less how to fix them.

Is there any good background info you can suggest?

Cheers
  • 0

#71 jtn0514

jtn0514

    GMC Member

  • GMC Member
  • 72 posts
  • Version:GM:Studio

Posted 29 October 2012 - 09:32 PM


It works in studio. Ive managed to fix all the issues up front but the backgrounds (sky, trees) are still quite odd... ive managed to fix them somewhat but not quite perfect. seems the textures bleed off into foreverness from the mode 7 floor on some sides but not all as well.


That's great! How did you fix all the issues? I'm quite a newb, and I'm just reading all the scripts and I cannot understand how they fit together, much less how to fix them.

Is there any good background info you can suggest?

Cheers



Well first of most stuff that wasnt created in GMS doesnt transfer over easily most of the time. You usually have to fix quite a few errors or commands that we're removed.

As for starting off, depends what errors your getting. If its throwing any errors about duplicate named things, just simply rename the item in question and this usually solves the issue as long as the code or scripts used dont call the object or sprite or whatever is in question by the exact name.

As far as starting out, id highly suggest looking up some GML (game maker language) tutorials and get very familiar with this. I find most of the time that easy quick things CAN be done with the built in drag and drop but some times its just easier to have the flexibility to write out the code in a step evenT or whatever the case may be. Also run through some of the provided demos and tutorials that come with GMS and just tinker with them and try to change a few things. This helps understand what your doing and how things fit together.

I dont suggest starting with this engine if you are just starting out. Depends on your background though and if you already know a bit of programming or not.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users