Bennu Game Development

English Forums => General => Topic started by: ruckage on January 24, 2012, 04:57:40 PM

Title: Mode 7 problems - possible bugs
Post by: ruckage on January 24, 2012, 04:57:40 PM
Hello,

I've been getting back into using Bennu again and today I decided to experiment with Mode 7 a bit however things don't seem be working as they should.
I've used mode 7 a bit in fenix and in Div before that so Its possible some things have changed but things just don't seem right and it sadly renders Mode 7 almost unusable in Bennu for anything other than backgrounds which is a shame.

Below is my understanding of how mode7 is started and it's associated global struct(at least how it used to be)
Quote
start a mode 7 window:
Start_mode7(m7_number,file,graph,external_graph,region,horizon);

m7 structure:
Camera: - process id for the camera
Height: - height of the camera
distance: distance of the camera from the process set under camera
Focus: perspective (FOV)
z: z depth of plane
color: color used to fill outside of mode 7 plane

This all seemed to work almost as I remebered but with some fairly major issues:

Focus: Doesn't seem to work.
Height: works with bugs.Process Size:
In Mode 7 under div/fenix you could use the local variable size to adust the size that a processes graph displays at within the mode 7 window.  However size has no affect at all now.
Size_x and  size_y does affect the graph but adversely as setting either of these to a value of greater than 100 stops them scaling within the mode 7 window (the graph appears at full size regardless of the distance from the camera).


That's everything I've noticed so far, I'll write a small test program this evening to try to demonstrate the problems more clearly.

Ruckage


Title: Re: Mode 7 problems - possible bugs
Post by: BlackCurtain on January 24, 2012, 06:43:49 PM
Quote from: ruckage on January 24, 2012, 04:57:40 PM


Focus: Doesn't seem to work.

       
  • FOV doesn't change
  • Anything below 512 the texture on the plain gets increasingly pixelated
  • higher values make processes within the m7 window bigger, lower values makes the processes smaller.


I was kinda confused by the focus variable a first too. What it does is increasing the size/focus of all m7 graphics in the given mode7 view, i.e: m7[3].focus=200; gives all the processes in the 3rd mode7 view the focus of 200.
Title: Re: Mode 7 problems - possible bugs
Post by: ruckage on January 24, 2012, 11:50:12 PM
Hi Black Curtain, and thanks for the reply.

While I agree that's what it appears to do In Bennu I don't think that's exactly it.  And if that was it's purpose it shouldn't have any effect on the resolution of the 3d plain itself. 

After looking some more I think I understand what focus actually does in Bennu...
Here's a screenshot of various focus settings at a screen resolution of 320x240:

