nijineko wrote:thanks! it was indented, but the quote box ate the tabs. ^^
That's what the "code" box is for, so I would suggest using that one whenever you are posting, errmm..., well, code.
hmmm, still not finding it. ^^ how do i make an example of the sphere appear?
Entities, ships, asteroids, stations, whatever, don't appear just by themselves. They have to be
made appear. That's what we call
spawning. And this is usually done in the
script.plist or the
planetinfo.plist of an OXP. The latter could be the better for your purpose.
How are ships spawned? Oolite doesn't spawn specific ships by their names, it spawns ships with a specified
role. That means that you will never see your Dyson Sphere unless you have assigned it a role, i.e. added the
roles-key to its shipdata. It is one of the essential keys which must never ever be omitted when creating a shipdata. So your
shipdata.plist should at least look like this (note the nice indentation within the code-tags, and note that a plist-editor sorts the keys alphabetically (at least mine does)):
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>nijineko_Dyson_sphere</key>
<dict>
<key>ai_type</key>
<string>nullAI.plist</string>
<key>energy_recharge_rate</key>
<integer>100</integer>
<key>max_energy</key>
<integer>1000000</integer>
<key>model</key>
<string>nijineko_Dyson_Sphere.dat</string>
<key>name</key>
<string>Dyson Sphere</string>
<key>roles</key>
<string>nijineko_dyson_sphere</string>
<key>scanClass</key>
<string>CLASS_ROCK</string>
<key>thrust</key>
<real>100</real>
</dict>
</dict>
</plist>
Note the other changes I made as well. The
density-key is pretty much useless for your sphere, so I deleted it. But on the other hand, what do you want with a
energy_recharge_rate, if you don't have a value for
max_energy defined, up to which your sphere's energy is recharged? I gave it a pretty high energy, because I don't guess you want the player to be able to obliviate it with a couple of laser shots. Another essential key is
ai_type, which defines what your entity will be doing. NullAI is an AI that does nothing in particular. For instance it doesn't try to move your entity, it doesn't react on attacks or anything else, it just doesn't do anything. If you want the sphere to do anything, you have to write a custom AI for it, because none of the predefined AIs would be of any use for it. If you decide to script an AI, you should name it nijinekoDysonSphereAI.plist or something of the like, and that's the string you assign to the
ai_type-key.
You should also right from the beginning of your scripter's career internalize that identifiers have to be
unique. Who knows, perhaps somebody else is working on an OXP with a Dyson Sphere as well? So if
you create a shipdata.plist with a <key>Dyson_sphere</key> and
he creates a shipdata.plist with a <key>Dyson_sphere</key>, they will kill each other. Not nice. Therefore you better use a
unique name. One way of achieving this is to preceed all strings that have to be unique with your own name or avatar. The chances that anybody else who is also called nijineko will create another dyson sphere are pretty small.
The same applies for your dat-file, and of course for the texture.png as well. Make their names unique, or any equally named .dat or .png may overwrite and erase yours. Do you want that? (Note: If you rename your .png, you have to open your .dat with a text editor and change all appearances of
oldname.png to
newname.png as well. Then resave.)
Oh, and by the way: I don't think that you want an underscore in the
name-key of your entity. This is the string that is displayed next to the bounding box and in your HUD when you target the entity. Usually you would have "Cobra MK. III" there, not "Cobra_MK._III". Looks ugly.
Now your entity is properly defined. But that doesn't yet make it appear in your game. For that--as mentioned earlier--you need to spawn it. I suggest you do that via
planetinfo.plist. This consists of general information about Oolite systems (and also interstellar space) and information about
specific systems. I take it you don't want to create dyson spheres everywhere, but just in one system. You do this by creating a planetinfo.plist-entry for this specific system. So you have to create another file with your plist-editor, name it planetinfo.plist, and put it into the Config-folder of your OXP.
Then you have to decide in
which system you want the dyson sphere to appear. This information you have to put in the entry name, by the order <key>
galaxy_number planet_number</key>. For Lave that would be 0 and 7, respectively (have a look at the planet lists for other locations).
The only thing you need inside the dictionary is the method to spawn your entity. This is a script action, so it has to go inside a
script_actions-array. The syntax for the various spawning methods you find
in the wiki. I suggest the addShipsAt-method, which does what it says: Adding a specified entity (to be precise: an entity with a specified
role) at specified co-ordinates. For that it needs the
role of the object you want to spawn as defined in shipdata.plist ("nijineko_dyson_sphere"), the
number of objects with that role you want to spawn ("1"), the
co-ordinate system relative to which the following co-ordinates are to be understood (as the sphere shall be centred around the sun, in your case any co-ordinate system that is centred around the sun will be sufficient, I chose "spm"), and finally the
co-ordinates themselves relative to the chosen system ("0 0 0", because you want the sphere to be dead center around the sun).
So here's what your planetinfo.plist should look like:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>0 7</key>
<dict>
<key>script_actions</key>
<array>
<string>addShipsAt: nijineko_dyson_sphere 1 spm 0 0 0</string>
</array>
</dict>
</plist>
Important note: This will create the final, big Dyson Sphere. Any small object created this way will simply be inside the sun. So for your testing purposes you need some other way. The best thing is to use the Debug-menu (install
the OXP first). That is an additional pull-down menu for Oolite that allows you to do all kinds of things. In your case: spawn entities. Launch from the main station, choose "Create ship..." from the menu and enter your ship's role "nijineko_dyson_sphere" in the pop-up box. Your small test-sphere will appear somewhere close to the station. Locate it on your scanner and fly towards it. Voilà!
And one last thing:
i suspect (from the discussion of collision boxes above) that a dyson sphere will slow the game down considerably, as it will be constantly checking for touching faces for everything inside the sphere. unless there is a way to assign a "negitive boundary box(es)" area where it will not check for collisions inside a certain defined area of the hollow sphere...
No, that was not the issue of the discussion above. The issue was that probably
everything inside the big dyson sphere (including you) will blow up instantly as soon as the sphere is spawned. So maybe your OXP won't do anything else than producing a PRESS SPACE COMMANDER screen as soon as you load it. But we'll have to test and see before we can definitely know.