Page 2 of 2

Posted: Fri Feb 23, 2007 1:10 pm
by Ramirez
I'm interested in how this enhancer actually works in-game. Are you somehow modifying the fuel scooping code so it can be effective outside of a sun's corona, or are you using scripts to award a small amount of fuel every ten seconds or so each time the IN_FLIGHT script condition is met? If it does use scripts, would this not cause frequent pauses in the game as each script cycle is processed?

Posted: Sat Feb 24, 2007 9:16 am
by Commander McLane
The latter. Here's the script:

Code: Select all

		{
			conditions = (
				"status_string equal STATUS_IN_FLIGHT",
				"planet_number greaterthan -1"
			);
			do = (
				"testForEquipment: EQ_FUEL_SCOOPS",
				{
					conditions = ("foundEquipment_bool equal YES");
					do = (
						"testForEquipment: EQ_SCOOP_ENHANCER",
						{
							conditions = ("foundEquipment_bool equal YES");
							do = (
								"increment: mission_scoopenhancer_counter",
								{
									conditions = ("mission_scoopenhancer_counter equal 3");
									do = ("reset: mission_scoopenhancer_counter", "awardFuel: 0.1");
								},
							);
						},
					);
				},
			);
		},
So what does it do? While IN_FLIGHT it checks for having fuel scoops. If they're installed it checks for the fuel scoops enhancer. If that's installed it increases a counter. If that counter has reached 3 the player is awarded 0.1LY of fuel and the counter is set to zero again. And so on. As a result you "scoop" 0.1LY worth of fuel every 30-or-so seconds. I think that's a balanced ratio.

Update: Yesterday I found out that I can limit the availibility of EQ_SCOOP_ENHANCER by a condition in equipment.plist that makes it only buyable when your ship already has fuel scoops installed. That means I can make the code even slimmer by omitting the test for EQ_FUEL_SCOOPS. ...THINK... No, I shouldn't do that, because your fuel scoops could be damaged in flight, and then also the enhancer shouldn't work. Okay, that could be a catch, because I don't know how damaged equipment is handled internally. Is it disabled by setting <false/> in the pilotlog? Anyway it should still be there. So it COULD be possible that my script will even award you fuel when your fuel scoops are broken. Have to test that.

Info for scripters: Of course first I tried to award a smaller amount of fuel, like 0.05LY, but that didn't work. Obviously (at least with fuel, but I guess also with other variables) numbers smaller than 0.1 are treated as zero by the engine. So I invented the counter, which also allows to adjust the efficiency of the enhancer easily. (If would for example be possible to replace the number "3" by a variable like mission_scoopenhancer_efficiency that could itself be set by a script to something between 1 (0.1LY of fuel every ten seconds) and let's say 30 (0.1LY of fuel every five minutes).)

As for slowing Oolite down: no. In fact running through ALL the scripts every 10 seconds is just the way Oolite works. So if you have 100 OXPs with scripts installed Oolite checks out ALL THESE 100 scripts every ten seconds in order to determine whether in ANY of them ANY condition can be found that is matched right now. That's an awful lot of work to do for your computer, but usually you realize nothing of it. So even if you're still in Galaxy 1, but already have Assassins installed, Oolite runs through the script.plist in Assassins every ten seconds to find a matching condition. As the very first condition will not be met (wrong galaxy) and the rest is included in the following brackets, the engine will not check anything else in the script, but indeed this first condition is checked every ten seconds. And the same goes for all the other scripts you have installed. The only slowdown happens if a condition is met that is followed by A LOT OF commands, like adding hundreds of entities. Now this WILL lead to a short pause (usually things like that are done when EXITING_WITCHSPACE). But the few lines of code concerning the fuel scoops enhancer shouldn't make a difference (they don't on my machine), the only visible thing happening is a tiny increase of your fuelbar every now and then.

Posted: Sat Feb 24, 2007 8:22 pm
by Magus Zeal
Would it be possible to have the efficiency of the enhancer increase while in hyperspace or while using injectors? If you use injectors while near a sun, you scoop faster and your fuel refills much faster. Or is the device supposed to disable during hyperspace?

Posted: Sat Feb 24, 2007 9:41 pm
by Arexack_Heretic
Yes, the device is supposed to be inactive in witchspace and during witchspace transit.
::Insert some technOobabble abOot interference of small force interactors and dimensional field harmonics here::

