H-Mode7
#1
RMXP : H-Mode7 Engine
Version: 1.4.4


Introduction

This engine is an alternative to the NeoMode7 engine.
While the purpose of the NeoM7 is to emulate the Mode7 feature of the NES, this new engine go further in the 3D feeling.
The main cause of negative feedbacks regarding the NeoM7 is that the map seems too flat, like a paper sheet.
The HM7 engine is a response to these critics. It handles heightmaps so that the rendered map is embossed.
The relief is not very pronounced, so this engine is more suited for worldmaps-like maps, where graphical elements are small.
The script might be hard to master, because it requires specific graphics and it is important to understand how the elements are drawn to create them properly.
Therefore this script is not suited for RM beginners.

Features
  • more 3D, more lag (don't even try this engine if you find the NeoM7 too laggy)
  • adjustable slant angle
  • 360° rotation
  • zoom in, zoom out
  • animated autotiles
  • probably a throng of bugs since it's the first version
  • works with 200 * 200 tiles² maps (HM7 won't activate if the width or height exceeds 200 tiles)
  • open source code for the required dll now available


V1.2 :
  • fixed transparency end blend types for events
  • heightmaps are now in a "Heightmap" folder

  • it's a new DLL (the script won't work with a previous version)

V1.2.1 :
  • added an option to have less black cut elements, but it may lag. A lot.
  • it's a new DLL (the script won't work with a previous version)

V1.2.2 :
  • fixed a bug when transferring from a normal map to a HM7 map.

V1.3 :
LOOK AT THE BOTTOM OF THIS THREAD

V1.3.1 :
  • fixed a bug with angles around 35° (DLL modified).

V1.3.2 :
  • fixed a bug about the altitude of events that are not "Wall" events (DLL modified).

V1.4 :
  • can now handle n layers (but the more layers, the more lag).

V1.4.1 :
  • fixed the problem of events disappearing at the bottom of the screen.

V1.4.2 :
  • fixed a very annoying bug in V.1.4 : crash when going back to the map (from the menu, a battle, etc.)
  • added a camera option [C3] to have the player in the center of the map

V1.4.3 :
  • fixed black areas on events at the bottom of the map
  • fixed the camera option [C3]

V1.4.4 :
  • fixed two bugs causing crash in the DLL


Screenshots

[Image: hm7_00.png]

Download link

HERE (Script + DLL - V1.4)

and

The DLL's source code

How does it work ?

This script modifies a Bitmap object that represents the screen.
It's a 640*480/480*360/320*240 Bitmap object (depending on the chosen resolution),
contained in a sprite that is displayed over the panorama but below all other sprites.
For each pixel of this bitmap is calculated a corresponding map pixel to display, by a 3D projection of a textured polygon (the map).
Then a vertical offset is determined depending on the slant, the ground heightmaps and the tiles heightmaps for the three layers.
All the pixels between the original position and its offset are drawn : that makes the map "embossed".

