Home » MODDING HQ 1.13 » v1.13 Coding Talk » [IDEA] New Magazine System
Re: [IDEA] New Ammunition System[message #280881] Fri, 27 May 2011 18:50 Go to previous messageGo to previous message
ctiberious is currently offline ctiberious

 
Messages:605
Registered:March 2007
@DepressivesBrot: Yes, we should be able to include the ability to have a "round in the chamber". Might need to include the ability to manually load (at least one round) in every weapon. But we will probably also need a new xml tag to say which guns have that kind of chamber. I know some weapons (the Uzi comes to mind) don't actually put a round into the chamber until the weapon is actually fired. Trying to load a round manually for that type of weapon would, I think, cause it to foul up.
Could actually take it a step further and seperate the "chamber" from the "feed queue".

@Dieter: Yes, with a feed queue that stored index numbers, you could setup a mag with whatever mix of ammo you wanted. Technically, such a system would even allow mixing of calibers so another system would have to be used to during the load process to validate that the ammo you try to put in the mag is compatible.

@Sandro: Since we'll need to add a few tags anyway, adding a few more for magazine properties is certainly possible. Although, creating mags with special properties (anything other then caliber and capacity limits) is perhaps beyond the initial scope of the system we're discussing. First priority should be simply to update the existing mag system. Then we can always come back along and look at adding tags that grant special properties. After all, every "special property" you want to add will need it's own special coding.
And you don't need the mag to be treated as an attachment in order to have a mag modify a weapon. As a matter of fact, it's unneccessary work if we did (though not impossible to code). We already have a variable in the existing OBJECTTYPE structure that stores the index number of the "ammo" we use. Under the new system, that "ammo" would become the mag, so we'd already be storing the empty mags index number. Any functions that we wrote to modify weapon paramters based on the mag in the weapon could simply look at the mags index number, rather then sifting through all attachment slots looking for any/all attached items of the "mag class".
As for ubMagSize in weapons.xml, that might actually be useful for denoting weapons that have chambers which could store a round even when the gun is unloaded. For instance, the Beretta M92 would get a ubMagSize=1 to designate that it can have a round in the chamber whether it's loaded with a mag or not, while the Uze would get ubMageSize=0. And weapons with internal mags would use the appropriate internal mag size.

@wil473: I don't think I would treat magazines as "fake weapons". We already have a Magazines.xml file. I think I'd simply just use this file more effeciently. ubMagSize in weapons.xml would be used to designate internal magazines (and "hand-loadable" chambers). ubMagSize in magazines.xml would tell the capacity of the magazine in question, which makes it a seperate entity from the weapon. That also keeps us from adding a bunch of new tags to weapons.xml that won't actually be used for weapons.

DepressivesBrot
@Wil: Guns might have the ability to hold ammo, but they can't hold feed queues of different types or calibers which requires a rework anyways.
Actually, that wouldn't be the case. The "feed queue" I'm thinking about is just a list of index numbers. We'd run a special function whenever we loaded ammo into a mag (or directly into a weapon) to verify that the ammo we are trying to load is valid for that mag/weapon. But if you had a mag that could support multiple calibers, then there is no extra work in allowing the code to list index numbers for different calibers.

Sandro
There is little need for that then. From my point of view, creating the single round item in the chamber slot, while deleting the apropriate entry in the attached magazine whenever you fire a bullet, isn't such a big deal for the code. There are FAR crazier procedures running endlessly in JA2 code (like vision) and have no impact on performance on our modern machines.
Yes, but why force the code to take extra steps that it doesn't need to? We can get all the same results whether we treat mags as attachments or not. The majority of weapons use a mag. The same can't be said for attachments like trigger groups, "Rod & Spring" or grenade launcher. Mags are an integral part of a weapon, so there's no reason we can't use the existing code which assumes a weapon has a mag in it.

wil473
I thought the mood was against storing every single bullet (even if it is just an ammotype entry in a very long list). Couldn't we get away with a formula? Ie. shorter list of the ammotypes involved that is repeated, and a placeholder as to where in the order is the next round to be loaded.
My concern with queues is simply that each bullet is not treated as an individual item. The current OBJECTTYPE stucture is around 115bytes at it's smallest (assuming 4 default attachment locations). If we include a 16bit feed queue, a 200rnd weapon would be around 415byts. But if we used a OBJECTTYPE for each bullet in the queue that same 200rnd weapon would be closer to 23115bytes. Even if we stripped the attachment data from bullets, we'd still be looking at 4715bytes. Obviously, modern computers should be able to handle that without any issue but why waste all that space unneccessarily?
That being said, this kind of feed queue isn't the most compact we could get. If we didn't need the ability to mix ammo, we could get away with a simple 8bit (or 16bit if you really need more then a 255rnd capacity) counter. I think the "feed queue" is the best compromise, though. Trying to compress the queue further while still allowing the ability to mix ammo would make things a bit more complicated as you'd have to include a 2nd queue that tracked how many rounds were associated with the next ammo index number. That increases the potential of bugs.

Report message to a moderator

First Sergeant
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: (New) Common Attachment Framework (new title; was The NAS Receiver)
Next Topic: Path finding problems in 1.13
Goto Forum:
  


Current Time: Sat Jan 25 13:09:52 GMT+2 2025

Total time taken to generate the page: 0.06395 seconds