• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
June 01, 2024, 07:59:00 pm

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


Editing Maps

Started by SentinalBlade, November 23, 2008, 08:53:18 pm

gomtuu

November 27, 2008, 02:24:41 pm #20 Last Edit: December 31, 1969, 07:00:00 pm by gomtuu
I wrote a pair of programs that split mesh files into pieces and join them again.

To test it out, I split map099 (Main street of Lesalia), added a polygon to the XYZ coordinates chunk, the normal vectors chunk, and the texture data chunk, then rejoined the pieces. I haven't tested the recombined file in-game, but it works in map2gl. Compare the attached screenshot to the original map to see which polygon I added.

It was still not ridiculously easy to add this polygon, since I had to figure out all the coordinates manually and edit the files with a hex editor. But the joiner program performs some simple tests on the chunks when it reassembles them, making it harder to mess things up. It automatically writes the mesh file's table of contents and polygon counters, too, so you only have to worry about the data itself.

Right now, mapsplit and mapjoin are command-line programs and they're not part of map2gl. Would you guys prefer a GUI version? And should I build this functionality into map2gl instead of making a separate program for it?

AuraDragon

November 27, 2008, 02:39:25 pm #21 Last Edit: December 31, 1969, 07:00:00 pm by AuraDragon
*drool*

Zozma

November 27, 2008, 03:50:40 pm #22 Last Edit: December 31, 1969, 07:00:00 pm by Zozma
nice! does this mean that youll be able to make those lesalia maps useable for battles eventually?? id really love to use that mainstreet map for a town riot or something lol
  • Modding version: Other/Unknown
Wiegraf: Draw your sword Ramza!
Ramza: But im a monk!!

nates1984

November 27, 2008, 08:02:05 pm #23 Last Edit: December 31, 1969, 07:00:00 pm by nates1984
QuoteWould you guys prefer a GUI version? And should I build this functionality into map2gl instead of making a separate program for it?

Whatever is easiest for you. Those of use serious about editing maps would accept valuable programs in any form. =P

Zozma

November 27, 2008, 08:04:43 pm #24 Last Edit: December 31, 1969, 07:00:00 pm by Zozma
and those of us who cant use it will accept ppl taking requests for map edits :D LAVA IN DD and polygons in Mainstreet Lesalia
  • Modding version: Other/Unknown
Wiegraf: Draw your sword Ramza!
Ramza: But im a monk!!

Archael

November 27, 2008, 09:34:54 pm #25 Last Edit: December 31, 1969, 07:00:00 pm by Archael
Quote from: "nates1984"
QuoteWould you guys prefer a GUI version? And should I build this functionality into map2gl instead of making a separate program for it?

Whatever is easiest for you. Those of use serious about editing maps would accept valuable programs in any form. =P

agreed

gomtuu

November 28, 2008, 10:36:14 pm #26 Last Edit: December 31, 1969, 07:00:00 pm by gomtuu
Here you go:

mapsplitjoin 0.90 binary version (32-bit Windows) (1.4MB)
mapsplitjoin 0.90 source version (Cross-platform) (6KB)

There's a README file inside that has a lot of helpful information.

The source version requires that you have Python installed, but unlike map2gl, it doesn't require any other weird libraries like PyOpenGL or wxPython, so it should be relatively easy to use the source version if you want to.

As I mentioned, mapsplit and mapjoin are command-line programs. You can also drag-and-drop map files onto them (tested only with the binary version in Windows), so you don't need to use the command line, unless drag-and-drop doesn't work for some reason or you want to see any errors or warnings they output. mapjoin has some data validation tests to help you avoid making bad map files and it tells you what's wrong when it finds a problem, so you could be missing out if you're not able to see its output.

I may eventually incorporate this functionality into map2gl, too.

Cheetah

November 29, 2008, 02:25:43 am #27 Last Edit: December 31, 1969, 07:00:00 pm by Cheetah
This is the moment I have been waiting for! So excellent Gomtuu thank you. I will literally be spending the whole night testing this stuff out and see what I can come up with. Ideally we will be able to get all the maps working and battle ready and release a patch just to do map fixes. No reason we shouldn't make them all work as best we can right?

Getting this stuff intergrated into Map2gl will be good eventually. I mean you do realize by now Gomtuu that I plan to have you write a fully functional map editor whether you are planning on it or not haha.

I will test this stuff out and tell you what I think!

