Announcement

Collapse
No announcement yet.

Increasing Spawn Parms?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Increasing Spawn Parms?

    For starters, this question pertains to my AftershoQs mod, which is based on faithful methods, so I can't really get too fancy with any possible extensions that might solve this.

    I want to include 12 to 16 weapons in the mod that use the original ammo types (shells, nails [nails will be re-defined as 'Rifle Ammo', but operate the same in terms of the HUD], rockets, and cells). So this makes it easy to code and map in terms of ammo items. These only consume 4 spawn parms. However, each weapon has a specific magazine size, as reloading is an integral part in the combat mechanics of the mod. Naturally, for realism (and to eliminate ammo count bugs across level changing), I am storing these magazine values as parms.

    I knew I would run out of the 16 available parms, and thought I had a clever solution by adding all magazine ammo values together under 1 parm, then subtracting them back out in reverse order when the next level launches up. Problem is (as I'm sure anyone who's tried this figured out), you still have to store this information across level changing to access it. Duh.

    I know I can mod the armorvalue vs. armortype to essentially eliminate one of those (in fact, I plan to only use armorvalue and ditch having 3 armortypes in order to free up weapon slot floats), but this isn't enough.

    Another solution I've thought of is doing away with this spawn parm storage of magazine values and automatically reloading the player's weapons across levels, and adjusting the overall ammo values in respect to how much goes into the mags (this is already being done upon the reload impulse, of course, I would simply have to implement this on level change for all weapons, which isn't a big deal, but sacrifices some realism in gameplay).

    Has anyone ever seen a clever way of increasing parm count in a faithful fashion, or do I need to rethink what I'm doing here?

    Thanks.
    'Replacement Player Models' Project

  • #2
    You can use bitfields (like self.items, storing a lot of bits in just 1 float) or you can use strings much the same way.
    Scout's Journey
    Rune of Earth Magic

    Comment


    • #3
      Originally posted by Dutch View Post

      Another solution I've thought of is doing away with this spawn parm storage of magazine values and automatically reloading the player's weapons across levels, and adjusting the overall ammo values in respect to how much goes into the mags (this is already being done upon the reload impulse, of course, I would simply have to implement this on level change for all weapons, which isn't a big deal, but sacrifices some realism in gameplay)

      Thanks.
      This is your best method if you are going to make this vanilla. the 16 parms is hardcoded (progdefs.h, globalvars_t struct) so you are basically stuck because you can't use them as anything but floats. I am not sure if it isn't realistic for a player going from one level to the next for them to have reloaded all weapons in the background. Once I finish a fight I would reload my weapons. Seems reasonable and realistic if the player reloads his/her weapons between levels automatically unless you are going for some sort of continuous progression? The way above is how I do it. I simply set the clip to full and adjust amount of ammo accordingly.


      As for freeing up parm 9 that is a good idea. But you could actually keep the armortype if you didn't plan to use them for weapon floats just by adding this to the bottom of DecodeLevelParms:

      Code:
      if (self.items & IT_ARMOR1) 
      self.armortype = 0.3; 
      else if (self.items & IT_ARMOR2) 
      self.armortype = 0.6; 
      else if (self.items & IT_ARMOR3) 
      self.armortype = 0.8; 
      else 
      self.armortype = 0;
      Also have you thought of taking advantage of the other free floats in Quake that are basically there for modders?

      I am speaking of temp1, gamecfg, nomonsters, savedgamecfg, saved1-5, etc. These are hardcoded and can carry over between levels. Basically you can use these like any other cvar in game so to use them for this purpose you'll need to cvar_set. Set them just before the map changes (intermission, etc) and load them just after the level starts (worldspawn).


      But you sure have plenty of solutions to this problem if you used extensions. Frikfile comes to mind and even CSQC to handle that kind of stuff.


      The new FTEQcc also supports string arrays so maybe you could use that method too!
      Hope this is helpful! Can't wait to see this mod in action!
      Last edited by PrimalLove; 09-20-2014, 04:16 PM.

      Comment


      • #4
        fteqw has 64 parms. just define them after end_sys_fields and they'll just work.

        arrays will not persist over map changes.

        if you want a cross-engine solution, you're just going to have to pack your data into the stats/cvars/files that you do have access to.
        if you're storing clip sizes in there then thats what, 4 used bits per parm? that's just wasteful.
        this topic has come up many times in the past. try searching inside3d's forums, you should find a more complete solution or 3 there.
        Some Game Thing

        Comment


        • #5
          Quake c - parm* variable storage tutorial - Mod DB check this tutorial
          the invasion has begun! hide your children, grab the guns, and pack sandwiches.

          syluxman2803

          Comment


          • #6
            Awesome thanks for the responses guys. Great suggestions from all.

            Originally posted by nahuel
            Quake c - parm* variable storage tutorial - Mod DB check this tutorial
            This was the ticket here! I have seen this tutorial before, which is likely where I got the idea to condense them, but I couldn't for the life of me remember where I read it, exactly what I read, or how to implement it, and I'm not experienced enough to put that stuff together myself yet. Thank you sir for the link, I used the tutorial and it works very well. I cut my parm usage in half.

            @GB: I think that tutorial is what you were saying to do if I'm not mistaken. Thanks.

            @Spike: Having read up on the way these parms are handled, I understand what you mean by them being wasteful for bit count now. This is an area I didn't know much about. I could even further condense them down since the largest magazine holds a value of 60 it seems. Interesting stuff.

            @Primal: thanks man. The only problem I saw with automatically reloading at level change was the player would have no option on what weapons to reload. Since there are three different shotguns using the same ammo, he wouldn't be able to choose which to reload in the event that he doesn't have enough shells to reload them all.

            On a side note, I'm toying with the idea of having 3 weapon slots, excluding the combat axe, of which the player can choose any combo of the weapons and hold 3 at a time. It might get messy having 12-16 weapons to choose from via impulse, even if 2 or more weapons are cycled for a single impulse. On top of that, carrying around 12-16 weapons is totally fake lol. Maybe they each have a slipgate transponder that transports them to and from a personal inventory back at Headquarters?? Lol.

            Anyways, got it squared away, thanks guys.
            'Replacement Player Models' Project

            Comment

            Working...
            X