Dual wielding mutator (work in progress, need help)

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators


  • I spent my day trying to implement a fun mutator in Nexuiz which I played with in other games and who's idea I like: Dual weapon wielding. The purpose of this mutator is to allow each player to carry two weapons of the same type in each hand, allowing him / her to shoot twice faster.

    So far I managed to implement this by half, but am reaching my limits in coding and require help to continue further. There are still a few things I did not add and a few bugs as well, although the basics should work. Also be warned the code is very messy and may be incorrect in many places due to my low knowledge in coding (basically I wrote whatever made what I wanted to work then optimized as far as I could understand). Here is a list of what I have and haven't got working so far and a few screenshots.

    Stuff that works:

    - The player is visually holding two weapons in each hand, both in 1st person and 3rd person mode.

    - Muzzle flash works in 1st person for the second gun.

    - When dual wielding is enabled, the firing rate is double for any weapon simulating the shooting of both guns.

    - Colors and other powerup effects work correctly for the 2nd weapon, both in 1st person and 3rd person mode.

    - (V1.11) Players drop both weapons upon death.

    - (V1.4) Weapons with continuous firing (UZI, Hagar, Electro alt. fire, etc) now fire faster as well.

    - (V2.0) Each weapon shoots (spawns the projectile) after the other one, not randomly like before.

    - (V2.0) Muzzle flashes display only on the shooting weapon, not both.

    - (V2.0) Correct console messages when picking up or dropping a dual weapon.


    Stuff that doesn't work & bugs:

    - After respawning several times, floating weapon models get attached all over the players. - Fixed (V1.2)

    - Muzzle flash only works for the 2nd weapon in 3rd person mode occasionally. - Fixed (V1.3)

    - The projectile still appears as exiting from the right side when shooting, so in 1st person mode you still see the right gun spawning the projectile and the left one just moving. - Fixed, the projectile is now randomly spawned from either the left or right gun (V1.3)

    - When the mutator is enabled, the player dual wields every weapon as long as they have it rather then starting with a single weapon and dual wielding it once they pick that weapon up again. - Fixed by MrBougo, dual weapons must be earned now (V2.0)

    - No animation if you pick up a dual weapon while holding its single version, you just see it appearing there.


    Image

    Image

    Image

    Image

    Patch located here. I will try to work on everything else I can later tonight but as I said I need help from more knowledgeable coders in order to finish this correctly. I would like hearing opinions on this as well :)
    Last edited by MirceaKitsune on Sun Jun 07, 2009 12:45 am, edited 11 times in total.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Wed Apr 15, 2009 5:31 pm

  • - After picking up too many weapons, something in the code gets broken and weapon models start getting attached all over the players.

    :D
    User avatar
    FruitieX
    Keyboard killer
     
    Posts: 588
    Joined: Mon Nov 13, 2006 4:47 pm
    Location: Finland

Wed Apr 15, 2009 5:36 pm

Wed Apr 15, 2009 7:19 pm

  • Very nice. I'm looking forward to seeing how far you can take this, perhaps so I can wield a mortar and a nex and not have to switch weapons :twisted:
    Possibly not the worst mapper in the world.

    A blog of random pish:
    http://xeno.planetnexuiz.com/blog/?author=5
    User avatar
    Sepelio
    Forum addon
     
    Posts: 1101
    Joined: Tue Jun 27, 2006 7:57 pm
    Location: Scotland

Wed Apr 15, 2009 7:59 pm

  • dual nex... did someone say balance?

    anyway do it... cant wait for dual electro :P
    quit for good
    alpha
    Alien trapper
     
    Posts: 492
    Joined: Tue Jun 17, 2008 7:18 pm

