Community made patches and improvements

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Postby mand1nga » Fri Jan 09, 2009 12:35 am

Talking about gibs ... isn't weird that models coming from a big explosion become gibs when it touches the floor or a wall, instead of becoming gibs with that explosion? bug or feature ? Please see the slow motion part of this video
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

Postby MirceaKitsune » Fri Jan 09, 2009 12:38 am

mand1nga wrote:Talking about gibs ... isn't weird that models coming from a big explosion become gibs when it touches the floor or a wall, instead of becoming gibs with that explosion? bug or feature ? Please see the slow motion part of this video


I have seen that as well, yes. Bodies gib whenever they hit the floor or walls at a small speed though I wasn't sure if that's left on purpose or unoptimized (reason why I didn't look into changing it). I do believe the speed-based damage to bodies needs to be much more tolerant however, as bodies gib from falling from the smallest height.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby MirceaKitsune » Fri Jan 09, 2009 2:54 am

After a few looks through the code I managed to make another patch which is the basic implementation of a feature that many people wanted, custom weapon-based crosshairs. I managed to find the file in which this code is to reside and coded a simple way so whenever you switch the weapon a new set of crosshairs settings are applied.

Before looking into my patch be warned that the code is very long and unoptimized, but it does work as it should without any issues. This is an experimental patch and not meant to be applied to the SVN yet, mainly as it doesn't have a menu implementation since I couldn't figure that one out. The reason I put it here is that I managed to get most of it working but don't know how go any further, so if this feature is to be implemented someone with more experience then me probably needs to take a look at it and fix what's left.

The way I have implemented this so far is by having the client replace the default crosshair cvars with other cvars every time you switch to a new weapon. For example, lets say you are holding the laser and switch to the shotgun. When the shotgun is selected, the cvar "crosshair" is replaced with the cvar "crosshair_shotgun", "crosshair_color_red / green / blue" with "crosshair_shotgun_color_red / green / blue" and so on for all sub settings of the crosshair for each individual weapon. Not sure if there's a better possible method but as I said I created the best thing I knew which actually works.

There are two things which need to be done before this patch can be considered functional. First is for the code to be optimized somehow so it won't be so long in View.qc. There are probably variables which need being declared somewhere else, parts which are better off in other locations... those who are more familiar with the code know here. Second is for a menu patch to be created, I have implemented the cvars for each weapon but don't know how to change the crosshair selector in the menu to match this new feature (the crosshair selector will need to be moved in the Weapon Settings sub-window of Player Setup as in this picture).

I'll probably try to add more tomorrow but until then feel free to modify this as it should be done and if someone can find a way to make a working menu patch as well this is all that's needed. Patch HERE and HERE. Hope the necessary optimizations can be made so this can be implemented in the SVN :)

[EDIT] Made more changes to this today. Removed separate string declarations which helped reduce the length of the code to half of what it was previously. Added crosshair_default which is the crosshair which gets applied when the crosshair_custom cvar is off, but unfortunately this only applies after you turn off the crosshair_custom cvar and switch to a new weapon, while the correct implementation is for it to apply it automatically on cvar change. Included menu changes which moves crosshair settings to the Weapon Setup window left of the Weapon Priority list... leaves Player Setup a bit empty but it's the only way to implement this in the menu (still no functionality over individual weapons though). Added nicer looking defaults for different weapon crosshairs.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby divVerent » Fri Jan 09, 2009 2:05 pm

This patch really is too messy, especially the changing the engine cvars, and the huge if list for all weapons.

Better do NOT use the engine's crosshair drawing then, but instead implement the crosshair using drawpic() in CSQC.

Also, it would be good to provide weapon specific crosshairs that actually match the weapon (like in tribes 2), and not just let the user choose them. We don't have matching crosshairs for most weapons yet.
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.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby divVerent » Fri Jan 09, 2009 2:14 pm

Another thing: do not EVER do such a list of ifs for every single weapon. It makes adding new weapons hard.

Instead, use a loop on the weapon number, and get weapon info using the get_weaponinfo() function.

An example can be found in server/miscfunctions.qc, readplayerstartcvars()
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.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby MirceaKitsune » Fri Jan 09, 2009 2:22 pm

divVerent wrote:This patch really is too messy, especially the changing the engine cvars, and the huge if list for all weapons.

