Page 1 of 1

Fantasy Earth Zero

Posted: Fri Feb 17, 2012 8:12 am
by finale00
Models are mdl files.
Textures stored in tex files. A single tex file may contain multiple textures. Materials index into the texture file.
The tex filename is the same as the model filename.

It is a typical chunk based format.
You have the tag, followed by chunk size, followed by two integers, followed by the rest of the data.

So for example if you have the VTX0 vertex chunk, it'll be followed by the chunk size, the numVerts, and a 0, followed by the vertex buffer.

Unfortunately, some of the chunks have extra padding at the end which is not included in the chunk size.
I have not figured out how this works, so I can't write a general parser and have to parse each chunk manually, then run some silly function to skip the potential padding. Would be nice if there was a way to determine whether there's padding ahead of time so I can ignore all this manual parsing and just parse it like a proper chunk-based format.

Image

Script permalink: http://db.tt/4nOiIdl4
Client DL: available on wiki

bms unpacker:

Code: Select all

get FILES long 
get UNK long 
for i = 0 < FILES 
get NSIZE short 
getdstring NAME NSIZE 
get OFFSET long 
get SIZE long 

log NAME OFFSET SIZE 
next i  

Re: Fantasy Earth Zero

Posted: Fri Feb 17, 2012 1:00 pm
by chrrox

Re: Fantasy Earth Zero

Posted: Fri Feb 17, 2012 6:42 pm
by finale00
Oh, I see it.
Lol no more silly hacking-around code.

Alright updated script to incorporate struct alignment.
It should properly skip things now, unless someone sees something wrong with this algorithm:

Code: Select all

def get_padding(self, start, size):
	'''Return the amount of padding left to read'''

	padSize = size
	if size % 16 != 0:
			padSize = size + (16 - (size % 16))
			
	#calculate current position relative to start of chunk
	relativeOfs = self.inFile.tell() - start

	#calculate the amount of bytes remaining in the chunk
	remain = padSize - relativeOfs
	self.inFile.seek(remain, 1)
Or whether there is a faster way to deal with it.

Re: Fantasy Earth Zero

Posted: Thu Feb 23, 2012 10:08 pm
by finale00
Script updated to load the rest of the models (rooms and monsters).

It was just a different vertex type (52 bytes vs 56 bytes)

Image

Re: Fantasy Earth Zero

Posted: Thu Feb 23, 2012 10:52 pm
by chrrox
your code looks fine you could simplify it by just getting your current pos to 16 and skip if not 0 just makes it one line but i doubt you will see any noticeable speed difference.

Re: Fantasy Earth Zero

Posted: Thu Feb 23, 2012 11:20 pm
by howfie
Faster way to pad to 16.

(pos + 0xF) & ~0xF

Re: Fantasy Earth Zero

Posted: Thu Feb 23, 2012 11:55 pm
by finale00
What's that ~ ? Not?

Re: Fantasy Earth Zero

Posted: Fri Feb 24, 2012 12:37 am
by howfie
Actually negate. Do the bit math to see why it works. It zeroes the lowest 4 bits. Also called bitwise negate, bitwise not, or bitwise complement.

Re: Fantasy Earth Zero

Posted: Wed Nov 13, 2013 7:36 am
by craver
I hope I can rip this game model... nice thread, very thanks

Re: Fantasy Earth Zero

Posted: Thu Sep 04, 2014 7:26 pm
by Bringbackfez
Seeking all & any info pertaining to Fantasy earth Zero. We are a movement bringing back Fantasy Earth zero & lookin g to start a private server. We are aware that Gamepot gave up rights to the NA version Gamania etc & looking for server files.

Re: Fantasy Earth Zero

Posted: Sun Oct 30, 2022 4:10 pm
by sunny710
Could you reupload the script?
Great thanks!

Re: Fantasy Earth Zero

Posted: Sun Oct 30, 2022 5:03 pm
by shakotay2
Simply use the Noesis Plugins link in finale00*s sig to get FantasyEarthZero_mdl plugin. :eek: