Reverse Engineering Lugaru assets

The place to discuss all things Lugaru.
User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Mon May 26, 2008 8:13 am

I think I know a way to make .solids that have arbitrary shapes, do not exclusively consist of cubes and don't make Lugaru crash.

Begin with a cube and extrude a face. Approximate your desired shape by extruding the cube's faces over and over.

Subdividing:
Whatever you do, don't subdivide triangles or quads adjacent to triangles.
Don't subdivide quads unless you subdivide each edge 3 times, for example with a knife subdivide (Shift-K in blender).

When you're done, smoothen the vertices until you're happy.

You can extrude quads as well as triangles. Just don't forget to convert all quads to triangles when you're done (Ctrl-T in blender).

Either use quads or triangles, nothing else.

Why is that so? I don't know. I just did some modeling to try and feel out the boundaries of this mess; that's how I successfully made working models all the time.

You can still join meshes that are made with these rules in mind.

An example:
Image

Edit: Also, you can translate / scale / rotate vertices, edges and faces as you wish.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

First release of X2Solid

Post by rudel_ic » Mon May 26, 2008 10:15 pm

Alright, here's release 0.1 of X2Solid. I quote the ZIP comment:

Code: Select all

X2Solid converter bytecode v0.1 2008-05-27 rudel_ic

Converts specific .X files
to David Rosen's .SOLID format,
as featured in
Lugaru - The Rabbit's Foot (c) Wolfire Software.

You need Java to use this.

Windows users:
You can drag 'n drop multiple .X files onto the batch file
DRAG_X_FILES_HERE.bat
if the batch file and .class files are in the same directory.

Do NOT rename DRAG_X_FILES_HERE.bat, as tempted as you may be.

Whitespace in paths and filenames is not a problem.

Command line invocation:
java X2Solid INPUT_FILENAME

If the INPUT_FILENAME contains whitespace, you need to use double quotes.

For detailed instructions, consult http://wolfire.com/forums

Thanks: David, zip, Makrond
Get it here.

All previously mentioned limitations still apply.

Have fun!

User avatar
Count Roland
Posts: 2937
Joined: Tue Sep 25, 2007 11:15 pm
Location: Galapagos Islands, rodeoin some turtles.
Contact:

Post by Count Roland » Mon May 26, 2008 10:41 pm

Edit: thanks I feel kinda dumb not knowing that, I should really learn some code stuff, at the very least html....
Last edited by Count Roland on Tue May 27, 2008 4:26 am, edited 1 time in total.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Mon May 26, 2008 10:52 pm

This IS a mac release. You need Java. This software works on all platforms that support Java.

Note that you'll have to invoke the converter via command line if you're on a non-Windows platform.

Open a shell (sometimes called terminal).

Go to the directory you've unzipped the archive to.
The command to enter a directory is

Code: Select all

cd DIRECTORY_NAME
To exit a directory, use

Code: Select all

cd ..
To list the content of the current directory, use the command

Code: Select all

ls
or

Code: Select all

dir
Once you're in the right directory, type

Code: Select all

java -cp . X2Solid INPUT_FILENAME
where INPUT_FILENAME is the filename of your .x model.
It helps if you've copied the .x to that directory beforehand, that spares you the hassle of having to enter the full path to it.
If your model is called Power.x, your resulting .solid is called Power.x.solid.
The resulting .solid always ends up in the same directory as the input file.
There's a bunch of output when you use the converter; errors are also reported, they are called Exceptions. If you get one of those, post it here and I'll help you out.

Once the converter has done its job, you can follow the remaining instructions (17. and above) in the blender howto thread's first post.

Tell me if you get it to work. Thanks.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Mon May 26, 2008 11:32 pm

Hmm, I tried to add info about this on the wiki, but there's some error. I registered an account, but it doesn't work.

Here's what I wrote (very small to avoid messing up the thread):


Lugaru models are called .solids. They are located in the folder Lugaru/Data/Models/

There are at least 3 classes of solids:

'''-- Inanimate'''

'''-- Animated'''

'''-- Weaponry'''


Currently, it is only possible to replace inanimate solids.


You can replace all 12 different objects you can place on the map in the debug mode (not including players or weaponry).

That includes, but is not limited to

'''-- Box'''

'''-- Chimney'''

'''-- Platform'''

'''-- Rock'''

'''-- Weird'''


...and so on.


rudel_ic wrote an X-to-Solid converter in Java.

X is Microsoft's Direct3D model format. It is widely supported by virtually all modeling programs.

So what you want to do is

'''-- Make a model in your modeling program'''

'''-- Export that to the X format'''

'''-- Convert the X to Solid with rudel_ic's tool'''

'''-- Backup any existing model'''

'''-- Rename your custom Solid to the name of the model you just backupped'''


Then, you can start the game in debug mode, open a map, switch to map editing, browse to your custom model's new name and insert it at Turner's current location.

