aliens

Author Topic: Clip ammo checking. (Now the variable elerium thread)  (Read 15554 times)

Offline SeanEBlog

  • Sergeant
  • **
  • Posts: 34
  • https://openxcom.org/forum/index.php?topic=1266.0
    • View Profile
Clip ammo checking. (Now the variable elerium thread)
« on: May 26, 2013, 01:06:07 pm »
One thing I feel that urks me is that perfectly good bullets are discarded after a battle because they are no longer part of a full clip. Could we add in a system that adds up all remaining rounds of ammo returns an appropriate number of clips back after battle? Or takes the ammo from partially depleted clips and adds them to a third item type group "stray rounds", which can be manufactured back into clips at a later time.

I think the such a system could be used to add some variability to how game handles elerium as well. Instead of each elerium unit being multiplied by 50 at the end of each round, each elerium unit could be a "clip" type item with an amount of actual elerium inside, a amount which is influenced by appropriate factors, such as ship type and time spent flying around, and a random plus or minus factor.

Also, this system would also allow aliens such as floaters and cyberdisks to carry (or spawn on death) units of elerium, as it makes sense that their bodies contain small amounts of elerium.
« Last Edit: May 31, 2013, 11:15:47 pm by SeanEBlog »

Volutar

  • Guest
Re: Clip ammo checking.
« Reply #1 on: May 26, 2013, 01:40:42 pm »
Ammo from clips is already counted and re-packed, with dropping last unfinished clips.

Offline Morbo

  • Squaddie
  • *
  • Posts: 8
    • View Profile
Re: Clip ammo checking.
« Reply #2 on: May 27, 2013, 07:24:42 am »
Ammo from clips is already counted and re-packed, with dropping last unfinished clips.

Can you clarify on that? That wasn't very clear at all, especially the last part. So do half used clips still inside guns "disappear" after the mission is over like original vanilla xcom? Or do they get "topped" up back to a full clip and added back to inventory?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Clip ammo checking.
« Reply #3 on: May 27, 2013, 07:45:07 am »
Can you clarify on that? That wasn't very clear at all, especially the last part. So do half used clips still inside guns "disappear" after the mission is over like original vanilla xcom? Or do they get "topped" up back to a full clip and added back to inventory?


to clarify:

individual rounds are totalled
that number is divided by the clip size
you get that number returned to your stores.
the remainder is lost, so at most, you will lose less than a single clip.
« Last Edit: May 27, 2013, 10:31:56 am by Warboy1982 »

Offline SeanEBlog

  • Sergeant
  • **
  • Posts: 34
  • https://openxcom.org/forum/index.php?topic=1266.0
    • View Profile
Re: Clip ammo checking.
« Reply #4 on: May 27, 2013, 11:36:12 pm »
Yeah, turns out what I wanted was already in the game. I was still playing with the habit of using as few soldiers as possible to preserve ammo.
« Last Edit: May 28, 2013, 01:52:39 am by SeanEBlog »

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Clip ammo checking. (whoops)
« Reply #5 on: May 30, 2013, 10:37:33 am »
individual rounds are totalled
that number is divided by the clip size
you get that number returned to your stores.
the remainder is lost, so at most, you will lose less than a single clip.
Warboy, this commit was not accepted. https://github.com/SupSuper/OpenXcom/pull/351
Now uses other algorithm:
1. rounds counting for each tile separately;
2. for each tile, for each type of rounds, calculated  total_clips = total_rounds / clip_size + 0.5;
3. for each tile, total_rounds total_clips added to base's store.
https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/DebriefingState.cpp#L1028

For example:
I use Heavy Canon and AC-HE rounds for demolition walls on the second floor.
I need 2-3 shots per mission.
Possible buy only one AC-HE clip and use this clip to end of the game)
« Last Edit: May 30, 2013, 03:39:58 pm by redv »

Volutar

  • Guest
Re: Clip ammo checking. (whoops)
« Reply #6 on: May 30, 2013, 12:46:30 pm »
Weird. Why TILES are mentioned for clips recover? How TILES are related to that?
I thought only clip type and number of bullets in each are matter.