I don't think increasing efficiency while using injectors is a good idea.
Although it would seem only logical, gameplay would be severely compromised by unlimited fuel injection.
(In effect a perpetuum mobilae)

Also while in 'J'-cruise mode, efficiency if anything should be reduced, as the ship is making mini-jumps, bypassing normal space and thus also the solar wind that is the source of fuel.

Another realism touch would be an incremental increase in fuelyield depending on distance from the sun.
Solarwind intensity decreases exponentially with distance from a stellar body.
Still, nothing compares to scooping in plasma directly from the corona.

::TechnOobabble to explain why this is not so; The magnetic field emanating from stellar bodies totally overpowers that of the collector, rendering it inoperable at distances below 1AU for the average G-type stellar body supporting an inhabited planet.::

Posted: Sun Feb 25, 2007 3:02 am
by Magus Zeal
Actually, if it's gaining less fuel than it's putting in, it's not really much of an infinite propulsion device, is it?

Posted: Sun Feb 25, 2007 12:11 pm
by Captain Hesperus
Magus Zeal wrote:
Actually, if it's gaining less fuel than it's putting in, it's not really much of an infinite propulsion device, is it?
Invent the Infinate Improbability Drive!

As an equipment damaged message: 'Warning: Teacup has been chipped!' or 'Warning: Warm tea has been spilt!'

Captain Hesperus
"My right arm's drifting off into the sunset. How am I going to work my digital watch now?"

Posted: Sun Feb 25, 2007 12:48 pm
by Charlie
Captain Hesperus wrote:
Invent the Infinate Improbability Drive!
OMG!

I must give this a go. 8)
I wonder if it can be done on Oolite...

I suppose such a .oxp would come under the 'silly' category..?

Posted: Sun Feb 25, 2007 12:56 pm
by Captain Hesperus
Charlie wrote:
I wonder if it can be done on Oolite...
Well, it does work on the concept that the ship is in EVERY system at EXACTLY the same time, so I don't know if that would be affected by the 7ly limit.
Charlie wrote:
I suppose such a .oxp would come under the 'silly' category..?
Most definately!! :wink:

Captain Hesperus
"Lave to Diso by way of every other system in all eight Galaxies. Bit of a round trip, isn't it?"

Posted: Sun Feb 25, 2007 2:38 pm
by reills
I have now covered my hean in my towel so I cannot see any of this silliness. Therefore, I... I mean it, does not exist. :D

Oneway ticket to Eroticon 6 please...

Posted: Sun Feb 25, 2007 6:26 pm
by Magus Zeal
Heh, Infinite Improbability Drive.

Does Oolite have an RNG?

If so, would it be too much of a slowdown to assign each of the planets in each of the galaxies a random number, generated on time of use? n(1000) or however many planets there are. Warp to a random planet in a random system. Mmm, the fun.

Posted: Mon Feb 26, 2007 10:00 am
by TGHC
Oy, you're making my head hurt, I'm still mulling over relativity and switching head lights on!

Ahh, but one thought...... Infinite Improbability Drive..... that would have to have a variable constant to work properly.... I think.

Posted: Mon Feb 26, 2007 3:34 pm
by Commander McLane
Arexack_Heretic wrote:
Also while in 'J'-cruise mode, efficiency if anything should be reduced, as the ship is making mini-jumps, bypassing normal space and thus also the solar wind that is the source of fuel.

Another realism touch would be an incremental increase in fuelyield depending on distance from the sun.
Solarwind intensity decreases exponentially with distance from a stellar body.
Still, nothing compares to scooping in plasma directly from the corona.
To the first point: In the beginning I actually wanted to make it work only during normal flight, but I didn't find a way to script that, as there is no status_string STATUS_IN_HYPERFLIGHT. So how can you query whether you'r in 'J'-mode or are using your witchdrive-injectors at the time? I wouldn't know.

To the second point: I hadn't thought of that, but it has the same question to it: How could you query the distance from the sun?

And I fully agree to the last point: The Fuel Scoops Enhancer is not designed to compare to sunskimming. So of course the MIT-advertisment lingo of "major breakthrough" is actually that: advertisment lingo. My original idea (apart from "let's see if I can invent and script a new piece of equipment", which I seemingly could :) ) was to have something to help you out of a dangerous situation when you have used your injectors a lot and are ambushed by a gang of pirates.