Page 1 of 3

My ambitious oolite project

Posted: Mon Apr 02, 2007 11:04 pm
by treetrunker
Hi everyone, I'm new here to the forums, but have been playing Oolite for several months now. I have two questions.

1. Is it really true that you have to be on a mac to make your ships into a .dat file?

2. Is it possible to add/remove planets, solar systems, galaxies, or ships?

I also would like to create an entire new universe, with an overall storyline, using the basic oolite engine. I'm fairly inexperienced with modding at this point, so I will be using this thread to ask for help and to inform you all on my progress. If you might be interested in helping me with this project, please let me know.

Thank you,
Treetrunker

Posted: Mon Apr 02, 2007 11:26 pm
by LittleBear
1. Don't think so.

2. Oh yes. (at least you can add them, not sure you can take them away)

If you build it he will come!

Welcome to the boards!

You can mod Oolite in pretty much anyway. Check the Wiki and the OXPs already out. If you wanna write a mission pack, best way to learn is to play a few OXP missions. You can see how they work and crib the code to do the things you want to do with Oolite.

OXPers are generally flatered if you pick up their ideas and use their code in an new OXP. Feel free to c&p any of my stuff if it works for you. I made my mission OXPs by looking at the code of Selezen, Murgh, Wombat, Giles et al and thinking "Ah so thats how they did that. I'll have that code" C&p and change." :wink:

If you download Assassins.oxp and look at the readme past the Big Spoiler Warning, there's a step by step guide to everything the OXP does in code. Might be helpful if you're writing a big mission pack. Look forward to playing it! :)

Posted: Mon Apr 02, 2007 11:29 pm
by JensAyton
1. No.
2. Yes, no, no, and yes.

I was going to refer you to the wiki on #1, but it’s wrong. There are converter scripts written in Python; it should be possible to get these running under Windows. Unfortunately there doesn’t seem to be a sensible place to download them, so here’s a somewhat unsensible way to get the one that matters: Obj2DatTex.py.

The JavaScript support being phased in over the next few versions will make it much large-scale modding much easier, so I’d reccomend starting at the other end (i.e. ships) for now. Adding/removing/moving galaxies and solar systems isn’t possible at the moment, but if you really need it – and show some progress – it may become possible in future.

Posted: Tue Apr 03, 2007 12:22 am
by treetrunker
Yeah, I looked at the wiki, and thats why I asked the question. Another question. What is Python, and how do I get that script to work. Also, is removing ships an option, I wasn't clear on your answer to that. I would like to be able to create a whole new set of ships for my mod. Thanks for the help so far though.

Progress so far:
I have created the basic storyline, and have begun working on some basic naval ships. I have also created a map of what I want the Galaxies/Solar Systems to look like.


Yet again I am clueless: Is there a spoiler block function within these forums?

Posted: Tue Apr 03, 2007 1:36 am
by Captain Hesperus
When you say 'ships' do you mean the basic set of ships or ships that are OXPs?
treetrunker wrote:
Yet again I am clueless: Is there a spoiler block function within these forums?
You can try rot13 or change the colour of the text (suitably forewarned with SPOILER!!! or something) to match the background, like this.

P.S. Welcome to the boards and happy coding!:D

Captain Hesperus

Posted: Tue Apr 03, 2007 1:41 am
by treetrunker
I mean the basic set of ships.

Posted: Tue Apr 03, 2007 4:43 am
by Wolfwood
treetrunker wrote:
I mean the basic set of ships.
A whole new set of ships would indeed mean removing all the old ones. I don't know if there's another way, but one way to remove them is to replace them (using the same names in the code) by new ships.

Posted: Tue Apr 03, 2007 8:11 am
by JensAyton
Wolfwood’s way is the only one I can think of. Replacing them with ships that never appear would be entirely possible - although you’d have to consider what would happen when the player opens a saved game with a standard ship.

Posted: Tue Apr 03, 2007 8:14 am
by TGHC
Ahruman wrote:
Wolfwood’s way is the only one I can think of. Replacing them with ships that never appear would be entirely possible - although you’d have to consider what would happen when the player opens a saved game with a standard ship.
You'd be in Witchbase, with no way out but Alt-F4.

Posted: Tue Apr 03, 2007 9:09 am
by Selezen
How to create OXPs / DATs:

Download the Python scripting language from www.python.org.

Get that script thing that Ahruman mentioned or download it from the main oolite page.

Get a copy of Wings3d from www.wings3d.com nd learn how to use it.

When you've created your ship, export it as a Wavefront OBJ file.

Copy the OBJ and MTL files into the Python24 folder on your hard drive.

Open a command window. Go to the Python24 folder and type obj2dattex.py shipname.obj.

Tadaaaa! A nice DAT file.

Posted: Tue Apr 03, 2007 9:20 am
by LittleBear
If your doing a big mod, it might be best to confine it to a single galaxy to avoid a clash with other OXPs. Nobody has written any missions set in Galaxies 6 or 8 yet.