Offline AMX

  • Sergeant
  • **
  • Posts: 35
    • View Profile
Re: Clip ammo checking. (whoops)
« Reply #7 on: May 30, 2013, 10:24:56 pm »
Yes, this seems kind of bizarre.
Why per tile?
And why should half-full clips count as full?

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Clip ammo checking. (whoops)
« Reply #8 on: May 30, 2013, 10:54:06 pm »
This is normal.
Anyway after battle need go around all tiles and get all items from the floor.
https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/DebriefingState.cpp#L743

The problem in the following calculation.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Clip ammo checking. (whoops)
« Reply #9 on: May 30, 2013, 11:16:29 pm »
redv, but in this way, ammo rounds are basically created from thin air, right? as long as you don't use more than half a clip, it magically refills at the end of the battle?

this seems very wrong to me. it would be way better to count all remaining rounds, use those to fill the available clips, and discard any non-full clips. including the one that's possibly only missing one round, but in terms of believability, that's still better than magically regenerating bullets.

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Clip ammo checking. (whoops)
« Reply #10 on: May 31, 2013, 01:06:07 am »
At least could call rand() to determine if clip is salvaged or throw away.

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Clip ammo checking. (whoops)
« Reply #11 on: May 31, 2013, 09:46:11 am »
redv, but in this way, ammo rounds are basically created from thin air, right? as long as you don't use more than half a clip, it magically refills at the end of the battle?

this seems very wrong to me. it would be way better to count all remaining rounds, use those to fill the available clips, and discard any non-full clips. including the one that's possibly only missing one round, but in terms of believability, that's still better than magically regenerating bullets.

At least could call rand() to determine if clip is salvaged or throw away.

Yep, I'd say do a weighted RAND based on the remaining rounds in the clip to determine whether the last clip is discarded. Over the course of your game this should roughly result in using clips at roughly the same rate as you shoot through a clip's worth of rounds.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Clip ammo checking. (whoops)
« Reply #12 on: May 31, 2013, 11:24:36 am »
weighted RAND for last clip is fine, but first and foremost we shouldn't check per tile. that's a really weird way of doing it.

imagine 10 soldiers with standard rifles, each with one clip containing 20 bullets. each soldier fires 5 shots. at the end of the battle, in the current system, you lose no bullets at all, since each clip has more than half of its bullets remaining. you get 50 bullets for free!

instead, the system should check for the total amount of bullets (10*15=150) and refill the available clips, resulting in 7 full clips and 2 empty ones, which are discarded, and one clip with 10 bullets, so you could argue that this one should be either discarded or turned into a full clip with a 50% chance.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Clip ammo checking. (whoops)
« Reply #13 on: May 31, 2013, 11:55:44 am »
Added a commit for the calculation of clips, left after battle:
https://github.com/SupSuper/OpenXcom/pull/496

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Clip ammo checking. (whoops)
« Reply #14 on: May 31, 2013, 12:49:31 pm »
the way you did it is probably the cleanest way. (dropping the partially loaded remaining clip, that is)



as for the other part of the thread's topic: changing Elerium to be an ammo-like item would totally make sense to me. it is treated like fuel for in-game purposes like refueling advanced XCom craft, but comes only in chunks of 50 off the battlefield. when manufacturing, you have stuff that uses 1 unit of elerium per unit manufactured.

a change that turns battlescape Elerium into a "container" which holds a maximum of 50 units would also add variety to UFO crash sites: the explosion of a crashed UFO's power source should be scaled according to how much Elerium was left in it when it blew. If you hunted a UFO across half the globe before shooting it down, you might end up with a far less damaged crashsite.

of course, this could create balancing issues, because you will receive less elerium per power source - but I don't know if that's a bad thing. Elerium shortage could add some late-game fun, when you suddenly have to resort to more conventional technology.

I'd say this is worth a try. Is there anybody who could program the necessary changes as an optional game mechanic?