Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Fantasy Earth Zero

Post questions about game models here, or help out others!
Post Reply
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Fantasy Earth Zero

Post 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  
You do not have the required permissions to view the files attached to this post.
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: Fantasy Earth Zero

Post by chrrox »

finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Fantasy Earth Zero

Post 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.
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Fantasy Earth Zero

Post 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
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: Fantasy Earth Zero

Post 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.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Fantasy Earth Zero

Post by howfie »

Faster way to pad to 16.

(pos + 0xF) & ~0xF
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Fantasy Earth Zero

Post by finale00 »

What's that ~ ? Not?
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Fantasy Earth Zero

Post 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.
craver
ultra-n00b
Posts: 2
Joined: Thu Nov 07, 2013 6:46 am

Re: Fantasy Earth Zero

Post by craver »

I hope I can rip this game model... nice thread, very thanks
Bringbackfez
ultra-n00b
Posts: 5
Joined: Wed Sep 03, 2014 5:22 pm

Re: Fantasy Earth Zero

Post 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.
sunny710
ultra-n00b
Posts: 7
Joined: Sun Jul 05, 2015 3:51 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Fantasy Earth Zero

Post by sunny710 »

Could you reupload the script?
Great thanks!
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4284
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Fantasy Earth Zero

Post by shakotay2 »

Simply use the Noesis Plugins link in finale00*s sig to get FantasyEarthZero_mdl plugin. :eek:
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
Post Reply