Wed Apr 15, 2009 8:19 pm

  • Thanks, I'm glad people like it :) As I said this is a bigger challenge for me since I haven't tried coding at this level until now, so any help would be very appreciated even if someone can just point out what I need to change in the code to improve or fix a certain issue.

    Since Sepelio mentioned wielding two weapons of different types: I have thought about that but it would be a very difficult thing to do, not only because it would require heavy work to implement but also because you'd need 4 firing keys and 4 weapon switching keys instead of 2. I have an UT2004 mutator which allows holding weapons of different types in each hand, but firing and switching both individually is a nightmare, so I don't think wielding different types can be implemented or doable.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Wed Apr 15, 2009 9:04 pm

  • MirceaKitsune wrote:Thanks, I'm glad people like it :) As I said this is a bigger challenge for me since I haven't tried coding at this level until now, so any help would be very appreciated even if someone can just point out what I need to change in the code to improve or fix a certain issue.

    Since Sepelio mentioned wielding two weapons of different types: I have thought about that but it would be a very difficult thing to do, not only because it would require heavy work to implement but also because you'd need 4 firing keys and 4 weapon switching keys instead of 2. I have an UT2004 mutator which allows holding weapons of different types in each hand, but firing and switching both individually is a nightmare, so I don't think wielding different types can be implemented or doable.

    How about just press normally to shoot with primary gun (on the right?) and and do ctrl+press for the secondary gun?
    uluyol901
    Member
     
    Posts: 16
    Joined: Sun Jan 25, 2009 7:39 pm

Thu Apr 16, 2009 1:02 am

  • Updated patch to version 1.11. Optimized the code a bit and made the second weapon dropable (players now drop both weapons when they die unless Pinata is enabled). Also cut the bug where weapon models get stuck around players to half, though this issue still occurs when players die since their weapon models apparently get stuck to other players when they respawn (happens for both the 1st person and 3rd person weapon models).

    This is currently the mutator's worst issue, so if anyone can figure out why these entities get randomly attached to players before me it would solve a big problem (spent 4 hours trying to but no success, can be reproduced by playing with bots). If anyone happens to find the solution please feel free to modify and reupload the patch or post what needs to be done in this topic.

    uluyol901 wrote:How about just press normally to shoot with primary gun (on the right?) and and do ctrl+press for the secondary gun?


    That would be a good idea, once and if someone with experience tries to make such a thing separately someday (this would kill me in a few minutes :D )
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Thu Apr 16, 2009 3:14 pm

  • WOAH! I cant believe i didnt see this thread! My friend Ranger will totall love this! :shock:
    http://www.odf-online.org/ Home to Flight Back, D321GO!, and other Descent related projects, all open source!
    User avatar
    Darcshadow7
    Alien
     
    Posts: 168
    Joined: Fri Feb 13, 2009 4:34 pm
    Location: Peoria, Arizona

Thu Apr 16, 2009 4:45 pm

  • Hehe, nice fun mod :)
    "One should strive to achieve; not sit in bitter regret."
    WE ARE NEXUIZ.
    Image
    Image
    User avatar
    C.Brutail
    Laidback mapper
     
    Posts: 2357
    Joined: Tue Feb 28, 2006 7:26 pm
    Location: Ironforge

Thu Apr 16, 2009 5:22 pm

  • Good news, I managed to find the source of the weapon model problem and fixed it. Now the mutator can be used without getting all buried in weapons or getting orphaned models floating around :D Next stop is trying to get the muzzle flashes working correctly for the 2nd gun.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Thu Apr 16, 2009 9:46 pm

  • Wow, this is developing really fast. :shock: :D
    http://www.odf-online.org/ Home to Flight Back, D321GO!, and other Descent related projects, all open source!
    User avatar
    Darcshadow7
    Alien
     
    Posts: 168
    Joined: Fri Feb 13, 2009 4:34 pm
    Location: Peoria, Arizona

Thu Apr 16, 2009 10:07 pm

  • Sorry another quick question, do the weapons fire two projectiles or just fire at double normal rate?
    Possibly not the worst mapper in the world.

    A blog of random pish:
    http://xeno.planetnexuiz.com/blog/?author=5
    User avatar
    Sepelio
    Forum addon
     
    Posts: 1101
    Joined: Tue Jun 27, 2006 7:57 pm
    Location: Scotland

