Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

Visual ammunition count?

Discussion in 'General Discussion' started by Pixie40, Sep 18, 2020.

  1. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    Greetings and salutations! I'm working my way towards a few projects I want to do. Currently I'm no where near ready yet. I've learned a good deal about using Blender for 3d modeling, and have moved on to learning C# coding. But I was wondering if a desired system was actually possible.

    For the projects I am aiming to make, I want to have a mix of ranged combat using bows and crossbows and melee combat using swords and daggers. I want ammunition to be limited to only what can be held in your quiver. One of the projects I want to do in VR, and will have a quiver on your hip for your crossbow. The other will have a quiver for your arrows on your back. But I don't want to have a floating number for ammunition count. Is it possible to track arrows/bolts by actually showing one to 18 arrows/bolts in the quiver, with them being depleted as you pull one out to fire?
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,324
    Yes, it is possible. Just make one object per arrow, and remove the ones that aren't there.
     
  3. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    Cool. Will have to figure out how to do that at some point. Don't think I've ever seen a game track consumable ammunition via showing the ammunition it's self before. I was thinking of having special weapons that can generate unlimited ammunition when you prep to fire, but they have much lower damage then normal ranged weapons. Possibly special ammo that's scarce and visually distinct from regular arrows/bolts too. Again, will have to think about this as I'm learning more of coding with C# and 3d modeling. At the moment I'm using yoinked scripts from the FPS microgame until I learn enough to actually write my own. Well, or have the spare funds to buy scripts from the asset store.

    EDIT: Just realized that for using a crossbow, my idea could potentially let the player have 20 shots. One bolt loaded, one in the off hand being held, and 18 in the quiver or pouch (if I go with a hand crossbow).
     
    Last edited: Sep 19, 2020
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    Half Life: Alyx is the closest to your description. With the pistol, for example, you pick up the ammo, load it into the pistol, and then pull back on the top of the pistol to engage the clip. Removing the clip is simpler and consists of just pushing a button on the controller. Available rounds are shown on the side of the grip of the pistol.

    Keep in mind too you're going to have to find a way to make it comfortable to do too because the player won't have the object in the real world which may make it difficult to perform the steps. Once again turning to Half Life: Alyx the way you pick up the ammo is by pointing and yanking your hand and it jumps into it.
     
    Last edited: Sep 19, 2020
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,324
    It is a fairly common thing. However this is something you rarely notice. (outside of VR that is)

    It is also much more likely to be implemented in a VR title.
     
  6. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    For the non-vr game, I'll likely use a 3rd person over the shoulder camera, so the player can see the quiver. For the VR one I have decided to go with a crossbow, with the bolts being in either a utility pouch or quiver on the hip. Either way, it'll be easy to just look down to see remaining ammunition. After making that decision, I have spent a bit of time making a few different models for crossbow bolts of various colors and materials. That way I can have stronger ammo, weaker that's more plentiful, and specialty ammunition. Oh, and have them identifiable at a glance. I'll probably go with utility pouches for ammo storage (based on how I actually do carry the bolts for my crossbow pistol), so that different types of ammo can go in different pouches for easier selection in VR.
     
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,324
    Be aware that the player most likely will not be looking at quiver often.

    In a combat heavy situation without visible ammo counter, I'd expect player to start counting shots.

    Because that's what I end up doing in shooting games.(gun club VR, for example).
     
  8. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    Oh, I know that. I find myself counting shots in Arizona Sunshine to ensure I don't eject a partial clip. Yeah, there's visual cues that you're gun is out of bullets. But in a heated firefight that's not always noticeable. Even then, all too often I don't know the gun's empty til I hear the CLICK when I try reloading.

    EDIT: I was planning ranged combat to be a backup/stealth choice, with melee being the main combat option. Not enough ammo to take everything out in a strait up fight, especially if you're not particularly accurate. When you only have 12-18 shots total for long stretches of time, I find you tend to be a lot more judicious in when you engage in ranged combat.
     
    Last edited: Sep 19, 2020
  9. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,324
    The other good strategy is to ensure you reload when there's still one bullet in the barrel, so you won't need to cycle the weapon by hand again. Meaning you can fire continuously. (No idea if it works on a real gun). However that does not apply to crossbows.
     
  10. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    Not with standard styles or modern crossbows. Having to cock, then load is a thing with crossbows. And not all crossbows have a way to hold the bolt in place, which means it can become unloaded if lowered or jerked around. I might implement a "push button" cocking method that triggers an animation for that, rather then having the player manually do so. That way I can have different models have the proper cocking method, such as heavy crossbows requiring a wench, goat's foot, or foot loop to cock. If the crossbow's suppose to have a heavy pull, it'd feel kind of silly to be able to cock it with the same ease as a nerf gun.
     
  11. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,324
    Well, there's also this:
     
  12. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    I did say standard styles. The Zhuge Nu is not a standard crossbow style. And historically it also lacked stopping power. I'm going to stick with European styles, since that's what I'm familiar with the range and stopping power of.
     
  13. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Alyx is not showing the ammo, they show a hud showing the ammo. Realistic shooters for example like our own show the actual ammo when you pull out the mag. Example below, sorry for bad tracking, its my home office, its not opitmal for VR lots of refleftive surfaces.

     
    Last edited: Sep 20, 2020
  14. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Btw a quiver mechanic could be that when you hover your arrow hand over your shoulder a quiver moves into view. A oculus game called lies beneath does this for their shoulder mounted weapons (like shotgun) and it works pretty well.
     
  15. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    And even that is only showing the ammo in the clip it's self, not letting you track how much spare ammo you have by looking in your ammo bag and visually counting the number of mags. I can get why using numbers in the hud is standard. Typically the player has hundreds or thousands of rounds, so abstracting things is a good thing. Nor are the players picking up hundreds of magazines. Not to mention it would be too bulky to try realistically depicting someone actually carrying thousands of bullets and hundreds of spare mags.

    With an ammo count of 12-18 at a time, it should be more realistic to do. In theory at least. In practice, well, I'll have to experiment to find out. I have a few ideas of how I can do things, but each one has it's own potential flaws. One thought I had was making the bolts/arrows and quiver all physics objects, so the ammunition is each a separate instanced physics object resting inside the quiver. That could have the issue of ammunition spilling out if the player does anything acrobatic.
     
  16. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Soldiers typical carry seven 556 mags, less for 762 that the G3A3 i used in my video. We have reduced this in our game so they spawn with 3 mags plus one in the rifle.
     
  17. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    Another idea I had this morning was to have different art assets for each ammo count number, and have a script replace the art asset to match the current ammunition count. Again, not sure if I can do this. I'm sure it's possible, but not sure if I can do it.
     
  18. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,324
    (-_-)

    You do know that you can have a sprite in world space?
    And that you don't need to REPLACE assets, you can just hide/unhide ones you aren't using. So you could model different digits at the same spot, and unhide only the one that is currently visible.
     
  19. Pixie40

    Pixie40

    Joined:
    Sep 14, 2020
    Posts:
    21
    No, I hadn't. Been going through the Creating with Code Live lesson series, and been struggling with the animation lesson in week 4. Not sure what I'm doing wrong, but the animations aren't working. Got some things to try, but yeah. Still learning what the frell I'm doing here.

    EDIT: LESSON 4, not week 4. I'm having trouble getting the Jiggler script working in the Karting microgame used in the lesson.
     
    Last edited: Sep 22, 2020