[Xenogears] Level viewer in Python

  • Thread starter Thread starter Micky
  • Start date Start date
Status
Not open for further replies.
Just a preview:
blender.jpg

It'll take a bit more work until I can release the code. It looks like I'm hitting an internal Blender limit and it needs to be more user friendly.
 
Last edited:
Sanstitre.jpg


Hello and congratulations for your programming skills.
I have tried it on Windows XP but I always get this error message.
I am using Pygame 1.9.1 and Python 3.1.2.
I have also tried on a Macintosh platform but I also have error returns.
Finally I used the script function in Blender but the same problem occurs.
I have an ISO of the game dumped with Clone CD, should I redump it with Alcool 120 to precise the 2352 option ?

Danke ^_^
 
I'm using Python 2.5 and pygame 1.9.1. Additionally the OpenGL bindings 3.0.1. From the screenshot it looks like you're trying to run the viewer and not the extractor. And no version runs inside Blender, my new (unreleased) version creates a Collada 1.4 file.
The extractor complains if the file is not the correct format. The ISO should be identical between clonecd and alcohol, if it is raw and 2352 byte per sector.

I'm not sure what the error complains about, the indentation looks fine. Are you running the script from the command line or from explorer?

Update: The error is new in python 3. Try 2.5.
Something like this on the command line (in the directory with the iso):
Code: [Select]
Code:
c:\python2.5\python extract.py image1filename image2filename
and then
Code: [Select]
Code:
c:\python2.5\python view.py 666
 
Last edited:
Hello there Micky, still no luck in working your program, something must be wrong with my configuration.

Anyway I have a software that allows to extract all 42 folders of a standard ISO image and also extract all of its content as you can see on the picture.

You mentionned directory 11 and the file 729, which can be extracted among the others.

My question is: on the basis of your code, is it possible to write a collada plugin working this Blender so as to view these 3D levels ?

Xenostudio.jpg
 
Last edited:
Hello there Micky, still no luck in working your program, something must be wrong with my configuration.
If you don't tell me what is wrong I can't help you. Maybe you should start with a command line tutorial, so you know what you're doing?
Anyway I have a software that allows to extract all 42 folders of a standard ISO image and also extract all of its content as you can see on the picture.

You mentionned directory 11 and the file 729, which can be extracted among the others.
All levels are pairs of files, one for the textures and one for the level. The script should pick the correct files if you give it the room number.
My question is: on the basis of your code, is it possible to write a collada plugin working this Blender so as to view these 3D levels ?
Yes, of course, but I wouldn't make it a Blender plugin. Collada plugin doesn't make sense, collada is a file format.
It would probably be easier to contact the authors of your xenostudio program and tell them about this code. Then they can include it in xenostudio.
 
Last edited:
Yes, of course, but I wouldn't make it a Blender plugin.
Yes this :)!. God I loves me some Xenogears tools thanks Micky.
 
Last edited:
Aveh.jpg


I updated the viewer in the first message and the file extractor in the fifth message.

The viewer now exports the scene into a collada .dae file if you press 'c' while the scene is visible. It's quick and dirty but gives you the geometry and textures. The Blender collada plugin doesn't seem to handle vertex colours, or my export of vertex colours is wrong, as they come out as all white. And transparency is not exported, yet. The file doesn't work with Sketchup, though you can re-export it from Blender and import that into Sketchup. But then you seem to lose the textures? The file name is level<room>.dae .
You may want to adjust the far clipping plane in Blender to something big to avoid the scene to be cut off. You can enable textured view, but shaded view is all black because there is no light.
I'll need to dive into the source for the collada plugin at some point to see if I can improve that, but for now I'm too busy.

The file extractor now calculates the size of movie files correctly.
 
Last edited:
Nice.
Which version of pyopengl you use? When I press "N" I got:
Traceback (most recent call last):
  File "model.py", line 1057, in <module>
    main(*sys.argv[1:])
  File "model.py", line 984, in main
    object.draw_normals = not object.draw_normals
AttributeError: OpenGLObject instance has no attribute 'draw_normals'
 
Nice.
Which version of pyopengl you use? When I press "N" I got:
Traceback (most recent call last):
  File "model.py", line 1057, in <module>
    main(*sys.argv[1:])
  File "model.py", line 984, in main
    object.draw_normals = not object.draw_normals
AttributeError: OpenGLObject instance has no attribute 'draw_normals'
Sorry, that's a leftover from the FF7 field model/animation viewer, and probably worth removing that line. Maybe I'll implement it if I adapt it for battle models.
 
Awesome work as usual.
Seems transparency is not working fully :(

Btw, exported textures were all red before I've changed line 558 to
image = pygame.image.fromstring(t, (256, 256), "ARGB", True)
but I am on Linux, so this can be the case.
 
Seems transparency is not working fully :(
The textures contain transparency if you look at them in Gimp. Though I haven't found a way for Blender to pick that up, yet.
Btw, exported textures were all red before I've changed line 558 to
image = pygame.image.fromstring(t, (256, 256), "ARGB", True)
but I am on Linux, so this can be the case.
Probably because I'm on a big endian platform and you're using a little endian pc. Alpha is 255 for most of the pixel, which is red if you reverse the byte order. I'll see if I can fix that if I make another version.
 
Seems transparency is not working fully :(
The textures contain transparency if you look at them in Gimp. Though I haven't found a way for Blender to pick that up, yet.
Btw, exported textures were all red before I've changed line 558 to
image = pygame.image.fromstring(t, (256, 256), "ARGB", True)
but I am on Linux, so this can be the case.
Probably because I'm on a big endian platform and you're using a little endian pc. Alpha is 255 for most of the pixel, which is red if you reverse the byte order. I'll see if I can fix that if I make another version.
Does python have an endianess check?
A quick glance suggests it does  in ctypes. I know this is a problem sometimes dealing with ARM based architectures as well.

Cyb
 
Does python have an endianess check?
A quick glance suggests it does  in ctypes. I know this is a problem sometimes dealing with ARM based architectures as well.
There is a check in the sys module as well. I tried to write the OpenGL texture loader in a way that it works correctly both ways, so I'll have to check if there is a good way to do the same for the .tga writer.
I noticed the VRAM contains NPC sprites and I've got some ideas I want to try. Does anyone know where the party sprites (outside a battle) are?
And has anyone looked into the object instance flags, yet? I'm sure some of them are for placing NPCs, but some must be controlling animations (for example for smoke) and billboards (camera-facing quads).
 
Last edited:
Status
Not open for further replies.
Back
Top