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

Samurai Shodown: Sen .k2mp

Post questions about game models here, or help out others!
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Samurai Shodown: Sen .k2mp

Post by zaramot »

I'm trying to figure out .k2mp model format.
I have problem with face indices, maybe someone could help me with them?
Here's sample character file http://www.mediafire.com/?8cew8426adpzbw8
And here's basic script for this file, it loads sword model. Thanks in advance.
fname = getOpenFileName \
caption:"Open .K2MP from Mesh folder" \
types:"Samurai Shodown Sen Mesh(*.K2MP)|*.K2MP" \
historyCategory:"Samurai Shodown SenObjectPresets"
f = fopen fname "rb"
clearlistener()

Face_array=#()
Vert_array=#()
UV_array=#()

fseek f 0x1A9A #seek_set
vertcount=readlong f
print vertcount

for x = 1 to vertcount/3 do(

vx=readfloat f
vy=readfloat f
vz=readfloat f
append Vert_array[vx,vy,vz]
)

unk1=readshort f
indices=readlong f
print indices

FaceDirection = 1
f1 = Readlong f +1
f2 = Readlong f +1
for i = 3 to indices-1 do (
f3 = Readlong f +1
FaceDirection *= 1
if (f3 != f1) AND (f3 != f2) then (
if FaceDirection > 0 then append Face_array [f1,f2,f3]
else append Face_array [f1,f3,f2]
)
f1 = f2
f2 = f3
)

fseek f 0x6B76 #seek_set
uvcount=readlong f
fseek f 0x6 #seek_cur

for x = 1 to uvcount do(
tu=readfloat f
tv=readfloat f
append UV_array[tu,tv,0]
)

msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
for j = 1 to UV_array.count do setTVert msh j UV_array[j]
for j = 1 to Face_array.count do setTVFace msh j Face_array[j]

Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))

fclose f
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
Karpati
ultra-veteran
ultra-veteran
Posts: 467
Joined: Thu Dec 07, 2006 11:25 pm
Has thanked: 9 times
Been thanked: 95 times

Re: Samurai Shodown: Sen .k2mp

Post by Karpati »

It is a container file, so it have dozens of meshes. It uses the DirectX Binary format internally: 'xof 0303bin 0032'

After the face counter, every face have the followings:

'Number of Vertices in the actual Face': 4 bytes Long
After this
'Number of Vertices in the actual Face' * 4 bytes Long Pointers

See the converted file..
You do not have the required permissions to view the files attached to this post.
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: Samurai Shodown: Sen .k2mp

Post by zaramot »

Karpati, thanks you very much for help :) Everything works perfect now, I know .k2mp it's container with a lot of models inside. Texture are straight .dds but also grouped in .k2mp file.
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
Karpati
ultra-veteran
ultra-veteran
Posts: 467
Joined: Thu Dec 07, 2006 11:25 pm
Has thanked: 9 times
Been thanked: 95 times

Re: Samurai Shodown: Sen .k2mp

Post by Karpati »

Did you position the subobjects manually in your 3d modeler program?
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: Samurai Shodown: Sen .k2mp

Post by zaramot »

Yes, I positioned them manually in 3ds max.
Making model-import scripts, PM
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: Samurai Shodown: Sen .k2mp

Post by finale00 »

If it's a direct3D file they probably have frame transforms or something.
BobDope
ultra-n00b
Posts: 4
Joined: Thu Dec 22, 2011 10:56 am

Re: Samurai Shodown: Sen .k2mp

Post by BobDope »

As I am a complete noob, could someone post an updated script (like the first one, that imports a sword), that works on the entire character?

I would be very thankful.

If it (or another one) could be used to get the textures as well, that would be great.

Thank you for your efforts and sorry for the inconveniance.
User avatar
Rimbros
ultra-veteran
ultra-veteran
Posts: 495
Joined: Fri Jul 09, 2010 12:23 am
Has thanked: 41 times
Been thanked: 16 times

Re: Samurai Shodown: Sen .k2mp

Post by Rimbros »

zaramot wrote:Karpati, thanks you very much for help :) Everything works perfect now, I know .k2mp it's container with a lot of models inside. Texture are straight .dds but also grouped in .k2mp file.
I really love the Samurai Shodown game, give me lots of memorys, for me the best one its the Samurai Shodown II, afther this game the company fuck the game with RUSH SLASH MODES and back front movement in screen and lots of things to Lost the original game esence, i shure this its Genjuro, hope u can share the characters files i really like them :D .
Renders Art by Rimbros
http://s303.photobucket.com/albums/nn12 ... E/Renders/

Personal Game repository samples, send PM
User avatar
porimac
VIP member
VIP member
Posts: 109
Joined: Wed Sep 08, 2010 4:46 pm
Location: Japan,Kanagawa
Has thanked: 63 times
Been thanked: 14 times

Re: Samurai Shodown: Sen .k2mp

Post by porimac »

Karpati wrote:It is a container file, so it have dozens of meshes. It uses the DirectX Binary format internally: 'xof 0303bin 0032'

