Page 1 of 3

How many missiles is too many?

Posted: Sat Nov 28, 2009 5:32 pm
by Kaks
While the number of missiles a player ship can have is capped at 16 - even for capital ships - we don't seem to actually have a missile limit for NPC ships.

I have seen some ships with 24 missiles out there, so my original thought was to cap the number of missiles an NPC can have to 32.

Is that number going to be too limiting for some oxps?

Posted: Sat Nov 28, 2009 6:22 pm
by Killer Wolf
personally i think anything into double figures is pushing it, even for a pure combat ship.

Posted: Sat Nov 28, 2009 6:58 pm
by Cmdr James
Is there are reason to cap it?

Posted: Sat Nov 28, 2009 8:24 pm
by Kaks
I'm reworking the NPC missiles - that part of the code is very fast, but also very simple, to the point of being brain damaged*.

What I've noticed, though, is that:

a) missiles were supposed to be capped at 16 for both player and NPCs
b) that capping was never enforced for NPCs, and we've already got some NPCs with 24 missiles, possibly more missiles too.

Aside from other considerations, reworking that 'simple' code into something slightly sensible will make the game slightly slower. Capping the number of missiles will tell us how slower it's going to be - in the worst possible case - after the code change.


* The way the code has been since at least 1.65 makes missiles behave like subatomic particles until they're fired. We can tell how many there are, we can tell they're likely to be 'EQ_MISSILE's (ok, that bit can be overridden by a shipdata setting) but the engine doesn't know for sure which missiles are there until the missiles are fired. And we can't tell how many missiles the ship had to begin with, just how many it's got right now.
In addition to that, there's absolutely no way to specify 2 or more missile types for an NPC to have, under any circumstance (however, we do get variety from the 'quantum' fluctuations that can transform an 'EQ_MISSILE' into any other missile/bomb when fired).

Posted: Sat Nov 28, 2009 9:30 pm
by Cmd. Cheyd
Cap it at 24 and make a JS event for when the player selects a new missile. They they can use JS script and an array to remove equipment and add new equipment in the missile slots so it would appear that they were rotating missile "banks". This would also let authors define say a 6 missile limit, but a java script limit of 24, so they could have 4 banks of 6. If that all makes sense. There's be some issues to work through - You'd have to be able to trigger the event, even if you were out of missiles or not when not at a full load for that bank, but you get the idea...

Posted: Sun Nov 29, 2009 11:48 am
by drew
How many missiles is too many?
The way I fly... one! :lol:

Cheers,

Drew.

Posted: Sun Nov 29, 2009 4:30 pm
by Kaks
Cmd. Cheyd, the player's missiles are already capped at 16 anyway.

The NPCs were the ones that could theoretically have 60000 'quantum' missiles up their sleeves, and there's no need for them to have banks of missiles, or an interface.

Anyway, I went ahead with both rewrite and 32 NPC missile capping, and there doesn't seem to be too many problems. The new code creates all the NPC missiles when the ships are spawned, and the proportion of EQ_MISSILEs to the more exotic varieties is exactly the same as before. But now we can remove / add specific types of missiles & generally treat NPC missiles in javascript the same way as we would player missiles... As an effect of those changes, the key max_missiles now works properly for NPC ships too.

And now we'll need to revisit the player's missiles. The code handling those is definitely clunkier (wastes more memory & processor cycles) than it needs to be...

Commander Cheyd, in theory someone could already write a 1.73.4 oxp to would replenish your entire missile bay once the last missile was fired. It's not quite the same as the banks of missiles you were talking about, but it might help people that might feel the current 16 player missiles limit a bit too er... limiting! :)


The way I fly... one! :lol:
I know that feeling! :D

Posted: Sun Nov 29, 2009 6:45 pm
by Thargoid
But does it make sense for a capital ship or even a station to be such limited?Not that there aren't ways to work around it if desired anyway...

Posted: Sun Nov 29, 2009 7:09 pm
by Kaks
Well, we do need a semi-practical limit. The new code does open up a lot of scripting possibilities for missiles, though. You can now keep replacing NPC missiles immediately after firing, so in practice you now have unlimited NPC missiles. Before, you could easily have 64 or more missiles for NPCs. but once gone, they were gone for good!

You can even script ammo ships, ones that rendez-vous with other NPCs and/or the player, and replenish ammo. I might be a bit of a dreamer, but you could have some really epic battles now: as an example, you could have one really really strong ship moving slowly, being attacked by a fleet of very fast ships, each carrying a missile or 2, who need to go back to the ammo ship to restock their missiles...

And you can now award & remove equipment, & script damaged equipment & repair on npcs too...

We're not quite there yet. We're still missing NPC shields, proper NPC manifests, and scripted contracts & passengers for NPCs (it's still a new feature for players too - and only available in trunk), but fingers crossed, they might be in EMMMMR post MNSR!

Posted: Mon Nov 30, 2009 8:39 am
by Commander McLane
What I would wish for is a more sensible missile-use routine for NPC. Currently, if they have many, they tend to fire all of them at once. NPCs with a more limited supply tend to use them more wisely.

At least this is how it seems. I am not even sure if this is indeed coded somewhere, or I am just hallucinating this behaviour pattern.

Posted: Mon Nov 30, 2009 10:13 am
by Kaks
I must confess I've no idea! The missile usage is somewhere in the depths of the AI routines, and - so far - Eric is the only one who manages to understand that stuff without developing some strange facial ticks...

But hey, in 1.74 you'll be able to have it both ways. You can have an NPC max_missiles = 4 (max_missiles was meaningless for NPCs, so it was never used for them before 1.74), then in its ship script you can add an independent this.missileReserve javascript variable.

When this.ship.missiles.length < 2 you can always top up your NPC missiles with awardEquipent(), decrementing this.missileReserve as you do that.

The stuff above seems to be very possible in trunk already...

Posted: Mon Nov 30, 2009 12:24 pm
by Eric Walch
Kaks wrote:
I must confess I've no idea! The missile usage is somewhere in the depths of the AI routines, and - so far - Eric is the only one who manages to understand that stuff without developing some strange facial ticks...
When in attack mode, performAttack does every frame the next calculation (a bit rewritten for readability):

Code: Select all

	// use weaponry
	missile_chance = 1 + (ranrot_rand() % (3.2 / delta_t));

	hurt_factor = 16 * pow(energy/maxEnergy, 4.0);

	if (missiles_available > missile_chance * hurt_factor) [fireMissile];
Here is delta_t the time between two frames.

Or in plain english: the more missiles are present or the lower the ships energy is, the more likely it is to fire one. By itself this already caps max_missiles as in my opinion is was useless to award more than a few missiles. Defining more than a few missiles only leads to unrealistic, missive missile releases.

When we really want NPC ships with larger amounts of missiles, above calculation needs also something as the time since the last missile fired. (like it does for laser shots)

Posted: Tue Dec 01, 2009 2:54 am
by wildstar
Thargoid wrote:
But does it make sense for a capital ship or even a station to be such limited?Not that there aren't ways to work around it if desired anyway...
i agree that huge capital ships should have greater amount of missiles but they too need a random cap somewhere between 34 and 150 missiles in total depending on the size of the capital ship / battle cruisers or whatever ya wanna callem. couldn't the amount be based on an estimated amount of plausible weapons cargo space that one might imagine a particular ship to have?

how many did the enterprise in star trek have? ok i know this aint star trek and nor is this meant to be a realistic life in space scenario (or is it? Oo) but entertaining to say the least is what is should be. i think a capital ship running out of missiles might not be very entertaining if the missiles it did have are expended early on in the thick of battle.

I personally would imagine a limited number of missile launchers as there already are and aside from having a dozen or so immediately ready for replenishing those fired it would make sense to have a delay for continued replenishing of the missiles from weapons cargo bay.

the delay would be good so not to have npc ships dump a truck load of missiles upon you all at once.

Posted: Tue Dec 01, 2009 10:36 am
by DaddyHoggy
But by limiting the number of missiles is just a code fix - as Kaks explained, big capitol ships can be silently or obviously re-equipped with additional missiles on the fly (a continuous resupply from the armoury or a missile supply ship - both would make excellent oxps)

Posted: Tue Dec 01, 2009 11:00 am
by wildstar
DaddyHoggy wrote:
But by limiting the number of missiles is just a code fix - as Kaks explained, big capitol ships can be silently or obviously re-equipped with additional missiles on the fly (a continuous resupply from the armoury or a missile supply ship - both would make excellent oxps)
right i agree. and while i do not know how much realism can be added and how accommodating the existing game code is it would be a nice AI based OXP to have larger ships have to send out for more supplies when needed after expending their larger supply of missiles or even fuel chaff and drones etc. while on (and i dont know if it even exists yet) a say SUPER STAR CRUISER could even be self sufficient while making and salvaging and scooping for some of these supplies. it would be cool to see a super mega ship launch smaller ships to go around scooping and salvaging. and it is easy for me to imagine little green dudes and dudettes cranking out missiles on an assembly line somewhere in one of the numerous areas of the mega ship.