PS: Maybe put this in your Maps thread too.
Current Projects:

Cheetah

November 29, 2008, 05:29:49 am #28 Last Edit: December 31, 1969, 07:00:00 pm by Cheetah
Well my initial excitement is dulled because I can't get this to work. The drag and drop isn't working for me on the exe version and I can't figure out how to get the command line instructions to work. Any advice?
Current Projects:

gomtuu

November 29, 2008, 09:11:49 am #29 Last Edit: November 29, 2008, 10:20:08 am by gomtuu
Quote from: "Cheetah"Well my initial excitement is dulled because I can't get this to work. The drag and drop isn't working for me on the exe version and I can't figure out how to get the command line instructions to work. Any advice?
:( Sorry you couldn't get it working. I tested the drag-and-drop feature with the Windows binary on two computers, so I'm guessing it has something to do with Parallels in OS X.

Since you have Python installed already, you can try running the source version instead. Just open a terminal, go to the folder where you unzipped mapsplitjoin90-src.zip, and type:

python mapsplit.py /path/to/maps/MAP001.9It should say something like:

Reading /path/to/maps/MAP001.9
Writing /path/to/maps/MAP001.9.064.msh.0.tex-tri.xyz
Writing /path/to/maps/MAP001.9.064.msh.1.tex-quad.xyz
(and so on...)

Then, look in /path/to/maps and you should see all the files.

Edit: Of course, /path/to/maps has to be writable for this to work, so it has to be a folder on your hard drive, not on the CD.

gomtuu

November 29, 2008, 09:46:18 am #30 Last Edit: December 31, 1969, 07:00:00 pm by gomtuu
Quote from: "Cheetah"Ideally we will be able to get all the maps working and battle ready and release a patch just to do map fixes. No reason we shouldn't make them all work as best we can right?
There are a few limitations, but hopefully they won't be a big deal.

One limitation is a cap on the number of polygons in a map. In the primary mesh chunk, there can only be 512 textured triangles, 768 textured quads, 64 untextured triangles, and 256 untextured quads. Most maps don't use the maximum number of polygons (some don't even come close), and you might be able to use the animated mesh chunks without any animation instructions to squeeze some extra polygons in.

Another limitation is the fact that you only have 256x1024 pixels of texture data. If that's not enough room to give every polygon a unique texture, you'll have to start re-using parts of the texture on multiple polygons.

The limitation that might actually be a problem is the file size. We should be able to make map files bigger, but only by an average of 1024 bytes. Or, in other words, any number between 0 and 2047 bytes, depending on how full the last sector of each file happens to be. 1024 bytes would give you enough room to add 21 textured triangles, 16 textured quads, 46 untextured triangles, or 36 untextured quads.

It may be possible to allocate more sectors for the map files. A lot of the files in the MAP directory are duplicates, and we might be able to get rid of the extra copies and then use the space they occupied. I haven't looked at it closely yet, though.

Edit: I looked into it a little more closely. Unless my calculations are bad, or unless it ends up not working for some reason, we should be able to free about 43MB by deleting the duplicate files in the MAP directory. This is also good news if we need to expand EVTCHR.BIN, which comes right before the map files on the CD. (Who knows if that file can be expanded, though?)

Cheetah

November 29, 2008, 11:53:04 am #31 Last Edit: December 31, 1969, 07:00:00 pm by Cheetah
You have so much useful information in your head Gomtuu it is ridiculous. But to expand the size of maps or to have more room for new maps, or anything for that matter, wont we need to know the...oh man I don't know the correct term, but the offset value? of everything and readjust it depending on the size changes made?

Oh and as far as my problem getting this stuff working. I think my main issue is that I don't know how to use terminal at all like, how do I even change what folder I am looking in?
Current Projects:

HatterMadigan

February 08, 2009, 10:51:26 pm #32 Last Edit: December 31, 1969, 07:00:00 pm by HatterMadigan
Will This allow you to completely edit a map so one that you won't use ever you could change into something completely different? I was thinking of changing one of the maps into the inside of a brothel for a project I am working on. Or is there a program already made that would better suit me?

SentinalBlade

February 09, 2009, 04:50:03 am #33 Last Edit: December 31, 1969, 07:00:00 pm by SentinalBlade
lol, i think you should look around a bit more...

This program lets you view maps, and split the files apart for editing. you ahve to do it manually, in a hex editor