Fri Apr 17, 2009 1:00 am

  • Darcshadow7: Yes, it seems I managed to do more then I thought I could :) I kept working on this all day long so I got to change quite a bit today. And Sepelio, it just makes the firing rate double, the second weapon is only a model attached visually (though the player doesn't notice any difference).

    Anyway for tonight I got the muzzle flashes displaying correctly in both views (implemented a bit hackishly but if they work well I guess that's ok). Also fixed the shot spawner so projectiles are randomly spawned from either the left or right gun (ideally it should spawn from the other gun every shot, but since that code cannot store any values I could only use a random). Have fun with the new patch :)
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Fri Apr 17, 2009 5:04 am

  • So this is.. done?

    If so, someone needs to put this thing on a server or something! :)
    http://www.odf-online.org/ Home to Flight Back, D321GO!, and other Descent related projects, all open source!
    User avatar
    Darcshadow7
    Alien
     
    Posts: 168
    Joined: Fri Feb 13, 2009 4:34 pm
    Location: Peoria, Arizona

Fri Apr 17, 2009 7:56 am

Fri Apr 17, 2009 8:29 am

  • Looks like it should become stable first, and be played on some servers, before that gets into Nexuiz SVN :)

    Also, you may want to call it Akimbo Arena instead, as that was the UT mutator's name for this.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Fri Apr 17, 2009 9:24 am

Fri Apr 17, 2009 11:36 am

  • Darcshadow7 wrote:So this is.. done?


    Currently it should work without any issues. I'll go through the code again in the next hours and clean up everything to make sure it's optimized, and remove the 'test' tags as well. The mutator is still missing the last feature however, earning the second gun. It needs to be changed so that you normally own one weapon like before and dual wield it after picking that weapon up again. The mutator can work without that for now but in the end it should be done like that. I really can't make any promises here though :?

    Feel free to add it without this feature to SVN for now (if it's tested and safe to add) and I will try to take care of this later on. I'm leaving for the Easter tomorrow and since I don't have high speed internet on my laptop I'm not sure if I can download the SVN and continue coding while I'm away. If not I will have to pause this for a week or so.

    divVerent wrote:Looks like it should become stable first, and be played on some servers, before that gets into Nexuiz SVN :)

    Also, you may want to call it Akimbo Arena instead, as that was the UT mutator's name for this.


    It's currently stable but I'd like to do some more cleanup to be sure. If anyone is willing to test it on their server that would be appreciated (please wait until I release the next version later today so I can fix the final stuff and remove the temporary tags). And yeah that's the UT mutator I have, but I'd rather not call it like that since I don't want to copy everything that was made for UT even if that mod sparked me the idea :)
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Fri Apr 17, 2009 11:58 am

  • Oh shit! Dual electro = one man apocalypsis! Where can I test this?
    quit for good
    alpha
    Alien trapper
     
    Posts: 492
    Joined: Tue Jun 17, 2008 7:18 pm

Fri Apr 17, 2009 12:00 pm

Fri Apr 17, 2009 12:38 pm

  • Without "earning both guns", I really don't want it... also it should be possible to throw both guns away separately.

    Please also test:
    - reload of camping rifle
    - uzi firing speed
    - g_weapon_stay 1 and g_weapon_stay 2 modes
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Fri Apr 17, 2009 3:43 pm

  • Where do i put this .patch file? :?
    http://www.odf-online.org/ Home to Flight Back, D321GO!, and other Descent related projects, all open source!
    User avatar
    Darcshadow7
    Alien
     
    Posts: 168
    Joined: Fri Feb 13, 2009 4:34 pm
    Location: Peoria, Arizona

