Swap weapon ammo in flight.

Various ideas, possible solution.

I've been expirementing with different multi-mode weapons that can be changed in flight. So far the biggest restriction is that it's hard to have multiple weapons of the same type WITHOUT using date-post missions somewhere. Any time date posting is required to count and detect outfits to swap out the correct number, it becomes a potential issue. Do you really want day(s) to pass every time your weapon switches modes?

Let me give you the premise so you can see what is happening:
In the example of a turret that can be fired manually or in PD mode (the weapon swaps between turret and PD turret versions), when you buy the turret you also get a mission that you can abort in flight. This abortable mission simply removes the turret and replaces it with the other. When you sell the turret, the missions are removed.

As long as you only have one turret, everything works fine. When you have multiple turrets many problems arise. How do you control the starting of missions so that you don't get multiple copies of the same mission? When you sell a turret, how do you preserve the correct missions? Can you swap individual turrets? Or do they all swap at once? How do you acomplish either? Can it be done without date-posting?

One way to get around this is to restrict the player to only buy one, but have different buyable copies of the weapon. (Turret A, Turret B, Turret C, etc.) So each turret would have its own abortable mission set. The big obvious negative here, is that it's very resource hungry.

A different example involves a weapon that simulates swaping ammo loads, that can be swaped in flight, and is fired with the primary trigger. There are already solutions doing this with secondary weapons, but we can always expand the envelope, right?

Well I think I have a way to solve both problems, as long as the ammo fired is considered to be unlimited. In the case of ammo loads, we would have to assume that the rounds are so small as to take insignificant space.

To overcome the problem of using date-post and crons to detect and swap the correct number of weapons, we are instead going to swap the ammo. The ammo outfits are invisible, and are never bought and sold, and are never used up. You'll need to give a weapon resource for each variant of the weapon and have them point to different ammo types. The burst count will be set to something extremely high, and only use ammo at the end of the burst. Combine this with crons to Dxxx and Gxxx (refill) the ammo every time a day normaly passes, and the player will hopefully never run out.

What this allows, is only one ammo outfit (per type) to feed all the weapons. Because only one outfit is being swapped no mater the number of weapons, it vastly simplifies the process.

The restrictions present in this solution are that all similar weapons will fire the current ammo, no mixing. Also, I think crons (and therefore date-posts) will need to be run when trying to sell the weapons. (Each buy and sell will have to ensure that one and only one ammo outfit is present, except when all the weapons are sold, in which case no ammo item should be present) Actually, scratch that, since the ammo items are invisible, I guess it doesn't matter if the player has them without the weapons. Hmmm. Yeah, just make sure the buy button Dxxx the possible ammos, and then Gxxx the default. Then you will always have one and only one. Alternately you can make a cron that will "clean-up" un-needed swaping missions and ammos.

Ok, so the benefits are:
Swaping modes/ammo in flight without date posting.
Works for multiple weapons even if they're the same type.
Works for the primary trigger weapons.

The negatives:
Each weapon type must be the same mode/ammo.
Cannot represent limited ammo effectively.

Positive/Negative:
There is a delay when swapping (self-destructing dude time). Could be a problem, but also could represent a re-load time.

Normally, you will only need one active mission for a weapon set. It is like a toggle switch.
If you have the space for an active mission for every mode/ammo type, more like a set of push-button switches, you can make it so that certian modes/ammo are only able to be gained at certian outfitters. (You gain the appropriate abortable missions at particular places.)

Ok, I found something interesting.

If you have a high burst count, like 30000, multiple weapons will not increase the rate of fire.

What happens (I think) is this:
First, remember that burst count is multiplied by the number of weapons you have.
So, if using the trick in the previous post, keep burst count low enough to account for the most weapons one would have, but high enough to avoid running out of ammo.

In this case, multipling 30000 by even just two overflows the max value of that field. For some reason, when this happens a group of weapons have the same fire rate as having just one.

In another example with burst count of 10000, you can add weapons and the rate of fire will increase as it should until you add the fourth weapon, when it drops back to the rate when having one.

I'm not sure what use this might have, though. Perhaps some kind of alternate control on the number of weapons one could have?

This also hints at another way to get interesting results by overflowing number fields. I wonder if some other things can be found by overflowing numbers that the game multiplies or otherwise modifies?
What happens when ModMax overflows a value?
What about the fram0bias on spobs? That's a multiplier, but admittedly probbly won't do much. But then again, there doesn't seem to be much relation between burst count and rate of fire...

This post has been edited by Desprez : 06 September 2006 - 10:45 PM

Very interesting effect you found there from overflowing BurstCount. If you set it to something low, and have enough weapons to overflow it, does the time between BurstReloads also reset to the base number?

On the subject of overflowing numbers, here are the ones I've tried personally:
Outfit number (via Gxxx): If you get more than 32767 of an outfit, you end up with 0 of that outfit.
Credits: If you pass 2^31-1 credits, they reset to zero.
Shields/Armor: Despite great efforts, I do not think that I have succeeded in overflowing the armor and shield variables for my ship. You would think that 4294868996 shields would cause the game to at least blink , but nothing happened. Nothing unusual happened down at 2^31, either. I haven't tried the absolute max yet (32767^2 * 4 * 512 + 32768*5), but even that may not do anything.
Fuel: I'm pretty sure that going over either 32767 or 2^31 reset max fuel to 0. I didn't notice any other effects, although admittedly I didn't try to do anything that required fuel.
Weapon Range: If the total range of a weapon is greater than 32767, the AI won't fire it. I do not remember if you could fire it yourself.
Calendar: Time travel!

In a quick look through the Bible, I didn't notice anything that said "overflow me!", but then, I didn't expect to see anything from BurstCount, either.

--------------------
Oh, and nice job on the swapping-weapons hack!

Edwards

This post has been edited by Edwards : 07 September 2006 - 12:30 AM