Animation Demo OXP

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

Moderators: winston, another_commander

Post Reply
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Animation Demo OXP

Post by Thargoid »

With Oolite 1.75 there is the new frame callback available, allowing for some nice possibilities in animation.

I've been playing with this a little, and to aid my own understanding I've put together a small demo OXP (with the assistance of Ahruman and Eric Walch). It is available here.

Once installed, to activate it just launch from the main station (any system) and within 10 seconds target the nav buoy. Two test drones should be spawned, one on either side of the buoy. One uses the callback, and the other the old javascript timer way of doing animation as a comparison.

Aside from that it doesn't do anything but give an example to OXP makers - for me there are many interesting possibilities for new ships and features. Oh and be warned, watching the drones gets hypnotic after a while :shock:

As the first line above may suggest - requires Oolite 1.75 or higher to run.
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:

Re: Animation Demo OXP

Post by Commander McLane »

[EliteWiki] Flying_Dutchman.oxp in version 1.6 contains an example for frame callback as well. I found it very useful for raising the ship temperature. The example actually combines frame callbacks and a standard timer, because I needed the timer to check if a certain temperature treshold has been reached.
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:

Re: Animation Demo OXP

Post by Commander McLane »

Have you by any chance forgotten to remove the frame callback?

Code: Select all

Exception: TypeError: "use strict";this.ship.subEntities is undefined
    aniDemo_script.js, line 51:
    	this.ship.subEntities[0].position = this.ship.subEntities[0].vectorForward.multiply(offset);
My log file is now 8MB filled with this message, and counting.

EDIT: I jumped out, which means the shipDied handler wasn't triggered. Better to add = this.playerWillEnterWitchspace.

By the way: what do all the '$' mean?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Animation Demo OXP

Post by Thargoid »

To show that they are custom properties, not built-in ones (to make it clear and remove the chance of namespace pollution) - it was one of Ahruman's requests.

With regard to jumping out, I will update the OXP for that. I must admit this is the one part of the frame callback I'm not fully convinced of yet, as I can see one or two other scenarios where problems may occur.

An updated version including the callback removal on player jumping is now uploaded.
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:

Re: Animation Demo OXP

Post by Commander McLane »

Thargoid wrote:
To show that they are custom properties, not built-in ones (to make it clear and remove the chance of namespace pollution) - it was one of Ahruman's requests.

Ah! So that is something we all should generally do?

As I'm in the process of OXP-updating that's something I could implement now—at least for the OXPs I still have to update in the current roll call.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Animation Demo OXP

Post by JensAyton »

Commander McLane wrote:
Ah! So that is something we all should generally do?
Yes. (The built-in scripts actually use underscores instead, but Kaks pointed out that dollar signs are more idiomatic in JavaScript. Either is fine by me, but note that there are a few special properties identified by double underscores used by SpiderMonkey and Oolite.)
Post Reply