After the face counter, every face have the followings:

'Number of Vertices in the actual Face': 4 bytes Long
After this
'Number of Vertices in the actual Face' * 4 bytes Long Pointers
??? hmm its too difficult for my kinky brain [roll]

zaramot. would you be able to rewrite your script?
kjw2254
ultra-n00b
Posts: 5
Joined: Fri Feb 04, 2011 4:31 pm

Re: Samurai Shodown: Sen .k2mp

Post by kjw2254 »

me too :( :(
User avatar
porimac
VIP member
VIP member
Posts: 109
Joined: Wed Sep 08, 2010 4:46 pm
Location: Japan,Kanagawa
Has thanked: 63 times
Been thanked: 14 times

Re: Samurai Shodown: Sen .k2mp

Post by porimac »

hey...at least...would you give me some hints on what to do? :(
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: Samurai Shodown: Sen .k2mp

Post by zaramot »

If you want those model very much, you could use this script to load each part manually

Code: Select all

fname = getOpenFileName \
caption:"Open .K2MP from Mesh folder" \
types:"Samurai Shodown Sen Mesh(*.K2MP)|*.K2MP" \
historyCategory:"Samurai Shodown SenObjectPresets"
f = fopen fname "rb"

fn ReadFixedString bstream fixedLen =
(
	local str = ""
	for i = 1 to fixedLen do
	(
		str += bit.intAsChar (ReadByte bstream #unsigned)
	)
	str
)	

clearlistener()

Face_array=#()
Vert_array=#()
UV_array=#()

--find string "Mesh" remember offset and put it here
fseek f 0x19D4A #seek_set
fseek f 0xE #seek_cur
vertcount=readlong f
print vertcount

for x = 1 to vertcount/3 do(
vx=readfloat f
vy=readfloat f
vz=readfloat f
append Vert_array[vx,vz,vy] 
)

unk1=readshort f
count=readlong f
faces=readlong f	
print faces


for x = 1 to faces do (
fcount=readlong f	
fa=readlong f + 1
fb=readlong f + 1
fc=readlong f + 1
append Face_array [fc,fb,fa] 	
)	

id=readshort f
NameSecSize=readlong f
SecName=ReadFixedString f NameSecSize
fseek f 0xE #seek_cur	
ncount=readlong f	
print ncount
for x = 1 to ncount/3 do(
n1=readfloat f
n2=readfloat f
n3=readfloat f
)

unk1=readshort f
ncount=readlong f
nfaces=readlong f	
print nfaces


for x = 1 to nfaces do (
nfcount=readlong f	
na=readlong f + 1
nb=readlong f + 1
nc=readlong f + 1	
)	
	
unk2=readshort f	
id=readshort f
NameSecSize=readlong f
SecName=ReadFixedString f NameSecSize
fseek f 0xE #seek_cur	
uvcount=readlong f	
print uvcount	

Print ("Last Read @ 0x"+((bit.intAsHex(ftell f))as string))	

for x = 1 to uvcount/2 do(
tu=readfloat f 
tv=readfloat f*-1 
append UV_array[tu,tv,0]
)

msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
for j = 1 to UV_array.count do setTVert msh j UV_array[j]
for j = 1 to Face_array.count do setTVFace msh j Face_array[j]


fclose f
I will not finish script for this game till distant future, models are very low-poly with low textures and format is bit annoying. Maybe you could import them with tools for DirectX Binary format?! I don't know
Making model-import scripts, PM
User avatar
porimac
VIP member
VIP member
Posts: 109
Joined: Wed Sep 08, 2010 4:46 pm
Location: Japan,Kanagawa
Has thanked: 63 times
Been thanked: 14 times

Re: Samurai Shodown: Sen .k2mp

Post by porimac »

really thank you for the help!
textures(PL**TEX1P.K2MP/K2T) is the simple DXT dds formats.
Karpati
ultra-veteran
ultra-veteran
Posts: 467
Joined: Thu Dec 07, 2006 11:25 pm
Has thanked: 9 times
Been thanked: 95 times

Re: Samurai Shodown: Sen .k2mp

Post by Karpati »

[/quote]
??? hmm its too difficult for my kinky brain[/quote]

The DirectX format stores the faces as N-sided polygons:

If 'Number of Vertices in the actual Face'=3 it is a triangle,
If 'Number of Vertices in the actual Face'=4 it is a quadrangle,
etc...

If 'Number of Vertices in the actual Face'=3 you must read 3 long (pointer to the vertex table)
If 'Number of Vertices in the actual Face'=4 you must read 4 long (pointer to the vertex table).
etc...
User avatar
porimac
VIP member
VIP member
Posts: 109
Joined: Wed Sep 08, 2010 4:46 pm
Location: Japan,Kanagawa
Has thanked: 63 times
Been thanked: 14 times

Re: Samurai Shodown: Sen .k2mp

Post by porimac »

thanks, but...
> each part manually
? what 'part'...?
However, I understand that you have lost interest in this topic already.
Thank you so much... :(
Post Reply