Negative Energy

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

Moderators: winston, another_commander, Getafix

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

Negative Energy

Post by Thargoid »

Came across this last night (winXP 1.73.4), strange quirk rather than a true bug I think. Had a little free time, so threw together some new weapons (bombs in the vein of the E-bomb).

Thing was I am using JS to deduct energy from the surrounding ships, and I noticed that if the target ship has more energy deducted than it has (ie it's energy goes negative) it just increases itself to zero (or one, not sure) and doesn't explode. The target ship just flies on merrily throwing sparks and recharging its energy banks.

Now I can understand the logic of not having negative energy, but wouldn't it make more sense in such a condition to have the ship explode rather than have the energy clamp itself non-negative?

I've worked around it in the script by checking if the damage is more than the ships energy and if so just telling the ship to explode, but the underlying clamping seemed odd to me.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6633
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

It may be that a scripter might not want to have the ship exploding at zero energy for whatever reason. If we make it so that ships explode automatically then the option of doing something else with the script is removed. We also need to consider that energy is an entity property, so it can be applicable to things other than just ships. I think it is best if it stays as is, even if it means that an extra line of code will be needed for causing a zero energy ship to explode.
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 »

I think this happens as a side-effect of another (buggy) bug fix. I remember that I once reported a bug in which a ship could "miss" the point of zero energy, therefore not explode, and while taking more energy damage drift deeper and deeper into the realm of negative energy. I think it was considered dead by the engine and didn't react anymore, but you could decrease its energy endlessly.

Probably at the time it was "fixed" in a way that produces exactly the new strange behaviour you observed now.

I also seem to remember that it was Eric who applied the fix, but I could be wrong with that.
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 »

Commander McLane wrote:
I think this happens as a side-effect of another (buggy) bug fix. I remember that I once reported a bug in which a ship could "miss" the point of zero energy, therefore not explode, and while taking more energy damage drift deeper and deeper into the realm of negative energy. I think it was considered dead by the engine and didn't react anymore, but you could decrease its energy endlessly.

Probably at the time it was "fixed" in a way that produces exactly the new strange behaviour you observed now.

I also seem to remember that it was Eric who applied the fix, but I could be wrong with that.
I remember this too - but am equally vague over the owner of the fix...
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
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 »

Commander McLane wrote:
I also seem to remember that it was Eric who applied the fix, but I could be wrong with that.
I am pretty sure I never changed anything with energy. As things work now it is no bug, but intended behaviour as A_C writes.

When a ship takes damage (energy-, scrap- or heat-damage), there is a check if energy becomes zero or lower because of this damage. If yes, the ship explodes.

But when a script sets energy to 0 there still has no damage occurred, it is just the energy that dropped to zero. It should be the script that decides if zero energy also means destruction.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

For example if you script firing of ECM or other equipment which uses energy, you probably dont want the ship to die.
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 »

Cmdr James wrote:
For example if you script firing of ECM or other equipment which uses energy, you probably dont want the ship to die.
Or it could be used as a plot device in an oxp - you may have to kill a ship, but the oxp author wants you to fight a horde of escorts too - so the player effectively reduces the target ship to zero energy (perhaps killing its engine too?) but doesn't make it blow up until say 20s after the last escort dies so that they can see it explode in glorious technicolour without being distracted by the escorts...
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

I can understand the logic, as I said originally it was more an observation than a bug report.

But I wonder if a new scripting request for a JS command ship.inflictDamage(number) might be useful for such occasions, to be able to "simulate" damage to a ship (or indeed possibly an entity) via script? Perhaps even add a second parameter to say what sort of damage (heat, laser, scrape etc)?

Basically so that things are handled "properly", and by extension the bounty and kill could also be awarded to the entity whose ship-script did the calling in the first place? That's something else I've had to "approximate" using the bomb's script, with all the usual glitches of Thargoid bounties.
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

This sounds much like the oddity that spawned the Ghost Ship Bug of v1.65.
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
Post Reply