[SVN] Customizable weapon spread

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Sun Nov 08, 2009 10:45 am

  • See for yourself:

    http://rm.endoftheinternet.org/~nexuiz/falloff/

    The falloff curves are:

    • 0: like Quake, dir+randomvec*spread; 1: same without varying velocity
      Image
      Image
    • 2: solid circle
      Image
      Image
    • 3: gaussian falloff, varies velocity like 0; 4: same without varying velocity
      Image
      Image
    • 5: linear falloff
      Image
      Image
    • 6: (1-r^2) falloff
      Image
      Image
    • 7: (1-r)(2-r) falloff
      Image
      Image


    They are all coded so their standard deviation matches among them, so changing them shouldn't change gameplay much.
    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

Sun Nov 08, 2009 4:24 pm

  • two things come to mind:
    road salt? (haarghhnnn)
    nice work there! :D
    [Want to develop? Look HERE]. Image Image Gif sauce.
    paperclips
    Alien trapper
     
    Posts: 346
    Joined: Mon Jan 12, 2009 10:27 am
    Location: internets

Sun Nov 08, 2009 5:10 pm

  • So which one will become default?
    Flying Steel
    Keyboard killer
     
    Posts: 623
    Joined: Fri May 08, 2009 9:13 pm

Sun Nov 08, 2009 5:26 pm

  • Not sure. I prefer 5 and 7.
    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

Sun Nov 08, 2009 5:46 pm

Sun Nov 08, 2009 8:43 pm

  • I vote for 7 too, thats how i imagine a real shotgun to operate: The graph for 5 and 7 looks cool but I think 5 has a little bit too uniform spread in practice based on the decal-picture. Maybe its just me. :P
    Image
    User avatar
    FraNcoTirAdoR
    Alien trapper
     
    Posts: 288
    Joined: Tue Mar 04, 2008 10:25 am
    Location: near the nex

Mon Nov 09, 2009 12:00 am

Mon Nov 09, 2009 7:01 am

  • Let's say 7 has the simpler implementation:

    dx = random() * 2 * M_PI;
    dy = sin(dx);
    dx = cos(dx);
    // radius in our dist function
    r = random();
    r = 1 - sqrt(r);
    r = 1 - sqrt(r);
    return normalize(forward + (v1 * dx + v2 * dy) * r * sigma);

    compared to 5:

    dx = random() * 2 * M_PI;
    dy = sin(dx);
    dx = cos(dx);
    // radius in our dist function
    r = random();
    r = solve_cubic_abcd(-2, 3, 0, -r) * '0 1 0';
    return normalize(forward + (v1 * dx + v2 * dy) * r * sigma);

    because, the cubic root solving is anything but simple compared to two square roots :P

    So, 7 should be the faster one.

    I'll now order them in speed of the code:
    0 (277k/sec)
    1 (237k/sec)
    2 (165k/sec)
    6, 7 (158k/sec)
    5 (110k/sec)
    3, 4 (80k/sec)
    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

Mon Nov 09, 2009 3:33 pm

  • Well then with those performance values its looks like 7 is your best option. Nothing else with as realistic looking and unspammy a pattern is faster.
    Flying Steel
    Keyboard killer
     
    Posts: 623
    Joined: Fri May 08, 2009 9:13 pm

Mon Nov 09, 2009 5:00 pm

  • I think personally a gaussian is probably a good approximation of the sum of the different random parts in a weapon :)
    He can talk the talk, but can he caulk the caulk?
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Wed Nov 11, 2009 7:04 am

  • Yes, that is what gaussian normally models.

    However, it is bad for gameplay that a projectile can end up anywhere - just with low probability. It's better especially in team games if a bullet can only hit a certain maximum distance around the crosshair (so you can AVOID hitting someone) - which is why I suggest the (2-r)(1-r) spread instead of gaussian.

    Other than that, the functions for gaussian and (2-r)(1-r) are very similar at higher distances, and dissimilar at lower distances.

    Image
    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



Return to Nexuiz - Development




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