Heightmaps :
A heightmap is a greyscale picture that contains heights data for each pixel.
Black areas mean no height offset, whereas white areas mean a maximum height offset.
The maximum height offset has a fixed value of 32 pixels, so a tile with an entirely white heightmap will be rendered as a cube.
- ground heightmap
You can associate a heightmap to a RMXP map (optionnal) that will be used to add an embossing effect independently to the 3-layers tiles.
The heightmap is automatically stretched to the dimensions of the RMXP map, by using a linear interpolation.
Ground heightmaps files, named "Heightmap_XXX" (XXX representing an identification number), shall be placed in the "Pictures" folder.
- tiles heightmaps
They are gathered into a set similar to the map tileset. A "heightmapset", named "[tileset name]_Hmap" and placed in the "Tilesets" folder, is mandatory for each tileset used in a HM7 map.
- autotiles heightmaps
It is the same system here. A heightmap that corresponds graphically to the autotile file, named "[autotile name]_Hmap", can be placed in the "Autotiles" folder (it's optionnal).

Is there an easy way to create heightmaps ?
Nope.
For simple patterns you can use your favorite image manipulation program.
For more complex objects, a solution is to use a 3D modeler, then apply a gradient texture and retrieve a top view picture.

Vertical textures :
By default, when drawing a screen pixel, all pixels between the "ground" (altitude 0) and the computed altitude are filled with the color of the target pixel.
When the slope is too important (vertical walls, by example), it is inelegant :

[Image: hm7_01.png]

To solve this problem, you can use a texturemap per tile : it is a picture composed of five 32*32 px² areas : a colormap and four different vertical textures (one for each side).

[Image: hm7_02.png]

The colormap is a four-color area (red, green, blue, black) that coincide with the tile : for a screen pixel, when the source pixel of the map is determined, the correponding pixel on the colormap
indicates which vertical texture shall be applied (Red => first texture, Green => second texture, Blue => third texture, Black => fourth texture).
A transparent pixel in a texturemap means that the color of the source pixel of the map will be used.

[Image: hm7_03.png]

Texturesets must be placed in a "Tilesets/[tileset name]_Textures" folder, and must be named "Texture_[tile index]".
The tile index represents its position in the tileset (the first index is 0).

NEW (01/01/2011) : DerVVulman's help file for textures : Help file

- autotiles textures
There is only one colormap for all autotiles, named "Texture_Auto". It must be placed in a "Autotiles/Textures" folder (it is mandatory).
Texturesets, containing only the four vertical textures, must also be placed in that folder. They must be named "Texture_[autotile name]".

Misc :
- The automatic lighting effect is not adjustable for the moment (but you can deactivate it). That means that shadows have always the same orientation and length.
- As character sprites are always above the HM7 sprite, they are not used to display characters (otherwise characters could not be behind map elements).
Characters are rendered directly in the HM7 bitmap, and thus there are limitations : transparency and blend type are ignored.
- By default characters are drawn at the maximal altitude of their coordinates : ground + 3 layers.
You can activate the bush flag in the tilesets tab of the database to have the altitude of the tile ignored when drawing characters.

Instructions

What is required :
- the script (above main, as usual)
- the file MGC_Hmode7.dll at the root of your project
- specific autotiles, tilesets, textures and heightmaps

To activate the H-Mode7, you must add [HM7] to the map name.
The following tags are optionnal :
[HMAPXXX] : XXX is the identifier of the ground heightmap that must be used for the map
[#XX] : XX is the angle of slant (in degree) : 0 -> 80, 0 by default
[%XXX] : XXX is the angle of rotation (in degree) : 0 -> 359, 0 by default
[X] : enable horizontal map looping
[Y] : enable vertical map looping
[DA] : deactivate animated autotiles
[AFXXX] : XXX is the animations period for animated autotiles : 1 -> 999, 20 frames by default
[DL] : deactivate automatic lighting effects
[RX] : X = 1 -> high resolution (default)
X = 2 -> medium resolution (to increase performance)
X = 3 -> low resolution (to drastically increase performance)
[CX] : X = 0 -> no vertical offset (default)
X = 1 -> vertical offset so that the camera do not cut the ground at the bottom of the screen.
Should be used only when the horizon is visible.
X = 2 -> vertical offset so that the camera do not cut the map at the bottom of the screen.
Should be used only when the horizon is visible.
X = 3 -> vertical offset so that the player is always in the center of the screen.
[DF] : deactivate the filter (better quality, drastically decrease performance)
[HF] : refresh the map every two frames (less fluent, increase performance)
[E] (V.1.2.1) : edmhotta's request to have less cut elements at the bottom of the screen. May cause massive lag, especially when rotating.
[DB] (V.1.2.1) : cut elements at the bottom of the screen are not filled with black (but they're still cut).

You can also associate a keyword to a configuration at the beginning of the script.
For example, with the following command :
HM7::Maps_Settings["MyKeyword"] = ["#60", "X", "HMAP3"]
if a map name contains "MyKeyword", then the HM7 will be activated, with a slant angle of 60 degrees, horizontal looping,
and using the picture "Heightmap_003" as ground heightmap.

Commands

- To set a new angle of slant (0~80) :
$scene.hm7_set_alpha(new angle)
To slide progressively into a new angle of slant :
$scene.hm7_to_alpha(new angle, speed)
To increase/decrease the slant :
$scene.hm7_increase_alpha(value)

- To set a new angle of rotation (0~379) :
$scene.hm7_set_theta(new angle)
To slide progressively into a new angle of rotation :
$scene.hm7_to_theta(angle, speed, dir)
To increase/decrease the angle of rotation :
$scene.hm7_increase_theta(value)

- To set a new zoom level (in percentage - default = 100) :
$scene.hm7_set_zoom(new value)
To slide progressively into a new zoom level :
$scene.hm7_to_zoom(value, speed)
To increase/decrease the zoom level :
$scene.hm7_increase_zoom(value)

- To change the horizon light fading :
$scene.hm7_set_fading(red, green, blue, flag)
flag = 1 : the color determined by (red, green, blue) will be added to the horizon line
flag = 0 : the color determined by (red, green, blue) will be substracted to the horizon line

- To set the altitude of an event :
add a comment in the commands list with : "Altitude X", where X is the
height value ("Altitude 64" will draw the event 64 pixels above its original position)
- To set the altitude of the player :
use : $game_player.altitude = X
- To have a fixed altitude for an event (not dependant on the maps heights) :
add the comment "Floating" in the commands list
- To have a fixed altitude for the player :
use : $game_player.floating = true

VERSION 1.3 :
  • "wall" events : the class HM7::Surface has some major changes, and the DLL part is entirely rewritten.
    Add a comment "Wall" in the commands list (and check the "Direction Fix" flag) :
    [Image: 2011-09-26_143357.png]
    You can specify the angle with the comment "Angle XX", where XX is an angle value in degree.
    Example : "Angle 30 "
    [Image: 2011-09-26_144559.png]
    By default, the character is drawn on the center of the tile.
    You can specify new coordinates for the middle of the character with the comment "Pos X Y", where X and Y are respectively the horizontal and vertical positions in pixels (between 0 and 32 -default values are X=16 andY=16-)
    Example : nothing specified then "Pos 32 0"
    [Image: 2011-09-26_144740.png]
    [Image: 2011-09-26_144822.png]
  • animated vertical textures : use a picture with a width of n * 160px (or 128px for autotiles) for the vertical texture.
    example (normal then auto) :
    [Image: Texture_040.png]
    [Image: Texture_Auto99.png]
  • lower resolutions handling : for those who use smaller resolutions (PSPDS users, for example), you can now specify the part of the screen that will be used to render HM7. At the bottom of the part "---- MGC : H-Mode7 ----", you can find the constants WIDTH, HEIGHT, X and Y. They specify the dimensions and the position of the HM7 rendering.
    For example :
    WIDTH = 288
    HEIGHT = 216
    X = 200
    Y = 100
    [Image: 2011-09-26_145527.png]
    Using a small resolution can greatly decrease the lag.
  • included the [OV] feature : add [OV] in the name of the map, and add a comment "OV" in events you wish to be resized.
    The zoom value can be set with OV_ZOOM, at the bottom of the part "---- MGC : H-Mode7 ----"
  • fixed a bug with several transluscent events
  • included pivot manipulation (a NeoM7 feature) :
    $scene.hm7_set_pivot(new value)
    $scene.hm7_to_pivot(new value, speed)
    $scene.hm7_increase_pivot(value)

Author's notes

For the moment there is only a handful of tileset elements compatible with this script.
It would be really great if anyone that creates such elements decides to share them.

Open Source DLL!

Now available, the source code for the DLL which handles the specially rendered
graphics is now available. The request for the source code was made by
finalholylight, and is now available in the link here, and just below the demo's own
download link.
The DLL's source code

[Image: tM8MQRo.png?1]

Thanks

- DerVVulfman for his help file about textures
Some scripts :
Working on :
Reply }
#2
Dude, I'd just like to say, YOU FUCKING ROCK! ( sorry for the bad language, but, it was necessary )
Reply }
#3
I've only checked out the demo so far and it is incredible! MGC, once again, you never cease to amaze me with your scripting ability. I am loving this! *goes to open the project and play around with the editor*
Reply }
#4
HOLY JEEZ!!! That's a beats up all of scripts then I see before!!! ShockedShockedShocked
"The things I always protect never change!" - Sakata Gintoki, Gintama.
"Two people dying separately? No. If we die, we'll die together." - Suigintou, Rozen Maiden.
And sorry for my mistakes in English words, if I do it.
Reply }
#5
Thank you all for your support !