Fri Apr 17, 2009 4:55 pm

  • divVerent wrote:Without "earning both guns", I really don't want it... also it should be possible to throw both guns away separately.

    Please also test:
    - reload of camping rifle
    - uzi firing speed
    - g_weapon_stay 1 and g_weapon_stay 2 modes


    Earning both guns will be hard, since some sort of second weapon owning state would need to be implemented for each weapon. I'll try looking into that when I return from my trip, but as I said I would appreciate it a lot if an advanced coder could look into it too and try to help at this point.

    As for the tests: Reloading the rifle looks ok though it still takes the same amount of time. I could have made it take longer but the animation would end as soon and the weapon would just appear unusable for 2 seconds after reloading (same issue if you set g_balance_campingrifle_reloadtime higher from what I seen). The UZI and all weapons with continuous firing had the same speed since I didn't realize they use a different firing code, but now they fire faster as well (twice as fast was too much but half as fast looks very good). g_weapon_stay currently work ok with the mutator at any value... this will need to be tested once earning the second weapon will be implemented.

    I released version 1.4 of the patch fixing the UZI problem and anything else forgotten in the code that I that could find. Patch seems to be safe and stable at least in local games with bots so feel free to put it on servers and play with it. Just for the note I set it to default 0 like every other mutator, so you need to enable it from the Mutators menu at startup.

    Darcshadow7 wrote:Where do i put this .patch file? :?


    .patch files are SVN source code patches, you must be running the game from SVN in order to use them.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Fri Apr 17, 2009 5:26 pm

  • Oh. :|
    http://www.odf-online.org/ Home to Flight Back, D321GO!, and other Descent related projects, all open source!
    User avatar
    Darcshadow7
    Alien
     
    Posts: 168
    Joined: Fri Feb 13, 2009 4:34 pm
    Location: Peoria, Arizona

Sun Apr 19, 2009 5:58 pm

  • Ok.. Its been a while, what is the current status on this project?
    http://www.odf-online.org/ Home to Flight Back, D321GO!, and other Descent related projects, all open source!
    User avatar
    Darcshadow7
    Alien
     
    Posts: 168
    Joined: Fri Feb 13, 2009 4:34 pm
    Location: Peoria, Arizona

Sun Apr 19, 2009 7:07 pm

  • Darcshadow7 wrote:Ok.. Its been a while, what is the current status on this project?

    The same as the alternative-gib project: dead, always to remain half completed, never to be revived.

    We don't have enough programmers.

    Also in programming it takes like a whole day to do even a SIMPLE thing. I know, I've done a bit of programming myself. In the time it takes to make some tiny simple thing in programming you could have completed a nice map or 2.
    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm

Sun Apr 19, 2009 7:09 pm

  • It's been 2 days... and it's the weekend, how about you relax and have some courtesy?
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Sun Apr 19, 2009 7:26 pm

  • The gib stuff has been more than that. None of us can code worth a damn. We don't have the domain specific knowlege. If we want to know how to check if a player is of a perticular playermodel we can't because we don't know how to compare or how to call any of those functions or what they are or how to find out.
    tundramagi
    Forum addon
     
    Posts: 974
    Joined: Sun Jan 04, 2009 4:53 pm

Sun Apr 19, 2009 9:59 pm

  • tundramagi is referring to this topic. I deeply hope that project will be revived as well since many of us are hoping for it and half was already done, but I understand the situation and that we mustn't rush things. It would indeed be wonderful if we had more devs, but for now we must handle things how we can sadly.

    On the other side I have to confess that in my opinion more of the current coders could try getting involved and helping out when they have time and energy to. Much could be done if other people were more eager to participate as well, since we could really use the help (not referring to this topic specifically). I'm not being spoiled about it, I know this is a free project and people have lives, but I think more effort could try being put overall from time to time. Besides, I don't think coding is such a big burden after all... I actually find it pretty fun :)

    As for this mutator, I am currently away for the Easter (as I wrote in a previous post) and don't have the SVN here so I will try to continue in a week when I get back home. I got an idea on how the weapon owning code would need to be done and hope I'll find a way to implement it once I return home if luck sticks with me.
    User avatar
    MirceaKitsune
    Keyboard killer
     
    Posts: 593
    Joined: Thu Aug 14, 2008 6:48 am
    Location: Romania - Bucharest

Next


Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest