Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Omzy on 2010-09-01 04:33:25

Title: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 04:33:25
Hello all, my first post here.

I am working on a total conversion ff7 remake for Fallout 3 with some others at the MDMD Forums:http://z9.invisionfree.com/industrialpolygons/index.php?act=idx (http://z9.invisionfree.com/industrialpolygons/index.php?act=idx). So far I've managed to get a working battle menu UI into the game and I was about to start working on developing the battle system. A friend of mine wants to help by starting work on the environments. However, I realized that I needed a complete world to drop cities and towns into before he can build them (for technical reasons). I made a heightmap using a flat screenshot of the ff7 world map and then hand-drew the mountainous regions and applied some photoshop filters to give them slopes. The problem is, its just not as accurate as I would like it to be.

What I really want is to get the original 3d map from the game and render it into a 4096x4096 heightmap. Then it will be absolutely true to the original. I'm kind of like you guys in my craziness to get things done properly, so that's why I came here to ask for help.

This dead thread: http://forums.qhimm.com/index.php?topic=5825.0;nowap (http://forums.qhimm.com/index.php?topic=5825.0;nowap)
+
This wiki article: http://wiki.qhimm.com/FF7/WorldMap_Module (http://wiki.qhimm.com/FF7/WorldMap_Module)

are the basis for my interest here.