With a few imagination, it's possible to obtain a T-RPG map (it's just a test) :
[Image: hm7_05.png]
Some scripts :
Working on :
Reply }
#6
Tried out the demo. I came in my pants and then your script slapped me in the face and called me a pussy.
The only problem I have with it is the fact it doesn't re-orient the direction controls when you rotate the map.
[Image: style7,Kristovski.png]
Reply }
#7
> Kristovski : I updated the demo with a special add-on for you. That should solve your problem.
Some scripts :
Working on :
Reply }
#8
wow mgc what an achievment! I cant wait to try this out when I get home! congratulations!
Current Projects: Concepting and R&D
Reply }
#9
*DerVVulfman faints*

OMG. Do I have to update my system with this? Unbelievable!

*DerVVulfman goes to scripting*

Heightmaps only reach 32px in height? Could a later version support other heights so one could be able to craft nice wall enclosures? And seeing how you have MGC_ISO Engine in your 'working on' sig, I don't see that combining the two would be difficult now.

That chase-view plugin... Nice...
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#10
Quote:Heightmaps only reach 32px in height? Could a later version support other heights so one could be able to craft nice wall enclosures?

I think that's possible (but not beyond a height of 8 tiles). I just made some tests with all heights doubled, and there seemed to have no supplementary lag.
The main problem is the configuration. Perhaps I'll have to create a small external tool to associate tiles with theirs heights and textures.

Quote:And seeing how you have MGC_ISO Engine in your 'working on' sig, I don't see that combining the two would be difficult now.

For the moment, it's still really difficult, because the ISO engine works with a 3D gameplay, wheareas the HM7 modifies only what is displayed on the screen.
Some scripts :
Working on :
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   H-Mode7 Visual Equipment Chaotech Games 8 36,782 03-30-2017, 01:58 AM
Last Post: wrathx
   H-Mode7 Caterpillar Chaotech Games 8 18,961 03-10-2017, 12:19 AM
Last Post: Lizzbutt
   Lycan ABS / MGC Mode7 Edit Patch DerVVulfman 2 9,473 10-18-2015, 07:12 PM
Last Post: DerVVulfman
   Lycan Enemy Bars / MGC Mode7 Edit Patch DerVVulfman 0 5,791 06-12-2014, 04:05 AM
Last Post: DerVVulfman
   MGC's Mode7 Edit DerVVulfman 0 5,501 06-12-2014, 03:49 AM
Last Post: DerVVulfman
   Mode7 MGC 1 12,464 12-30-2013, 05:43 AM
Last Post: DerVVulfman
   H-Mode7 / UMS Patch DerVVulfman 1 6,890 07-29-2012, 04:12 AM
Last Post: MetalRenard
   Zenith TBS / MGCaladtogel's Mode7 Patch DerVVulfman 0 8,649 03-05-2008, 06:24 PM
Last Post: DerVVulfman



Users browsing this thread: 3 Guest(s)