Page 1 of 1

Level Decompilation Tools

PostPosted: Mon Oct 02, 2006 10:57 am
by tmcsweeney
Long time no see everyone.

I've pretty much dropped out of the AR scene a while ago, but after being prodded by Andrew I decided to release the tools I wrote for pulling apart and reassembling AR levels. They are pretty hairy, and I don't recommend trying to run them unless you have at least a little experience in programming.

Hopefully someone can take them and either clean them up or use the knowledge they implicitly contain to build some user friendly tools.

Notes:
All of these are pretty rough and ready, they have hard coded paths to my installation of Armadillo run, and the files they manipulate tend to be hard coded as well. You'll need at least Python 2.4 (http://www.python.org/) installed to run them.

BigDillo.py
One of the first scripts I wrote that could generate levels loadable by the game. Reads a valid empty level. Modifies the 'Dillo size and the checksum.

DoubleDillo.py
Much like BigDillo.py. uses and empty level as a base and then modifies it to include multiple 'Dillos

textsum.py
Like above but adds a tutorial style text string to the level.

checksumtest.py
Ignore this. A script I was using at one early point when trying to understand the checksum. included only for completeness.

decompile.py
Another stepping stone on the way to understanding the level format.

DilloStuff.py
Huzzah an (almost) working library that can read and write 'Dillo levels. The only piece that doesn't work correctly (as far as I can remember) is calculating the costs of stretched/compressed links.

Dump.py
Uses DilloStuff to dump text representations of a list of levels

genPicture.py
A partially complete script that given a level name generates an image of it. (was useful during debugging to confirm that I was interpreting things correctly). To make it really useful it needs a bit of work, especially drawing 'Dillos and portals as well as calculating the image transforms based on the level boundaries. Uses the Python Imaging Library (http://www.pythonware.com/products/pil/) to create the image.

MakeRuler.py
useful script that demonstrates using the DilloStuff Library to generate a level. (In this case I was using it to try and measure the stretchiness/cost of various materials)

StaticTest.py
Script that Loads a solution using the DilloStuff library and then checks it against a number of possible cheats that can be detected statically (i.e just by analyzing the level, no running of a physics simulation). The main class of cheats that it catches is where the original level has been modified before starting on the solution, or in fact just using the level editor to solve the level. Where it currently falls over is on the budget (a pretty significant failing). It can't correctly work out the cost of tensioned materials. someone with more patience than I may want to fix this.

PostPosted: Mon Oct 02, 2006 12:19 pm
by Andrew
Many thanks! Working with this now.

PostPosted: Thu Oct 12, 2006 5:40 pm
by tmcsweeney
After my last post Peter Stock sent me a note about the costs of flexible materials and how tension affects them. It contains all the details that should be needed.

I really don't have the time anymore so if anyone is interested in fixing the scripts so that they can correctly determine how much of your budget has been spent, be my guest :)

From Peter:
Code: Select all
linkType     maxSectionLength  minNumSections  stretchFactor  maxExpansionForce  maxCompressionForce
                    m                m              %                 N                   N
rope               0.4               3             0.15              2000                2000
cloth              0.3               3             0.25              2000                2000
metal bar          2                 -             0.03              2000               10000
metal sheet        2                 -             0.03              2000               10000
elastic            0.3               3             0.9               2000                2000
rubber             2                 -             0.5               4000                4000
rocket             3                 -             0.1               1000                1000

m => metres/meters
N => Newtons

maxSectionLength    => maximum length of each sub-section of material (links get subdivided more if this would be violated)
minNumSections      => minimum number of sub-sections for a single link (flexible materials must have at least three to act in a flexible manner)
                       (note that this can be violated in the case of a very small piece of elastic under tension, which can have 2 sub-sections)
stretcFacter        => how much each material can stretch or be compressed before it breaks
maxExpansionForce   => expansion breaking force
maxCompressionForce => compression breaking force


100% tension     => startTension =  0.9
100% compression => startTension = -0.9

(linear interpolation between these two extremes)




float StretchFactor(float tension)
{
  return tension * (tension >= 0.0f ? maxExpansionForce : maxCompressionForce) / (maxExpansionForce / stretchFactor);
}

or, without the ternary '? :' operator:

float StretchFactor(float tension)
{
  float stretchLimit;

  if (tension >= 0.0f)
    stretchLimit = maxExpansionForce;
  else
    stretchLimit = maxCompressionForce;

  return tension * stretchLimit / (maxExpansionForce / stretchFactor);
}


float startLength = length / (StretchFactor(startTension) + 1.0f);
int numSubSections = (int)(startLength / maxSectionLength) + 1;


Re: Level Decompilation Tools

PostPosted: Mon Aug 04, 2008 8:40 am
by Blub Klub
tried to download,doesn't work anymore

Re: Level Decompilation Tools

PostPosted: Mon Aug 18, 2008 3:53 pm
by m3f
Please upload file to some file hosting.

Re: Level Decompilation Tools

PostPosted: Sun Jul 05, 2009 12:57 pm
by John Doe
Seriously. Why do these cool things get taken down. It prevents people from enjoying them. Shouldn`t they have some sort of archive for these things?
:cry: :cry: :? :shock: :( :x :| :?: :!: :!: :!: :( :evil: :evil: :evil: :armadillo:

Re: Level Decompilation Tools

PostPosted: Thu Jul 15, 2010 5:03 pm
by Unw
Salvaged from my old HDD :D