Note that you will have to adjust the scale and that the model may be rotated by 270 degrees compared to your modeling software's view.


Links you need to know to get to working models:

-- [http://lugaruspace.50megs.com/tools The X2Solid release site]

-- [http://wolfire.com/forum/viewtopic.php?t=3844 The blender howto thread]

-- [http://wolfire.com/forum/viewtopic.php?t=3832 The reverse engineering thread] ''(also contains detailed instructions for using X2Solid)''


Where you can show others your cool new models:

-- [http://wolfire.com/forum/viewtopic.php?t=3847 The modeling reel thread]


There are limitations for models. Following specific rules is the key to get a working inanimate Solid.

Refer to the blender howto thread and live and breathe all the information that is there.


Do not hesitate to ask questions on the forums.


User avatar
Count Roland
Posts: 2937
Joined: Tue Sep 25, 2007 11:15 pm
Location: Galapagos Islands, rodeoin some turtles.
Contact:

Post by Count Roland » Tue May 27, 2008 3:27 pm

whenever I type in java -cp . X2Solid INPUT_FILENAME it gives me something like Exception in thread "main" java.lang.NoClassDefFoundError: X2Solid I think I'm making some simple mistake but still some help would help.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Tue May 27, 2008 8:36 pm

That's because you're not in the folder where X2Solid.class is. You have to type it in that folder.
That's what the exception tells you, by the way: NoClassDefFoundError: blah -> Couldn't find the class definition for blah.

User avatar
Count Roland
Posts: 2937
Joined: Tue Sep 25, 2007 11:15 pm
Location: Galapagos Islands, rodeoin some turtles.
Contact:

Post by Count Roland » Tue May 27, 2008 9:44 pm

yeah this stuff is just confusing me I might as well just not do it or something the X2Solid.class is in the X2Solid folder which is in the desktop which is as far as I can go for some reason.... meh!

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Tue May 27, 2008 11:10 pm

Sorry, the forums are very slow to load for me right now, so I'm having trouble replying.

I don't know how the Mac OSX desktop works, so I can't tell you why you can't go into the X2Solid folder from a terminal. It could have to do with reading rights or the folders on the desktop could be actually links, but that's me guessing.

You could try copying all .class files in X2Solid directly on the desktop and see if it works then when you enter java -cp . X2Solid FILENAME when you're in the Desktop folder.

You could also try moving the X2Solid folder somewhere else and then go there with the terminal, maybe that works.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Tue May 27, 2008 11:29 pm

Oh, did you unzip X2Solid.zip? You need to do that. I thought that goes without saying, but maybe you just didn't do it..

You can't cd into zip packages, only into folders.

You can, by the way, unzip zips from the terminal.

Simple introduction to the terminal, along with the unzip command: http://jimmont.com/resrc/osx.htm

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Wed May 28, 2008 4:11 am

Okay, making stuff you can run on is not easy. The collision detection tends to freak out all the time and once you're on the .solid, the framerate goes dooown.

So for example, I built this:

Image

When I rotate it to any non-zero degree around the Y axis in-game, the upper part (big cube part on the right) only collides half the way.

When I insert more than one of such stairs into a level, then go onto the diagonal part and look straight towards the upper part, the framerate goes to 1 fps. Maybe some depth culling problem as it's tied to the viewing frustum orientation, but we'll never find out, I suppose.

It thus is really necessary to thoroughly test custom models you can run on whether the game actually can handle them.
In most cases, you'll find out it won't. I did some skewed cubes as stairs as well; they also killed the framerate, but at least collision detection was accurate.
Skewed cubes - that's 12 faces. Maybe the collision detection algorithm has a termination condition for going through polys that doesn't go well with parallel opposite faces or whatever.. But I can't say for sure.

User avatar
Count Roland
Posts: 2937
Joined: Tue Sep 25, 2007 11:15 pm
Location: Galapagos Islands, rodeoin some turtles.
Contact:

Post by Count Roland » Wed May 28, 2008 3:30 pm

any zipped files automatically unzip when I download them, but yeah I'll try out some of the stuff you suggested

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Post by rudel_ic » Wed May 28, 2008 6:37 pm

Count Roland wrote:any zipped files automatically unzip when I download them
..wow. That's pretty stupid. Is that default on Macs?

User avatar
Makrond
Posts: 498
Joined: Mon Jun 25, 2007 11:34 pm

Post by Makrond » Wed May 28, 2008 10:22 pm

Sweet. I gots me some credit :D

Anyway, this is seriously frikkin' awesome. I'm glad you finally managed to crack it - more or less.

User avatar
Count Roland
Posts: 2937
Joined: Tue Sep 25, 2007 11:15 pm
Location: Galapagos Islands, rodeoin some turtles.
Contact:

Post by Count Roland » Thu May 29, 2008 12:06 am

I don't know it was default on mine though

Post Reply