Better do NOT use the engine's crosshair drawing then, but instead implement the crosshair using drawpic() in CSQC.

Also, it would be good to provide weapon specific crosshairs that actually match the weapon (like in tribes 2), and not just let the user choose them. We don't have matching crosshairs for most weapons yet.


I'll try to take a look at the CSQC option and see if I can move things there. And the current default crosshairs I provided are randomly made, the next thing I was planning to do was setting the best matching crosshair for each weapon once the patch is up and working. I do however want to allow every user to manually change the crosshair for each weapon, but until a way in the menus is found the cvars from the console would have to do (or manually editing defaultNexuiz.cfg).

divVerent wrote:Another thing: do not EVER do such a list of ifs for every single weapon. It makes adding new weapons hard.

Instead, use a loop on the weapon number, and get weapon info using the get_weaponinfo() function.

An example can be found in server/miscfunctions.qc, readplayerstartcvars()


Thanks for the info, I will keep that in mind. The problem here is that in order for each weapon to get its crosshair cvar its difficult to specify a cvar in a loop. For example crosshair_laser_color_red, I'm not sure how to make it know to take "crosshair_(get weapon name here)_color_red" for that.
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby esteel » Fri Jan 09, 2009 3:07 pm

divVerent wrote:Also, it would be good to provide weapon specific crosshairs that actually match the weapon (like in tribes 2), and not just let the user choose them. We don't have matching crosshairs for most weapons yet.

From a users point of view a simple option to enable/disable this feature and a good set of default would be fine. You know people WILL want to adjust those weapon crosshairs so it has to be configurable after all :)
The real question is what should depend on the gun? crosshair, CH-size/color, fov, zoomfov for example are usual combinations in other games iirc

MirceaKitsune wrote:Thanks for the info, I will keep that in mind. The problem here is that in order for each weapon to get its crosshair cvar its difficult to specify a cvar in a loop. For example crosshair_laser_color_red, I'm not sure how to make it know to take "crosshair_(get weapon name here)_color_red" for that.

There should be functions that map the weapon number to names and the other way round..
esteel
Site admin and forum addon
 
Posts: 3924
Joined: Wed Mar 01, 2006 8:27 am

Postby divVerent » Fri Jan 09, 2009 5:05 pm

MirceaKitsune wrote:Thanks for the info, I will keep that in mind. The problem here is that in order for each weapon to get its crosshair cvar its difficult to specify a cvar in a loop. For example crosshair_laser_color_red, I'm not sure how to make it know to take "crosshair_(get weapon name here)_color_red" for that.


The same way it builds "g_start_weapon_(get weapon name here)"...
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.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby MirceaKitsune » Fri Jan 09, 2009 7:19 pm

I managed to make a for() loop which gets your weapon type so the long code was finally removed. I renamed the cvars to use numbers instead of weapon names and based the code on weapon numbers now, both because it's easier (names had spaces which didn't fit well in cvars) and makes the system more adaptable to new weapons. Also added better default crosshairs for the moment.

I still left the system based on cvar changes however, as I had issues getting drawpic() working. I'm wondering though, is it really a bad idea to leave them working off the client crosshairs however? The only problem with making them working off cvar_set is that the code -looks- a bit too hackish I think, but from a technical point of view that works very well and probably it's best to leave the client handle crosshair rendering. Please change it if anyone can get a better method working however and that is indeed a bad way. New patch HERE and HERE
MirceaKitsune
Keyboard killer
 
Posts: 593
Joined: Thu Aug 14, 2008 6:48 am
Location: Romania - Bucharest

Postby divVerent » Fri Jan 09, 2009 8:36 pm

Code: Select all
               float j; //Custom weapon crosshairs
               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
               {
                       e = get_weaponinfo(j);
                       if(!cvar("crosshair_custom"))
                       {
                               // this gets executed for every weapon. Why?
                       }
                       else if(j == activeweapon)
                       {
                               // and this gets executed only once
                       }
               }


This is known on DailyWTF as the "for-case paradigm". Don't use it. Remove the loop, do e = get_weaponinfo(activeweapon) once.

Also... use e.netname as weapon name. Don't use these numbers in the cvars any more, they're irritating to players.
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.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

PreviousNext

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron