Things I Wish I Knew BEFORE Starting this *@*#~&ing .oxp

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
Charlie
---- E L I T E ----
---- E L I T E ----
Posts: 262
Joined: Wed Sep 27, 2006 5:33 pm

Things I Wish I Knew BEFORE Starting this *@*#~&ing .oxp

Post by Charlie »

I think the title says it all.

I'm hoping this thread will have a lot of useful contributions.

Yes there is the Wiki, but how many times have you wished you understood an issue / feature properly BEFORE wasting days trying to get something to work and finally posting on this forum for advice?
( which I'm glad to say is often very useful )
Such advice is usually already posted, but buried in old topics...

So...

1 ) I hope this thread will bring out a lot of similar feeling ( otherwise I must be dumber than I thought )
2 ) This becomes a definitive ( USEFUL ) place for tips on how to do stuff & what pitfalls to avoid.
3 ) Becomes a Sticky thread. :D
4 ) Is VERY strictly moderated so whinges like this are rapidy removed. :)
5 ) Once a question is answered to everyone's satisfaction a brief summary of both question + answer is put somewhere that can be easily searched & read.

Whittle over... thoughts?
Last edited by Charlie on Sat Jan 27, 2007 3:06 pm, edited 1 time in total.
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---

Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main

Charlie
User avatar
Captain Hesperus
Grand High Clock-Tower Poobah
Grand High Clock-Tower Poobah
Posts: 2312
Joined: Tue Sep 19, 2006 1:10 pm
Location: Anywhere I can sell Trumbles.....

Post by Captain Hesperus »

WEll, Charlie you're waaaay more advanced than I am. I can't tell a <string> from a <key>, so I bow to your superior talent. :D

Captain Hesperus
"Is there a coder in the house, I want an Anaconda sized cargo bay for my Python!"
User avatar
Charlie
---- E L I T E ----
---- E L I T E ----
Posts: 262
Joined: Wed Sep 27, 2006 5:33 pm

Post by Charlie »

I'll start the ball rolling...

I'm new to docks - My God what a pain ( esp if you do something unusual )

Useful info:
1 )
aegidian wrote:
Quick and easy instructions for wings3D.

1. Make a panel on your main model where the dock entrance will be. A rectangle 192x64 is ideal, but you can go bigger - and use different shapes.

2. Assign the special material '_hole_' to the rectangle.

3. While you have it selected make a note of the coordinates of the centre of the rectangle.

4. As a separate model, make a cube then scale it to the dimensions of your rectangle and a depth of 250. So a cube scaled to 192 x 64 x 250.

5. Select the face of the cube facing the same way as your dock entrance in (1.) and assign it the '_hole_' material.

6. While it's selected choose Tools - Center - All from the menu to move that face to the origin.

7. Select the object, and from the right-click menu choose Invert to turn the cube 'inside out'. It should look something like this:


8. Texture your new dock. And convert it to an Oolite .dat model file.

9. Position the new dock as a subentity of the station, at the coordinates you noted down in (3.)

10. You should now be done. You can vary the shape of the dock entrance in stage 1. If you copy and paste the panel into a new model you can even use it to extrude the dock shape.
https://bb.oolite.space/viewtopic.php?p= ... ties#20007

Thanks aegidian :)

For those who prefer to use an alternate 3D package to Wings you don't have to use it for the '_hole_' material. Just chopping holes in your model & dock seems to work.

2 )
dajt wrote:
It could be something to do with the docking ports facing backwards. I think the behemoths have this feature so maybe a look at how they are put together would provide enlightenment.
https://bb.oolite.space/viewtopic.php?t=2834&start=30

Thanks dajit :)

Ps - What I think he means is:- Always do your dock along the z-axis facing to the front of the ship regardless of what direction you want it to end up facing...
Then use:-
<string>dockname x y z 1 0 0 0 </string> - for facing forward...
<string>dockname x y z 0 1 0 0</string> - for facing backward...
Rear-facing docks, once modeled, need to be rotated 180deg so the opening is facing forward ( but still located on 0.0 0.0 0.0 ) before converting to .dat
If not a uniform shape it also needs to be rotated 180deg along the z-axis or it will appear upsidedown in you ship!?!

in:-
<key>subentities</key>
<array>
<string>your sub-entity here</string>
</array>

The last four numbers can be used for other orientations...

Am I correct?

Does anyone want to have a go @ USEFULLY explaining the co-ordinates system?
Pref with posted examples of common directions for the lazy ( like me )
Last edited by Charlie on Sat Feb 17, 2007 7:52 pm, edited 1 time in total.
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---

Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main

Charlie
User avatar
Dr. Nil
---- E L I T E ----
---- E L I T E ----
Posts: 985
Joined: Thu Sep 28, 2006 5:11 pm
Location: Nearest Hoopy Casino
Contact:

Quarternations:

Post by Dr. Nil »

Excellent idea for a thread.

Here are 4 of the six right angled directions turrets can face:

Code: Select all

Up
<string>comturret -41.5 -4.5 128.75 1 1 0 0</string>

Forward
<string>comturret 41.5 -4.5 128.75 1 0 0 0</string>

Down
<string>comturret 41.5 -4.5 128.75 1 -1 0 0</string>

Aft
<string>comturret 41.5 -4.5 128.75 0 1 0 0</string>
The quarternations are the last four numbers.
Image

300 billboards in Your Ad Here!
Astromines and more in Commies.
AVAILABLE HERE along with other Oolite eXpansion Packs.
User avatar
Charlie
---- E L I T E ----
---- E L I T E ----
Posts: 262
Joined: Wed Sep 27, 2006 5:33 pm

Post by Charlie »

Quaternions:

I know they have their benefits, but can you get your head round them?

No? - neither can I...
( I may be good @ many things but this is NOT one of them )

Here goes...

Some background:
http://www.ogre3d.org/wiki/index.php/Qu ... ion_Primer

Got all that?

No? Ok, here's hopefully a helpful start:
Image
Crappy drawing - no?
But the point is this is how most of us think.

Heres a table of useful Quaternions:
Image

Still makes little sence?
Remembering the crappy diagram of a ship ;) its pointing along the Z+ axis.
This is equivalent to the first row of the 'grabbed' table.

Want to face the other way? ( Z-)
Pick an axis that you will rotate about: I'll say X for arguments sake & rotate 180deg.
Equivalent to the second row in the 'grabbed' table.

So what do we know?
0-1 = 0-180deg rotation about the axis we've picked - in this case X.

Consequences?
Imagine the rotation happening in the 'crappy' diagram...
Got it? Yes you're now facing along z- but upsidedown!!
( This is why you launch upsidedown from my Consitution ship's dock - doh! )
Oolite expects a dock to be made facing Z+ & then I had to rotate it into place facing backward for the model.

How to fix?
Well: looking @ the 'grabbed' table we could also rotate 180 deg round the Z axis too.
So...
0 1 0 0 in row two plus 0 0 0 1 in row four = 0 1 0 1 !!

AhHa!!

or maybe I should have just roatated about the Y axis... 0 0 1 0 in the first place...

A lot of the time it doesn't matter what way up you end ( you're placing a turret )
But, it may matter for things like docks or other sub-entities...
  • Quick table:
    Entity name X Y Z - W X Y Z
    Fore 0 0 0 1 0 0 0
    Aft 0 0 0 0 1 0 0
    Up 0 0 0 .5 .5 0 0
    Down 0 0 0 .5 -.5 0 0
    Port 0 0 0 .5 0 .5 0
    Starboard 0 0 0 .5 0 -.5 0
    Hmmm, bugger - no formating...
Hope this helps...
W? I hear you ask?
Have a think, compare to the table Dr. Nil kindly supplied - spot the difference? What ( if any ) difference does it make?
Think of W as a way of making the numbers add up to 1.0ish...

Next time rotating Sub-entities!!
( maybe )

Ps
Feel free to contribute ammendments / suggestions / other useful tit-bits...
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---

Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main

Charlie
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Escorts

Post by Killer Wolf »

I'll chip in w/ how i got escorts to work, since some people seemed to have the same faff on i did. in the end, as ever, it all seemed fairly simple :-

1) the mothership's shipdata should have :-
<key>escorts</key>
<string>4</string>
<key>escort-ship</key>
<string>kissmyasp</string>
obviously the number is changed to suit your needs. i copied an ASP and saved it off to make sure it was unique to my OXP. "kissmyasp" is the name key of the escort, not the ROle or whatever.
also, give it its own AI, such as mothershipAI or whatever.

2) in the escort's dict, i did "likeship asp", gave it kissmyaspAI.plist, and a Role "aspestos" ~ cos it protects you from (incoming) fire. look, it was funny at the time, right?

Now, for the mother's AI, i did :

{


GLOBAL = {ENTER = ("switchAITo: sunSkimExitAI.plist", setUpEscorts); EXIT = (); UPDATE = (); };

}
which sets up the AI i wanted, and conjures the escorts you defined in the shipdata.

for the kissmyaspAI, i did
{


GLOBAL = {ENTER = ("switchAITo: escortAI.plist"); EXIT = ("switchAITo: escortAI.plist"); UPDATE = ("switchAITo: escortAI.plist"); };

}
this was simply because i couldn't spawn the buggers w/out them immediately gonig into route1patrol mode and buggering off.

whether this is actually necessary given i think i sussed the mother's set-up i don't know - all i know is it works and i've not a mind to try taking it out!
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hi Charlie, there's a mistake in your Quaternion-post. As the information provided here should be accurate, I think it's better to correct that. I wouldn't mind you to just edit your post and c&p the following correction into it. Then one of the Mods could delete this post (but only then, please!).

It's here:
Charlie wrote:
How to fix?
Well: looking @ the 'grabbed' table we could also rotate 180 deg round the Z axis too.
So...
0 1 0 0 in row two plus 0 0 0 1 in row four = 0 1 0 1 !!
The answer is NO: 0 1 0 0 in row two plus 0 0 0 1 in row four IS NOT 0 1 0 1 !!

That's because of the way Quaternions are added. It's not a simple OR-calculation as you have done. See Elite Wiki:
Wiki wrote:
Quaternion calculus

To perform one rotation, and then another, one needs to multiply two quaternions together.

Multiplying quaternions isn't commutative: Qa x Qb does not equal Qb x Qa

To multiply Q1 (w1, x1, y1, z1) by Q2 (w2, x2, y2, z2):-

W = w1 x w2 - x1 x x2 - y1 x y2 - z1 x z2
X = w1 x x2 + x1 x w2 + y1 x z2 - z1 x y2
Y = w1 x y2 + y1 x w2 + z1 x x2 - x1 x z2
Z = w1 x z2 + z1 x w2 + x1 x y2 - y1 x x2
For your two Quaternions (0 1 0 0 and 0 0 0 1) that translates into the following:
W = 0x0 - 1x0 - 0x0 - 0x1 = 0 - 0 - 0 - 0 = 0
X = 0x0 + 1x0 + 0x1 - 0x0 = 0 + 0 + 0 - 0 = 0
Y = 0x0 + 0x0 + 0x0 - 1x1 = 0 + 0 + 0 - 1 = -1
Z = 0x1 + 0x0 + 1x0 - 0x0 = 0 + 0 + 0 - 0 = 0

So the resulting Quaternion is 0 0 -1 0, which happens to be the same as 0 0 1 0 (rotation around the Y axis), because it doesn't matter whether you rotate 180 degrees to the left or to the right.
User avatar
Charlie
---- E L I T E ----
---- E L I T E ----
Posts: 262
Joined: Wed Sep 27, 2006 5:33 pm

Post by Charlie »

@ Commander McLane: :oops:

My thanks :)
Benulobiweed.inc
By Appointment to
--- : GalCoop : ---

Your nearest Benulobiweed.inc dealer:
http://www.box.net/public/b2tic3tjsk#main

Charlie
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hi Charlie, never mind! :lol:

But for the sake of keeping this thread short and snappy, please just edit your above post.

Take this line out:
0 1 0 0 in row two plus 0 0 0 1 in row four = 0 1 0 1 !!
and replace it with:

"According to the wiki Quaternions can be added like this:

(insert everything from the wiki-quote to the end of my post)"

As soon as you have done that (or perhaps another person with permission to edit posts, which I don't have), I'll delete my post. I think that would be in the spirit of this thread, as you set it up.

You may mention my name as well, but I don't really bother.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Re: Escorts

Post by Arexack_Heretic »

Killer Wolf wrote:
Now, for the mother's AI, i did :
{
GLOBAL = {ENTER = ("switchAITo: sunSkimExitAI.plist", setUpEscorts); EXIT = (); UPDATE = (); };

}
Remember that the methods are handled as they are read, so as you already noticed, "switchAITo: sunSkimExitAI.plist" changes the AI BEFORE setUpEscorts can be called.
reverse their order and it should work fine.
(maybe add pauseAI: 5.0 in between for extra security)

---

I got my own problem:

I want to spawn a ship near a ship planted by script.plist.
I tried putting spawn in the AI, in script_actions, in setup_actions, I also tried spawnShip, but I really need the specific roles.
what happens is: the first ship is placed. according to the errorfile the next ship is spawned
DEBUG ::::: scriptAction: "addSystemShips: convoy 1 1"
DEBUG ::::: after expansion: "addSystemShips: convoy 1 1"
DEBUG Going to add 1 ships with role 'convoy' at a point 1.000 along route1
DEBUG ::::: scriptAction: "spawnShip: rubberduck"
DEBUG ::::: after expansion: "spawnShip: rubberduck"
DEBUG Spawned ship with shipdata key 'rubberduck'.
but no rubberduckie unfortunately, it is lost in limbo. :cry:

Been chipping away at typos and bad code for ages it feels like. :(
I really do not want to place each ship by hand. That would be barbaric after all this trouble.
Riding the Rocket!
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

It's not "lost in limbo", but already landed! :wink: Or, in fact, buried deep within the planet. :shock:

You see, "addSystemShips: <role> <number> <location>" adds a number of ships with a role at a certain location along the witchpoint-beacon -- planet line. It can range from 0..1, 0.0 being the witchpoint, 1.0 being the planet.

That just means that you have spawned your ship in the middle of the planet :shock:! Not even a Pelamis was made for that. :wink:

Reducing the last number to 0.9 or 0.8 should make the ship appear in a reasonable distance from the planet.

:)
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I thought so at first too.
However, addsystemships adder 20 1 creates a cloud of ships around the station.
I think route1 actually ends at the Eagis.
Anyhow, it is not the addship that is not turning up, but the ship spawned by that one.

---
I could put all the successive spawning in the script:
checkForShips: role1 morethan 1
addsystemships: role2 1 1,
checkForShips: role2 morethan 1
addsystemships: role3 1 1,
etc

But i feel that is not really elegant.....should I be discussing this in here?
It may be offtopic.
Riding the Rocket!
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Not off-topic, because eventually it will lead to some useful information... (I hope). BUT at some point all these post should be heavily edited to finally result in ONE post that will contain this useful information. I don't have the power to do that, so one of the mods will have to do it (e.g. I am asking Charlie for a long time now o make a start by editing his Quaternion-post, so that I can remove two then-superfluous posts of mine).

Anyway, as for spawning, I have had the same problem when I wanted to surround my Hacker Outposts with asteroids. When I did that with "spawn" all the asteroids tended to be created within the Outpost's docking bay--not a particularly good place.

The problem seems to be that the spawning-location is just too close to the spawning entity. (Well, the example-use for the method is to substitute one entity with another in death_actions, so it makes perfect sense to have the coordinates very close.) What I would like to have is something like spawnWithinRadius: <role> <number> <radius> analogue to addShipsWithinRadius. That would allow exactly what you are trying to do.

So probably your rubberduck is spawned within its mothership then? For checking: Give it a beacon-code and look if it appears on the compass.

Another way to create your rubberducks would be to set them up as escorts of their spawning convoy.

Or you have to create the convoy with addShipsAtPrecisely and then add the rubberducks with addShipsWithinRadius and the same coordinates. addShipsAt wouldn't work, because it has too big an error-margin, so the the convoy would be too far off the rubberducks.

If nothing of that works I've run out of ideas for now.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

escorting is not an option as the rubberduck is the leader of the convoy ;)

the idea is that the convoyAI scans (range 100000) for the presence of #5,4,3,2,1,rubberduck and follows the first ship it can find. (if none found at all, it will revert AI to rubberduck aka enteringTraderAI)
the elegant part is that I can call for one one ship in the list of convoyers and it should spawn it's 'leader' when set-up, thus I always have a full convoy as long as the role# I called in script.
Also if any in the convoy is lost for any reason, the line will close itself.
secondly, when they arive at Eagis and dock, each one in turn will turn 'duck' and dock....that is when I customise the AI, as enteringTrader may deside to go on vacation to the sun....



I'll just have to addShipsWithinRadius then...
but then another problem arises: the ships will be placed again when they are destroyed, not my intention. This then calls for some local_variable to be set by each convoyee upon death. Needlessly complex, but perhaps inevitable.
Last edited by Arexack_Heretic on Thu Mar 15, 2007 1:06 pm, edited 1 time in total.
Riding the Rocket!
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2269
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

Remember that the methods are handled as they are read, so as you already noticed, "switchAITo: sunSkimExitAI.plist" changes the AI BEFORE setUpEscorts can be called.
reverse their order and it should work fine.
?? it is working fine, that's why i put the script here.
i'll qualify that tho : it was working fine in the tanker OXP, so i put it here...i've since tried to spawn some sentry gun emplacement models on another model, and it's flatly refusing. i did try the setUp first too, though i might try the pause as well. odd that the escort thingy worked fab for one model and not at all for another :-/

<editd> - the problem was sorted by Commander McLane - i'd put "string" instead of "integer" when specifying the number of escorters. what a mook, eh? Cheers Commander!

escorting is not an option as the rubberduck is the leader of the convoy
:-D
Post Reply