Weapon displays that show ammo - Printable Version +- Xonotic Forums (https://forums.xonotic.org) +-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10) +--- Forum: Xonotic - Development (https://forums.xonotic.org/forumdisplay.php?fid=12) +--- Thread: Weapon displays that show ammo (/showthread.php?tid=2345) |
Weapon displays that show ammo - MirceaKitsune - 11-18-2011 I've been making improvements to my game Vore Tournament in the last days. Yesterday, I managed to get the weapon display working and indicating ammo properly. Since I believe this would be an awesome feature in Xonotic, I thought to share it here. How it's done: VT is forked from Nexuiz, so it uses server-side entities even for the view model. Each display digit consists of a flat surface, which has the same center as v_weapon but with the mesh positioned to fit the screen. In-game, the weapon spawns all of its digits when you switch to it, the digits being removed once your weapon changes. Each digit is a separate entity, attached to the same origin as the gun model. divVerent suggested I add attachment tags to the weapon and put digits on that, but my md3 exporter doesn't handle this well so I made each digit separate. Next up, each digit contains 11 skins, consisting of numbers 0 to 9 and an empty digit. Each digit knows the character it represents in the ammo string, and uses substring(ftos(self.(self.current_ammo)), blah, blah) to get the proper value. The number is next converted back into a float and self.skin set to it. If the string returns "" (happens when your ammo goes under 3 digits, like dropping from 110 to 90) then the blank texture is used. Otherwise 60 would show as 600 and so on. Digits are shown on both the view model and exterior weapon model, which means that if you're good enough you can see the ammo on your enemy's weapon... although in practice that's nearly impossible Like I said, I'd adore to see this in Xonotic. Weapon displays rock, and I love how UT99 used to do it. Some weapons could have hologram displays too, with transparent numbers floating above a small device on the weapon. Since my game uses reloading by default, 2 digits show the weapon load and the other 3 ammo. Since most Xonotic guns use ammo directly, we'd only need 3 digits, showing ammo normally and weapon load if reloading is enabled for that gun. Below are screenshots and a video of how this is done in VT (you can see the ammo on the weapon matches the one on the HUD). I'm also posting the code used by the digits, in case it's of any interest. This code is located at the bottom of cl_weaponsystem.qc right before void W_DecreaseAmmo. W_Display is called in w_*.qc in the (req == WR_SETUP) check, and is compatible with any weapon. Code: void W_DisplayDigitThink() Let me know what you think about this, which weapons you believe this would look good on (and how), and what your ideas for implementation are. Note that divVerent is working on csqc models, which will certainly change how this needs to be implemented. RE: Weapon displays that show ammo - rocknroll237 - 11-18-2011 That's a cool idea. I don't wish to be offensive but isn't that game a little bit... um... weird? I mean you don't actually like it, in THAT way do you? Oh and I've always wondered... What is with the ponies? RE: Weapon displays that show ammo - CuBe0wL - 11-18-2011 /OFF Don't ask... that's a "furry thing" Also, everybody has the right to be a bit crazy... at least untill it's not offensive. I can't find anything offensive in this. Weird like hell, but nothing more. RE: Weapon displays that show ammo - Mr. Bougo - 11-18-2011 (11-18-2011, 12:23 PM)rocknroll237 Wrote: That's a cool idea. I don't wish to be offensive but isn't that game a little bit... um... weird? I mean you don't actually like it, in THAT way do you? Oh and I've always wondered... What is with the ponies? Neither the ponies nor vorarephilia are furry things. And about ponies, check this (don't click if you are epileptic, flashy gif background in that section of the forum): http://forums.xonotic.org/showthread.php?tid=2331 RE: Weapon displays that show ammo - Squigger - 11-18-2011 If anything, I think this would be best for the machine gun and the rifle as both of these weapons need to reload. It would be nice to know how much ammo you have before you reload This would mean that we would need different weapon models to showcase this. Anyone else thinking the same? RE: Weapon displays that show ammo - MirceaKitsune - 11-18-2011 Seen that pony thread. And yeah, the game isn't offensive but it is about vore. I can understand people finding that weird Though I appreciate everyone here being nice and civil about it, and not like some people on Youtube when they disagree... since I can't help noticing the big difference when it comes to the quality of each community. But yes... the game itself is good and playable like any FPS, and gameplay should be rather interesting. No need to be into vore at all to enjoy it, though you need to not mind it either. Obviously, if I worked so hard to make a whole game alone about this, I do love it :3 But back on topic. Yeah, this would certainly be awesome in Xonotic too... especially if some weapons would use screens and others a holographic display. I think this adds much more depth and detail, and will make the feel of weapons a lot nicer. So far, the Electro is one of the first candidates that come to mind, since it has that black screen that no one even textured. The UZI has a screen also, which looks pretty fit for this. The Nex is good too. (11-18-2011, 04:09 PM)Squigger Wrote: If anything, I think this would be best for the machine gun and the rifle as both of these weapons need to reload. I don't believe this would be needed only for weapons that reload by default. Like in UT, they could show the ammo count for any gun. Also, not all weapons would need new models. Some already have textured screens, that digits could be placed in front of. I created my screen on the Nexuiz hook gun, modeling + texturing it in place. eg: For the Electro, digits could be placed in front of the existing screen with a small offset, without having to add new details to the mesh. RE: Weapon displays that show ammo - Squigger - 11-18-2011 I see, cool I definitely support this then RE: Weapon displays that show ammo - nilyt - 11-21-2011 As I said on IRC, absolutely love the idea. Alien II MG Displays, anyone? Would be awesome on a darker futuristic game, but works for Xonotic also. The only thing still missing for those then, would be directional sound distortions :O Looks like I understand the code, too bad I probably can't make the model-related part work. RE: Weapon displays that show ammo - Sarge999 - 11-21-2011 That's great, I really liked that in D3. Could you do a charging display for the nex gun? RE: Weapon displays that show ammo - nifrek - 11-21-2011 This is pretty cool, I think I'm too used at looking at the hud for ammo/armor/health, so I don't think it would that much useful to me but I don't see why it shouldn't be added to xonotic if it doesn't slow down or break anything. As a side note, I've always hoped that ammo shown would show how many shots you have left (ie: Firing RL uses 4 rockets, Mortar 2) instead (or along with, somehow) of actual ammo. I assume that will only be possible with CSQC? RE: Weapon displays that show ammo - tZork - 11-22-2011 Its cool indeed, problem is its not a very "good way" of doing it - this needs one entity and 10 skins per digit to display on that "weapon screen". A bit wasteful - how much so will need to be investigated before its considered for inclusion in master. RE: Weapon displays that show ammo - MirceaKitsune - 11-22-2011 (11-22-2011, 12:53 AM)tZork Wrote: Its cool indeed, problem is its not a very "good way" of doing it - this needs one entity and 10 skins per digit to display on that "weapon screen". A bit wasteful - how much so will need to be investigated before its considered for inclusion in master. Yes, you can put attachment tags on a model and attach the same panel to that, decreasing model and skin count. My md3 exporter wouldn't handle that well, so I made a separate mesh for each digit of my gun. Also, it would need 11 skin files not 10. numbers 0-9 plus an empty digit, so 20 ammo won't show as 200 or 020 and the text stays leftmost. Anyway, I'm waiting for divVerent's csqc_models to be merged, then I might look into this. But like I said, my md3 exporter for Blender doesn't export multiple tags well (or DarkPlaces doesn't detect them). So I can adapt the code and do the written part, but I'd need people to send me the updated v_*.md3 models with attachment tags for the three digits (I can create the flat plane myself). If anyone does that, don't forget to send me the .blend file too so I can update the source as well. Anyway, here are some BADLY PHOTOSHOPPED screenshots to give an idea of what I'd like to see. They look rather horrible, but they're only to give an idea of how I'd them for some guns (RL and UZI are better with a non-hologram screen). RE: Weapon displays that show ammo - Lee_Stricklin - 11-22-2011 From a gameplay point of view, the only real weapons that would benefit from an ammo display are ones that need to be reloaded or ones that charge. Specifically I think the rifle and machinegun should display how many rounds are in a magazine since the only other thing onscreen that shows it is the crosshair, which some old school players (like myself) might disable. The nex might benefit from a charge meter, though it glowing red makes it's charge pretty obvious already. RE: Weapon displays that show ammo - Halogene - 11-22-2011 I play without weapon models nowadays anyway... but every little piece of added detail can enhance the atmosphere. |