Tonberry actually rendered the full map and posted this image:
(http://bin.mypage.sk/FILES/ff7wm2.JPG)

As I said, I need it 4096x4096, so I'll need to render it on my machine. What I'm asking is for help taking the wm0.map and wm2.map files from data/wm, parsing them for their mesh data, and rendering this somehow. I am educated enough to follow instructions and I know a bit of java/c++, but I have never used anything like OpenGL or done any hex editing for that matter.

Basically, I don't want to spend a week doing this when someone else with skills can accomplish it in a few hours. It is the only low-level part of my project (I work with functions like Player.Cast FireBall Enemy  ;D)

Thanks in advance for any replies,

Omzy

Disclaimer: I own multiple copies of ff7. I'm not attempting to rip any game assets for direct use. My profit-less distribution is intended to meet all legal requirements upon eventual release.
Title: Re: Need help rendering the FF7 World Map
Post by: Shankifer on 2010-09-01 05:36:27
Be careful with what you do and what you post here due to copyright infringement stuff.

Just a heads up, best bet is to keep questions vague  ;) ("Can I get a 3D map? 4096x4096 ect)

I really don't have an answer to your question, just trying to catch a possible problem before it hits big and you get disappointed with your experience on qhimm. :)
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 05:40:15
Yah, I've been reading other posts where people keep getting shot down.

Added disclaimer to main post.
Title: Re: Need help rendering the FF7 World Map
Post by: Shankifer on 2010-09-01 05:44:33
Believe it or not, sometimes it helps to cover yourself just in case. not trying to be a prick, just speaking from experience.  :)
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 05:45:45
Lol, I understand, thanks for lookin out  :P
Title: Re: Need help rendering the FF7 World Map
Post by: Micky on 2010-09-01 06:43:10
It may be easiest to write it out as a .obj file and render it with a 3d program. Then you don't need to mess with OpenGL or with writing your own software rasteriser.
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 07:12:52
It may be easiest to write it out as a .obj file and render it with a 3d program. Then you don't need to mess with OpenGL or with writing your own software rasteriser.
This is the kind of brilliantly simple advice I'm looking for. That would save me tons of time if I can just copy the info into the right format. So the problem now is that each set of vertices is LZSS compressed, but the rest of the file isn't. Any ideas how to get the uncompressed code out?
Title: Re: Need help rendering the FF7 World Map
Post by: nfitc1 on 2010-09-01 13:11:15
There are lots of ways to decompress LZS files (http://www.mediafire.com/?hwyyk2zjjjj). If you're looking into writing your own then you could check the wiki's info on the format (http://wiki.qhimm.com/FF7/LZS_format). Once you understand the format then making a decompressor is simple.
Title: Re: Need help rendering the FF7 World Map
Post by: battlemage210 on 2010-09-01 13:40:50
as painful as starting from NOTHING on a project like this would be... i think that would be a very good way to go at this. simply having something like a similarly shaped peninsula can really hurt... having the same continents and islands is just begging for trouble.
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 14:29:02
There are lots of ways to decompress LZS files (http://www.mediafire.com/?hwyyk2zjjjj). If you're looking into writing your own then you could check the wiki's info on the format (http://wiki.qhimm.com/FF7/LZS_format). Once you understand the format then making a decompressor is simple.

I think that first link is dead. I think I'll look into the format on it then, thanks!
Title: Re: Need help rendering the FF7 World Map
Post by: nfitc1 on 2010-09-01 16:52:20
There are lots of ways to decompress LZS files (http://www.mediafire.com/?hwyyk2zjjjj). If you're looking into writing your own then you could check the wiki's info on the format (http://wiki.qhimm.com/FF7/LZS_format). Once you understand the format then making a decompressor is simple.

I think that first link is dead. I think I'll look into the format on it then, thanks!

...No it's not. Can you not access Mediafire?
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 19:58:21
Oh. Weird, wouldn't let me download it this morning, got it now. Let me see what this thing is...

Ok, its a decompressor for lzs files, but since the .map files only contain segments that are lzs compressed, I think I'll just write my own decompressor and stick it in a loop. If that fails, I'll use a loop to cut out the compressed segments and write them to their own lzs files and then decompress those with the prog.

I'll post what I accomplish. Might be a useful little tool for file previewing .map files if I code it efficiently enough.

Update:
Ok, I'm assuming I should start with this skeleton (copied from a tutorial site)
Quote
// reading a complete binary file
#include <iostream>
#include <fstream>
using namespace std;

ifstream::pos_type size;
char * memblock;

int main () {
  ifstream file ("example.bin", ios::in|ios::binary|ios::ate);
  if (file.is_open())
  {
    size = file.tellg();
    memblock = new char [size];
    file.seekg (0, ios::beg);
    file.read (memblock, size);
    file.close();

    cout << "the complete file content is in memory";

    delete[] memblock;
  }
  else cout << "Unable to open file";
  return 0;
}
Is this a correct assumption?
Title: Re: Need help rendering the FF7 World Map
Post by: pyrozen on 2010-09-01 21:57:59
i know this may be beyond the scope of this project right now, but would if it is possible to generate a 3d mesh from the .map files for export, would it also be possible to alter the mesh and repack it for use in FF7?
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 22:03:25
On first glance, I don't see why not. You'd have to also map the textures right, though, in addition to the mesh data. My program will just be exporting mesh data.
Title: Re: Need help rendering the FF7 World Map
Post by: pyrozen on 2010-09-01 22:15:25
true, i realize your not trying to tinker with FF7 itself. As far as viewing the mesh, the viewer Reeve does an admirable job considering its the ONLY tool every developed to do so.
http://ncs.millenia3d.net/etc/Reeve.zip
it may or may not help you out, its also kinda a bear to get working.

lee
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 22:28:36
Arg! Its so close! It actually displays the wireframe from a 1st person point of view. Unfortunately, I need an overhead view with height coloring. For a minute there, I thought I was home free, lol.
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 22:49:01
Ok, for the sake of laziness, I think I can get away with writing each compressed section to its own file and then using the ficelzs command:

lzs.exe -d *
Decompresses all files in current folder (uses filename.dec as the output for each one)

Then another program can recombine the data into the obj format.
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-01 23:52:00
I need help with this (C++):
I need to run an exe from my code, so I am using
Quote
system ("lzs.exe -d -q mesh.lzs")
Thats fine and dandy, but now I need to wait until lzs.exe is finished making the decompressed file. So what command would I use to check when it is finished? I been googling but its not the easiest thing to search for.

EDIT: Apparently the system call is 'blocking', so my program halts execution until lze.exe is finished. Quite a fortunate limitation  :D
Title: Re: Need help rendering the FF7 World Map
Post by: obesebear on 2010-09-02 00:57:45
Triple post!! Winnar!
Title: Re: Need help rendering the FF7 World Map
Post by: Omzy on 2010-09-02 01:02:27
Oh, sorry. Will use 'modify' from now on.

FINISHED: See http://forums.qhimm.com/index.php?topic=10717.0 (http://forums.qhimm.com/index.php?topic=10717.0) for .exe and source.