Ship classification script

    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    I am currently working on a small Ruby library called Rubatom with the goal to provide an abstract and simple-to-use interface for StarMade files.

    This interface is not remotely finished, but it already supports reading of the old and new (introduced in the last update) file format. A significant part of the API is a ship classification API, a first version is already finished.


    The tarball includes two runnable Ruby scripts, located in the bin directory.

    Note: There currently is no graphical user interface, both are command line only.



    Installation

    Installation is pretty much straight forward. You need Ruby. Download the latest release (v0.2.1 at the time of this writing) and extract it to a directory of your chosing. Open a terminal, from there enter the directory where you extracted the files to. Run the following command (will install the gem trollop that I use for options parsing).


    bundle install


    ... and you're good to go!



    Ship classification

    The basic usage is simple.


    rubatom-classify /path/to/StarMade/blueprints/some_saved_blueprint


    Run rubatom-classify --help for a complete help page.

    The script will take your ship as input and will output a classification of the following format: -

    The series and the chassis number are agnostic with regard to the ship's interior, they depend solely on the exterior. The series also allows for slight modifications on your hull, so hopefully ships with similar hulls have the same series, but another chassis number.

    The type will be something like Fighter or Frigate.

    For example, if I run the script on ships posted here and here, I get these results:

    • X-wing: Y-82 Fighter
    • YT-1300: PK-320 Shuttle
    • YT-1300 "Millenium Falcon": PK-320 Light Freighter
    • Ebon Hawk: NK-331 Light Freighter
    • Devil: R-22 Fighter
    • Smalltooth: HX-110 Heavy Raider



    Projection


    rubatom-project /path/to/StarMade/blueprints/some_saved_blueprint


    This will take your ship as input and print ASCII projections in all three dimensions to stdout. I would post an example, but we have no monospace font here, so it would look like crap.

    (Note: I just noticed that the program in this release will throw an error. This will be fixed in the next release.)



    Asdf

    Suggestions and Feedback are appreciated. Developer documentation will follow if I can provide a reasonably stable API (although the classification API is pretty much finished).

    If you think your ship is classified wrongly, run the script with the debug option and paste the output here (or probably better on pastebin).

    In case you're running a Rails powered webserver or one with Ruby-CGI support, and feel that more people should be able to use this, feel free to deploy it.
     
    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    Basically, defining a custom classifier is done by subclassing ShipClassifier and describing how the ship types should look like.


    class CustomClassifier < Rubatom::ShipClassifier

    ship_type Fighter do

    length 20, 5 # expectation = 20, standard deviation = 5

    weapon_score 1.5, 0.4

    end

    ship_type Stealth Fighter do

    length 20, 5 # expectation = 20, standard deviation = 5

    weapon_score 1.5, 0.4

    stealth_score 1, 0.5

    end

    end


    The Problem

    The problem here is that one would expect a Fighter with a cloaking device to be classified a Stealth Fighter. In reality, no ship will get this classification.

    The reason is, that classification is done by computing a probability for each attribute and combining them with a logical AND operation. While this is a good approach in principal, it has the drawback of sometimes being unintuitive or requiring a lot more code.

    So, if someone has an idea of maintaining the simplicity of the above code and still being able to do intuitive definitions, please speak up. :D