NPCs and laser temperature

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
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:

NPCs and laser temperature

Post by Commander McLane »

An issue which popped up in another thread prompts me to ask a question I had for a long time: How is laser temperature and overheating handled for NPCs?

In the target inspector almost each shot brings the bar from 0 to 1, where it stays without dropping until the next shot is fired. There is no visible relation between number of shots fired and laser temperature, also no sign of an effect of overheating.

Basically it looks like, although a laser temperature is defined, no sensible handling of it exists at all. Is that a correct observation?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

“Laser overheating” for NPCs is modelled as a random chance of a random penalty to the delay between shots. Both the chance of this happening and the duration of the penalty is dependent on weapon_energy.

Code: Select all

    // random laser over-heating for AI ships
    if ((!isPlayer)&&((ranrot_rand() & 255) < weapon_energy)&&(![self isMining]))
    {
        shot_time -= (randf() * weapon_energy);
    }
The temperature gauge in the debug inspector shows laserHeatLevel, which was added to ShipEntity for shader bindings – it’s never used internally. The calculation is (recharge rate - time to next shot opportunity) / recharge rate, clamped to [0..1]. In other words, it will rise to 1 on a shot without a penalty, then drop to 0 over the recharge time, after which the ship can fire again. if the penalty is incurred, it will saturate at 1 during the penalty period.

As far as I can see, there is no penalty mechanism at all for subentity weapons.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: NPCs and laser temperature

Post by Eric Walch »

Commander McLane wrote:
Basically it looks like, although a laser temperature is defined, no sensible handling of it exists at all. Is that a correct observation?
I think you are correct. The NPC laser heat is based on a random value, defined after each shot.

Or more precise:

Code: Select all

	[self resetShotTime];

	// random laser over-heating for AI ships
	if (((ranrot_rand() & 255) < weapon_energy))
	{
		shot_time -= (randf() * weapon_energy);
	}
And shot_time increases in seconds. An NPC can shoot again if shot_time > weapon_recharge_rate. So stronger weapons take longer to cool.

Edit: it was shot_time > weapon_recharge_rate, not shot_time > weapon_energy
Last edited by Eric Walch on Tue Apr 13, 2010 2:29 pm, edited 1 time in total.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: NPCs and laser temperature

Post by Frame »

Commander McLane wrote:
An issue which popped up in another thread prompts me to ask a question I had for a long time: How is laser temperature and overheating handled for NPCs?

In the target inspector almost each shot brings the bar from 0 to 1, where it stays without dropping until the next shot is fired. There is no visible relation between number of shots fired and laser temperature, also no sign of an effect of overheating.

Basically it looks like, although a laser temperature is defined, no sensible handling of it exists at all. Is that a correct observation?

coincidently i found out about weapon_energy, the larger the more likely it is to random overheat.

Cheers Frame
Bounty Scanner
Number 935
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

Ahruman wrote:
As far as I can see, there is no penalty mechanism at all for subentity weapons.
Does this mean that laser subentities, such as on a Rattlecutter, will not overheat, in other words, they can just keep on firing indefinitely?
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

Diziet Sma wrote:
Ahruman wrote:
As far as I can see, there is no penalty mechanism at all for subentity weapons.
Does this mean that laser subentities, such as on a Rattlecutter, will not overheat, in other words, they can just keep on firing indefinitely?
Worryingly, that's what I suspect to be the case! (I'm sure Ahruman will confirm)
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Diziet Sma wrote:
Does this mean that laser subentities, such as on a Rattlecutter, will not overheat, in other words, they can just keep on firing indefinitely?
As far as I can see, yes.

This of course suggests the follow-up question, “Why don’t you fix it, then?”

The ideal fix would be for NPCs to have the full player-style overheating mechanism. However, for this to work well the combat AI would need to be revised to take overheating into account, and I frankly have no idea how to go about it.

A simpler approach would be for the random “overheating” penalty to apply to all weapons on a ship. Since different weapons can have different firing rates, this would need the cooldown timer to be separated out, but it should be reasonably easy.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Diziet Sma wrote:
Does this mean that laser subentities, such as on a Rattlecutter, will not overheat, in other words, they can just keep on firing indefinitely?
They can't fire indefinitely as there is still the check

Code: Select all

if ([self shotTime] < weapon_recharge_rate)
that sets a minimum interval for subentity shots, based on the weapon_recharge_rate.
And yes, as Ahruman just writes there is no extra time penalty like with the main weapon. However, when a ship has both a main- and sub- laser, the sub lasers will also respect the overheat time of the main laser.
User avatar
snork
---- E L I T E ----
---- E L I T E ----
Posts: 551
Joined: Sat Jan 30, 2010 4:21 am
Location: northern Germany

Post by snork »

Ah, see.
I was wondering why the only multilaser ship in my game (snark : 1 main and 2 subentity front lasers) was always stopping to fire after a while.
(They are tough enough like this :D )

So, as long as ships have main lasers firing in the same direction as their subentity weapons, everything is fine ?
Post Reply