(http://i.imgur.com/Vo56V.png)

Notice how the resolution of the 3d plain increases with the focus value.  The optimal setting for a 320x240 display is actually 240.  If you render the same scene at 640x480 with a focus of 240 the display is blocky and the process graphs smaller.  It turns out the optimal setting for 640x480 is a focus of 480.

Therefore I believe the actual use of the focus setting under bennu is for adjusting the game to work correctly at different resolutions.

I'm still sure it's original use back in DIV and Fenix was to alter the actual FOV, though my memory could be hazy.

That still leaves the problem of warping if the camera is set too high and not being able to adjust the size of a processes graph which is pretty important.  And being able to adjust the field of view would be extremely useful though not essential.

Title: Re: Mode 7 problems - possible bugs
Post by: MisterN on January 25, 2012, 03:07:56 AM
can you upload the .prg of that?
Title: Re: Mode 7 problems - possible bugs
Post by: ruckage on January 25, 2012, 09:13:26 AM
Quote from: DoctorN on January 25, 2012, 03:07:56 AM
can you upload the .prg of that?

Hello, do you need a program to understand how to properly use/setup a mode 7 window?  If so I'm happy to write a quick tutorial program but I'll post it to a separate topic to stop this one from getting cluttered.
Title: Re: Mode 7 problems - possible bugs
Post by: FreeYourMind on January 25, 2012, 09:26:15 AM
no code, no help xD
Title: Re: Mode 7 problems - possible bugs
Post by: MisterN on January 25, 2012, 02:03:13 PM
Quote from: ruckage on January 25, 2012, 09:13:26 AM
Quote from: DoctorN on January 25, 2012, 03:07:56 AM
can you upload the .prg of that?

Hello, do you need a program to understand how to properly use/setup a mode 7 window?  If so I'm happy to write a quick tutorial program but I'll post it to a separate topic to stop this one from getting cluttered.

Ive never seen raycasting done before that would be perfect XD
Title: Re: Mode 7 problems - possible bugs
Post by: handsource-dyko on January 25, 2012, 02:03:37 PM
So focus should optimally be the same as the vertical resolution?  What happens if you increase the focus but not the vertical resolution?
Title: Re: Mode 7 problems - possible bugs
Post by: ruckage on January 25, 2012, 02:38:05 PM
Quote from: handsource-dyko on January 25, 2012, 02:03:37 PM
So focus should optimally be the same as the vertical resolution?  What happens if you increase the focus but not the vertical resolution?
Hi handsource-dyko,

That seems to be the case from my testing.  If you increase the focus the objects get bigger but little if anything happens to the plane itself once you go past the optimal resolution.
A 640x480 display with a focus of 480 will exactly match  a 320x240 display with a focus of 240 which is what leads me to think its purpose is for displaying at different resolutions.  I also assume it becomes extremely useful in that respect if you wanted to add a split screen mode to a game.

I also went back to fenix to confirm what focus did in the fenix implementation and the FOV seems to change under that implementation but only after the optimal focus point so I think the FOV changing was possibly a pleasant side effect of a bug (mode 7 was always bugged in various ways under fenix).

Here is mode7 under fenix with high focus and the FOV is clearly changed.
(http://i.imgur.com/kpW6P.png)



Quote from: DoctorN on January 25, 2012, 02:03:13 PM
Quote from: ruckage on January 25, 2012, 09:13:26 AM
Hello, do you need a program to understand how to properly use/setup a mode 7 window?  If so I'm happy to write a quick tutorial program but I'll post it to a separate topic to stop this one from getting cluttered.

Ive never seen raycasting done before that would be perfect XD

Hi DoctorN,  Mode7 and raycasting are different things, mode 7 can only display flat planes, not walls, but I've written a tutorial program for Mode 7 in case it's useful to anyone and will upload it in a minute.
Title: Re: Mode 7 problems - possible bugs
Post by: ruckage on January 25, 2012, 03:10:45 PM
I've uploaded the Mode 7 demonstration program.
You can find it here: http://forum.bennugd.org/index.php?topic=2929.0 (http://forum.bennugd.org/index.php?topic=2929.0)
Title: Re: Mode 7 problems - possible bugs
Post by: MisterN on January 25, 2012, 06:54:16 PM
I can work on the walls
Title: Re: Mode 7 problems - possible bugs
Post by: FreeYourMind on January 25, 2012, 06:58:37 PM
Amazing fenix picture!
Anyway you can use the mod_yeti3dpro if you want with a better 3D look, I release the module this weekend, for Wiz, Caanoo and OpenPandora.
Title: Re: Mode 7 problems - possible bugs
Post by: SplinterGU on January 28, 2012, 11:43:57 PM
then? final report? whats you think are bugs and what not?
Title: Re:Mode 7 problems - possible bugs
Post by: sulheru on October 03, 2013, 10:26:19 AM
I've got a problem with my mode7. m7.horizon doesn't work. this is my source:

import "mod_m7"
import "mod_proc"
import "mod_video"
import "mod_text"
import "mod_map"
import "mod_draw"
import "mod_math"
import "mod_grproc"
import "mod_key"
import "mod_wm"

GLOBAL

   int fichero1;

end

Process Main()
begin

    set_mode(1024,768,16);
    set_fps(50,0);

   fichero1=load_fpg("C:\Users\Theos\Documents\fbmx projects\the_hollow_eve.fpg");

    start_mode7(0, fichero1, 1, 2, 0, 30);

    m7.height = 5;
    m7.distance = 32;
    m7.color = 162;
    m7.camera = id;
    m7.horizon = 30;

    write(0, 160, 0, 1, "Utilice los cursores para moverse");

   //write_int(0, 0, 10, 0, 0, x);
   //write_int(0, 0, 10, 0, 0, y);

    repeat
        IF (key(_right)) angle-=800; END
        IF (key(_left)) angle+=800; END
        IF (key(_up)) advance(6); END
        IF (key(_down)) advance(-6); END
      
      if (key(_d)) xadvance(angle-90000,6); end
      if (key(_a)) xadvance(angle+90000,6); end
      if (key(_w)) m7.height+=4; end
      if (key(_s)) m7.height-=4; end

      if (key(_j)) m7.distance-=4; end
      if (key(_l)) m7.distance+=4; end
      if (key(_i)) m7.horizon--; end
      if (key(_k)) m7.horizon++; end


      if((key(_alt)) && (key(_x))) BREAK; END

      frame;
   until(exit_status)
   let_me_alone();
   exit();
end
Title: Re:Mode 7 problems - possible bugs
Post by: handsource-dyko on October 03, 2013, 01:54:27 PM
I see that you set m7.height = 5 and m7.horizon = 30.


As far as I can remember, the height and the horizon maybe more or less the same thing. I'm not exactly sure but they could possibly interfere with each other. Maybe something has changed but the "height" sets the height of the horizon relative to the top of the screen. "horizon"could be a alias.
Title: Re:Mode 7 problems - possible bugs
Post by: sulheru on October 09, 2013, 12:20:01 PM
You maybe right.
But I think it's a bit strange because in the old DGS, horizon was for modifying the horizon line to make the effect of look up and down, and the height property was the altitud (positive or negative) of the camera from the flor.

I think I could improve some things in the mod_m7 library. Where do I find the source code?
Title: Re:Mode 7 problems - possible bugs
Post by: handsource-dyko on October 11, 2013, 05:32:31 PM
You can find the source code on the main site, under the "downloads" section, there you can find a tarball.
There is also an svn repository. But for sourcecode details, you should ask SpliterGU or Josebita, they are knowlegdable in that area, since they maintain it.