Adding planets / moons to a system is pretty easy. In planetinfo.plist have a series of commands like this:-

Code: Select all

"rebel_moon" = {
        position = "-40000 0 463000";
        radius = 1500;
        orientation = "1.0 0.0 0.0 0.0";
        texture = "hitsplanet10.PNG";
        seed = "1 2 3 4 5 6";
        "polar_color_factor" = 2.5;
        "rotational_velocity" = 0.13;
    };

"6 13" = { 
        "ambient_level" = "3.0";
 "sky_blur_alpha" = "0.85";
        "sky_blur_cluster_chance" = "0.55";
        "sky_blur_scale" = "25";
        
	"script_actions" = (
                 debugOn, "addMoon: rebel_moon",
	"addMoon: gas_giant",
 "addMoon: gas_giantA",
 "addMoon: gas_giantB",
		         debugOff
			);
The first command defines the moon, the second command adds the moon (and other planets) at this particular system. First number is the Galaxy (1 is 0, so Galaxy 7 is 6), next is the planet number. This command adds a moon and two gas giants only at this system.

All the properties of the System can be changed with commands like this:-

Code: Select all


"setSpecificPlanetInfo: 6=13=description=Eszausve is famous for its rocky moon and the twin gas giants Hades and Lernean, but cursed by one of the most oppressive governments in the Galaxy. Although the People's Popular Front bravely resists the oppressive regime of Governor Tarkin, thus far they have made little progress in restoring freedom to the planet.",

"setSpecificPlanetInfo: 6=13=productivity=98764",
"setSpecificPlanetInfo: 6=13=techlevel=14",
"setSpecificPlanetInfo: 6=13=inhabitants=Oppressed harmless fat birds",
"setSpecificPlanetInfo: 6=13=station=abcstat",

To add ships to the system, use commands like this:-

Code: Select all

{
	conditions = ( 
 						"galaxy_number equal 6",
						"planet_number equal 13",
						"mission_assassins_war equal 0", 
						"status_string equal STATUS_EXITING_WITCHSPACE" 
					); 
	do = ( "checkForShips: ecop", 
	{ conditions = ( "shipsFound_number lessthan 14" ); 
	do = ( "addSystemShips: ecop 6 0.0"); 
						}, 
					); 
				},
A series of commands like this adds the special cops to the system (but only whilst the war variable is a zero). Once the OXPs plot developes then other things start happening here. :wink:

Adding a load of ecops doesn't remove the Vipers as such, but so many ecops are added that very few vipers will be encountered and so it feels to the player that the cops in this system are different.

You define your ships in shipdata.plist and add them by role in script.

Posted: Tue Apr 03, 2007 9:21 am
by ramon
Selezen wrote:
Open a command window. Go to the Python24 folder and type obj2dattex.py shipname.obj.
isn't it obj2dattex.py shipname.obj shipname.dat

Posted: Tue Apr 03, 2007 9:34 am
by JensAyton
LittleBear wrote:

Code: Select all

{
    conditions = ( 
        "galaxy_number equal 6",
        "planet_number equal 13",
        "mission_assassins_war equal 0", 
        "status_string equal STATUS_EXITING_WITCHSPACE" 
    ); 
    do = ( "checkForShips: ecop", 
        { conditions = ( "shipsFound_number lessthan 14" ); 
            do = ( "addSystemShips: ecop 6 0.0"); 
        }, 
    ); 
},
Or, in JavaScript:

Code: Select all

this.willExitWitchSpace = function()
{
    if (galaxyNumber == 6 && planetNumber == 13)
    {
        if (missionVariables["assassins_war"] == 0 && system.countShipsWithRole("ecop") < 14)
        {
            system.legacy_addSystemShips("ecop", 6, 0.0);
        }
    }
}
I know I’m pushing this hard, but, to be clear: from the test release of Oolite 1.68 (later today), the old scripting mechanism is deprecated, and learning it for new development is discouraged. It is still necessary if you’re targeting the current release version (1.65), but for a new large-scale mod, use JavaScript. I intend to have a full release (probably 1.70) with a fleshed-out JavaScript scripting model out by the end of May.

JavaScript is currently only available for “world scripts”, equivalent to script.plist in the old model. Addressing this is a major goal for 1.69.

Posted: Tue Apr 03, 2007 9:37 am
by LittleBear
Will the old script still work?

Anything new I write I'll write in Java, but given the size of the script I really coudn't face having to redo it in java as it has 800+ commands!

Posted: Tue Apr 03, 2007 9:40 am
by JensAyton
LittleBear wrote:
Will the old script still work?
Yes. If at some point there’s an Oolite 2.0 with architectural changes that make such support difficult, it might break there. (On the other hand, it may be possible to automatically translate the old scripts to JS. Or not.)
LittleBear wrote:
Anything new I write I'll write in Java, but given the size of the script I really coudn't face having to redo it in java as it has 800+ commands!
JavaScript is not Java. Otherwise, fair enough.