Home » MODDING HQ 1.13 » v1.13 Coding Talk » [IDEA] New Magazine System
[IDEA] New Magazine System[message #280585]
|
Tue, 24 May 2011 11:50
|
|
Taro_M |
|
Messages:292
Registered:November 2008 |
|
|
I dont know if it was discussed before, but new ammunition system would be nice. Im thinking about something like in 7.62, where bullets are separate from magazines. You load magazine with bullets and gun with magazine. I just find it odd in JA2 that you can ram 4 8Rnd pistol magazines into mp5 and somehow, magically they turn into full mp5 magazine. Also my sniper with PSG-1 wouldnt be able to magically convert bag of 7.62 ammo into magazines .
[Updated on: Fri, 27 May 2011 20:19] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
Re: [IDEA] New Ammunition System[message #280590]
|
Tue, 24 May 2011 12:55
|
|
Kazuya |
|
Messages:208
Registered:January 2009 |
|
|
DepressivesBrotThat pops up every once in a while (most recent thread I remember) and the micro management junkies among us would love it. The problem with it is the truly unholy amount of items it would create when every single bullet and the magazine counts as a separate item. So unless someone has a truly ingeneous idea how to solve that performance issue, it's not gonna happen.
Kazuyas truly ingenious idea, that was presented in the thred, that DepressivesBrot linked to:
KazuyaChrisLJust keep in mind that if you treat ammo like an attachment, you increase the number of OBJECTs in the game to a very high number. Ammo treated as attachments would mean tracking each round as an individual OBJECT.
After thinking a little bit about this, I had the following idea:
Instead of modelling every single bullet as an object, use ammo objects with the following properties:
pseudocode:
class TAmmo
attribute: ammocount (integer) //represents the number of cartridges in that object
attribute: sequence (list) //represents a sequence of cartridges. The last item points to the first item (ringlist)
attribute: seq_pointer (pointer) // a pointer for traversing the sequence list
An ammo object is an attachment for a magazine and weapons get an additional "chamber" attachment.
When the player loads a gun, he attaches a full magazine to the gun. He then works the charging handle similar to a shotgun. This calls the "cycle" methode. This methode checks, if the ammocount is larger than zero. If so, the ammocount is reduced by one and another ammo object is created with ammocount=1. This new ammoitem gets automatically attached to the chamber attachment slot. Its sequence is a one item list with the value of ammo.seq_pointer (the ammoitem of the magazine, of course)
When a gun is fired, it fires the item from the chamber slot (deletes it) and calls the cycle methode.
In case it is not clear, what the sequence attribute is for:
sequence could look something like this:
"AP -> AP -> AP -> TR" With TR pointing to the first AP item again.
This would represent an ammo item, where three AP rounds are followed by one tracer round. seq_pointer would traverse the ringlist one by one, everytime the cycle mehtode is called to make sure, that the correct type of ammo is spawned in the chamber.
Of course, this would mean that a new interface would be needed for handling the new ammo and allowing additional merging and splitting of ammoitems, but on the other hand, only two additional attachments would be created.
Report message to a moderator
|
Sergeant 1st Class
|
|
|
|
|
|
Re: [IDEA] New Ammunition System[message #280602]
|
Tue, 24 May 2011 15:26
|
|
Taro_M |
|
Messages:292
Registered:November 2008 |
|
|
Yes, if this would ever make it into next version this system should be turned OFF be default, this way if dont want to use it then you will not even have to change any settings. If you like microing then you just change one stetting and there you go. As I said before: everybody will be happy.
[Updated on: Tue, 24 May 2011 15:27] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
|
Re: [IDEA] New Ammunition System[message #280606]
|
Tue, 24 May 2011 16:19
|
|
Sandro |
|
Messages:420
Registered:November 2008 Location: Mars |
|
|
KazuyaAn ammo object is an attachment for a magazine and weapons get an additional "chamber" attachment.
When the player loads a gun, he attaches a full magazine to the gun. He then works the charging handle similar to a shotgun. This calls the "cycle" methode. This methode checks, if the ammocount is larger than zero. If so, the ammocount is reduced by one and another ammo object is created with ammocount=1. This new ammoitem gets automatically attached to the chamber attachment slot. Its sequence is a one item list with the value of ammo.seq_pointer (the ammoitem of the magazine, of course)
When a gun is fired, it fires the item from the chamber slot (deletes it) and calls the cycle methode.
Actually I see this as a great idea. This would also ease the engine, because rounds in magazines wouldn't be handled as full "OBJECTs".
I don't think that the engine wouldn't stand that, I think it would. Most of the time you would probably not even mess with single ammo rounds, as you would be using magazines on magazines or boxes on magazines etc. to fill your desired type of magazine.
(More so, you could really ease the engine simply by creating different ITEM variable just for the single ammo rounds. This would be stored in different xml and has only those tags which are neccessary for it.)
Personally I like the idea and I would use it in my games if it'd be done.
[Updated on: Tue, 24 May 2011 16:20] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: [IDEA] New Ammunition System[message #280614]
|
Tue, 24 May 2011 17:52
|
|
Taro_M |
|
Messages:292
Registered:November 2008 |
|
|
Sandro
Not really. It means magazines would have their own variable containing ammo informations, thus the rounds themself wouldn't exist as separate objects. Weapons will have one more attachment slot - the chamber. When firing the weapon, the next ammo round from magazine is "created" and attached to that "chamber" attachment slot. When you fire a weapon the ammo object from the chamber is always deleted - used for the shot.
This would be a very ellegant solution.
So it will kinda work like grenade launcher, will there be any problems with burst and auto firing?
What about bullets? How would you transfer them from one magazine to another, or from ammo box etc.?
[Updated on: Tue, 24 May 2011 17:54] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
|
|
|
|
Re: [IDEA] New Ammunition System[message #280624]
|
Tue, 24 May 2011 18:28
|
|
Taro_M |
|
Messages:292
Registered:November 2008 |
|
|
DepressivesBrotSecond, that's the very problem we're trying to circumvent i.e. having thousands of extra items when you just need to store caliber and type in a list*.
*representative of any linear data type, whatever fits best.
If you are talking about bullets in editor then my idea would actually require less items. For example now you have 9x18 in following magazines: 8, 15 and 30. Thats normal ones, but then you have HP, AP, Gl and so on. That is at least 12 different items that are exactly the same in game terms. With my idea you would only have 3 mags and 3 bullet types.
I agree that my idea isnt the best, but we should discuss every possibility and maybe we will run into best solution.
[Updated on: Tue, 24 May 2011 18:29] by Moderator Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
|
|
|
|
|
|
Re: [IDEA] New Ammunition System[message #280636]
|
Tue, 24 May 2011 19:47
|
|
Kazuya |
|
Messages:208
Registered:January 2009 |
|
|
TaroCould someone explain that idea in layman's terms? I just understand that ammo would be attached to magazine and magazine would be attached to weapon. Or is it different?
Okay, let's assume, that your merc has an AKM.
The AKM has two new attachment slots, one called "chamber" and the other one "magazine"
Your AKM magazin contains a new value, capacity (30) and an ammo attachment slot.
Then you have your actual ammo, which represents loose 7.62x39 rounds. This ammo item is what I defined earlier in the thread.
Lets assume, that for our scenario, your merc has such an item in his inventory. ammocount=40.
Now you attach your ammo item to the magazine. When you do, the game checks if your ammo item can be attached to the ammo slot of the magazine. Both are 7.62x39, but capacity of the magazine is only 30. So now the game creates an ammo item in the ammo slot of the magazine with ammocount=30 and your original ammoitem, that you picked up with your cursor has now an ammocount of 10. You put the 10 rounds back in your inventory. Now you take your magazine and attach it to the magazine slot of the gun. The game checks, if your magazine fits, it does, so it gets attached. Now you operate the charging handle, which is similar to a bolt action rifle or a pump gun. This makes the game check your gun. It checks if a magazine is attached to the magazine slot. If it is, it checks if an ammoitem is attached to the magazine. In our case everything is fine so far, so now it reduces the ammocount of the ammoitem by 1 and spawns a new ammoobject with ammocount=1 in the chamber slot of the gun. Now you can fire, just like you used to do. But that's not it. You could also detach your magazine again and "merge" your ammoitem in your inventory with the 29 remaining rounds in your magazine and attach the magazine to the gun again. Now you can fire 31 rounds.
Firearms, that have no detachable magazines, like revolvers or shotguns, can attach the loos rounds item directly to the magazine slots. And would work from there. Internally, there would have to be a capacity for the gun, to determine how large ammocount may be for attaching to the magazine slot. If there is no such value, only magazines can be attached.
That's essentially what you would see as a player. But my system would allow for more things, like merging different ammoitems of the same calibre, but different rounds. For example, 7.62x39 AP rounds with 7.62x39 Tracer rounds. That's what would be handled with the sequence list.
A sequence list could look like this:
1. AP <-
2. AP
3. AP
4. TR
When the cycle method is called, either because the player operated the charging handle, or it is called by the game, because the player fired a gun, the arrow would go down the list. If it reached the bottom and cycle is called, it would jump back to 1. Now, when the game has to spawn a new ammoitem in th chamber, it would look at which position the arrow is, and spawn an ammoitem according to the value, that the arrow points to. In our case, we would get a tracer round after three armor piercing rounds have been fired.
Another sideeffect would be, that it gets easier to create new weapons with different "magazine capacities". Let's take a look at the Glock 17 for example. The standard magazine for the Glock 17 holds 17 rounds in real life. If we want to enable that in the game, a modder has to create a new magazine type and draw the picture for every single ammotype there is. So you have to create one 17 round magazine for the standard 9mm ammunition, one for AP rounds, one for hollow point and so on and so forth. With my system, all you need to do, is to create one new item. The actual 17 round magazine. Then you define, that AP, HP and so on can be attached to its ammoslot and you are done. As a side effect, we would get rid of many magazine items, that are currently present in the game. But we could also define alternative magazines for already existing guns. A 75 round drum magazine for the AKM for example would only require one new item in the items.xml. The current sytem doesn' really allow for different magazine for the same gun. But even if you manage to circumvent this restrictions, as some mods do, you would still have to create a new drum magazine for AP, HP, Tracer and so on and so forth. It gets even worse, if you want to add a new ammotype of a certain calibre. Let's say you want to create 9x19mm rubber bullets. Currently you would have to create every single rubber bullet magazine, 8 rounds, 15 rounds, 30 rounds, 50 rounds. Somebody created the 17 round magazine for the Glock that I mentioned, you may now create that variant two. Oh, did somebody create a 13 round magazine for the Browning? That would be another magazine that you have to create now. With my system, all you need to do, is to create one new ammoitem and add your ammoitem to the attachments list of the existing magazines and you are done.
The number of amm items currently grows with M*T, with M being the number of magazines and T the number of differenty ammo types. 5 different magazines and four ammotypes means 20 entries in items.xml and would grow exponentially with every further magazine or ammo type. My system would only need 9 entries (M+T) and would only grow linear.
To sum up the advantages of my idea:
-Allows for tactical reload
-Magazine capacity is defined by the magazine and not the gun anymore.
-Reduces the number of items needed in the game.
-Makes it easier for modders to create new magazine types
-Makes it easier for modders to create new ammotypes
-Allows individualized set of rounds in magazines. Fire armor piercing, hollow point, tracers and sub sonic from one magazine, if you want to. Drawback: would need new UI elements and functions to handle that in game.
The last point could be prohibited though. This way, we wouldn't need to worry about new UI elements for now
Report message to a moderator
|
Sergeant 1st Class
|
|
|
Re: [IDEA] New Ammunition System[message #280637]
|
Tue, 24 May 2011 20:12
|
|
Wil473 |
|
Messages:2815
Registered:September 2004 Location: Canada |
|
|
Careful there, you're making the same mistake I made originally. Current magazines are not attachments, and as per ChrisL, using the attachment infrastructure for a New Magazine System is not a good idea. See: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=268676#Post268676
Also, on reflection, a New Magazine System would increase items in items.xml as we would still need the old magazine items for that option to be retained.
Improved loose ammo handling on the other other hand could be applied to both new and old magazine systems. Meaning, this element, could be a mandatory change, and at the very least eliminate most of the shotgun shell sizes. Then again, we are talking about a reduction of a few dozen items, so it really it could be left optional as well and not really make a big difference either way.
Report message to a moderator
|
|
|
|
|
|
Re: [IDEA] New Ammunition System[message #280645]
|
Tue, 24 May 2011 21:05
|
|
Wil473 |
|
Messages:2815
Registered:September 2004 Location: Canada |
|
|
Interface requirements do suggest attachment-like handling of NMS magazines. This is already the case for launcher grenades, they are generally not defined in attachments.xml, but use the same attachment slot system. Also, under NMS, the eject ammo button on the interface could eject loose rounds, while removal of that NMS magazine from its attachment slot unloads the magazine (along with the ammo it contains).
Concept:
Common improved loose ammo system - for both Old Magazine System(OMS) and NMS. This would be just the current ammunition/magazine item system as now, but with the money-like drawing of amount of rounds from ammo crates, from non-magazine weapons, and from NMS magazines. The unload ammo button in existing interface on non-magazine fed weapons, unloads one round at a time into loose ammo items. EDIT: clarification, the current weapon interface, coloured bullet with counter, would be used by all ammo bearing items: weapons under both NMS and OMS, as well as NMS magazines, this way no new interface work needed.
Basic NMS - when active, all magazine fed weapons get their capacity reduced to 1 round, this is the weapon's chamber. NMS magazines act as containers for additional rounds up to a max size EDIT: using the magazine size bonus as the capacity for NMS magazine items. NMS magazines can be reloaded from ammo box or loose rounds. Common loose rounds mechanism unloads round one at a time (so you can share ammo in an emergency?) hot key unloads whole magazines not in inventory into ammo crates. Loose round allows 1 additional round to be added to weapon with loaded magazine. If magazine is removed, and number of rounds equals or is less than magazine size, all rounds removed with magazine. If weapon is in +1 round state, removal of magazine is removal of full magazine, leaving one in chamber (do we want chance of accidental discharge and casualty mechanism?)
Advance NMS - some mechanism to queue up multiple ammotypes to be the next round fed into chamber.
EDIT: I think it was suggested that multiple legal NMS magazine items be stored like multiple default attachments in either items.xml or weapons.xml.
EDIT2: could get away with a Basic NMS implementation with only a few new things for the XML's (and plenty of headache in the code)
- A boolean for whether or not a old magazine item is also a loose ammo item (similar to how ammo crates are flagged right now in items.xml)
- A new ItemClass for NMS Magazines, as noted above capacity would just be the mag size bonus
- multiple legal NMS magazine tags in weapons.xml, just list the NMS magazine item indexes
[Updated on: Tue, 24 May 2011 21:33] by Moderator Report message to a moderator
|
|
|
|
|
Re: [IDEA] New Ammunition System[message #280648]
|
Tue, 24 May 2011 21:51
|
|
Wil473 |
|
Messages:2815
Registered:September 2004 Location: Canada |
|
|
Ikaar, your idea is to treat empty magazines like a token that allows production of current magazine items, ie: if you empty a mag, and then reload, the produced empty magazine can be turned into a filled magazine by interaction with an ammo crate. You could only produce as many usable magazines as you have empties on hand. Definitely workable, and an expansion on the existing magazine system. Does your idea include defining multiple magazine sizes for a gun? Also, how about partial fills?
Something I forgot in my post, the need to store calibres somewhere, new tag in items.xml probably the simplest. Now my post from last year was mixed in with how to allow multiple (compatible) calibres in the same gun/magazine... so perhaps a list of multiple legal calibres (sorry, feature creep...)
EDIT: oh, wait you mentioned 0 round magazine items. Magazines are destroyed and created on loading and unloading (as well as when created when crates are clicked on with weapons). So there is no empty magazine item per sec to be ejected when a weapon runs out and is reloaded. An empty (0 round) magazine could be created and dumped into the map when reloading occurs though. The empty magazine in your system Ikaar would still be a token like device as it should be convertible into a same size and caliber magazine of any ammotype you have ammocrates available. Doubt you are suggesting a 0/30 round AP 5.56 magazine can only be refilled from AP 5.56mm.
[Updated on: Tue, 24 May 2011 22:02] by Moderator Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Jan 10 18:19:49 GMT+2 2025
Total time taken to generate the page: 0.02757 seconds
|