Announcement

Collapse
No announcement yet.

quakec lightning start position

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

  • quakec lightning start position

    Does anyone know the intricacies of W_FireLightning()? Especially pertaining to changing the start position of the lightning entity.

    No amount of changing org has changed the start position, so I'm presuming that the internal code uses the origin of the sent entity:

    Code:
    	WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
    	WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
    	WriteEntity (MSG_BROADCAST, self); // <--- start pos for lightning?
    	WriteCoord (MSG_BROADCAST, org_x);
    	WriteCoord (MSG_BROADCAST, org_y);
    	WriteCoord (MSG_BROADCAST, org_z);
    	WriteCoord (MSG_BROADCAST, trace_endpos_x);
    	WriteCoord (MSG_BROADCAST, trace_endpos_y);
    	WriteCoord (MSG_BROADCAST, trace_endpos_z);
    
    	LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
    I'm considering creating a temporary entity to act as the start position, but will the engine know that its the owner of the entity that is the player? (For death messages etc).

  • #2
    the player's lightning beam is 'relocated' to match the player's view position, so that it interpolates with the view. otherwise it looks very odd with it only getting refreshed at 10fps.
    some clients may also do this with other players beams too. some clients may update the end position also.
    the specified entity doesn't have to be visible. all clients will accept world, but some will do so without replacing the previous beam.
    Some Game Thing

    Comment


    • #3
      Hello unbirthday,

      if you are using darkplaces (I think I read somewhere that you do), you can move the lightning origin wherever you want. I do not know other engine behaviours.
      The smc mod does this for the player and for the shambler lightning.
      Source is included in the mod, so I do not want to go into details here.

      darkplaces uses a hack to pin the origin to the players waist at all times and frames.
      disable it: cl_beams_quakepositionhack
      You will then have to deal with the refresh rate of course. Just like Spike mentioned. To not have it move zick-zack. Set a short update frequence to "better" control it.

      And yes, as long as you make player its .owner the gamecode will understand wher it came from. Just like all monster projectiles are handled/coded. The source if full of examples.

      Good luck.

      Best wishes,
      Seven

      Comment


      • #4
        i seem to have changed the position of the start because on dm3 shooting from rl box to lower walkway the beam would appear to hit the wall or go thru it
        ill dig up some code and post it later tonight.

        edit: okay found it

        Code:
        	//R00k this is a bug, should be org not self.origin!
        	//LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
        	LightningDamage (org, trace_endpos + v_forward*4, self, 30);
        };
        edit2: the broadcast messages are to emit the bolt model where org_x, _y,_z is the start
        Last edited by R00k; 11-06-2015, 08:49 PM.
        www.quakeone.com/qrack | www.quakeone.com/cax| http://en.twitch.tv/sputnikutah

        Comment


        • #5
          Ahh right, thanks for the help lads. I didn't know about cl_beams_quakepositionhack, and I can see how it stutters with low frames. I'm trying to make the lightning appear from a different position on screen, as the lightning gun model is different. It's for bloodshot's q2 style weapon mod.

          I've got the position down, just about (Looking straight up or straight down seems to distort the origin and offset the beam somewhat).

          You will then have to deal with the refresh rate of course. Just like Spike mentioned. To not have it move zick-zack. Set a short update frequence to "better" control it.
          I can see how it stutters a lot when you're moving. How would I go about fixing that? Quake has a fixed low framerate on animations right? Should I have some function called regularly to check if the lightning gun is being fired, and to make more temporary lightning beams? I'm not sure how you move a temporary entity.

          Comment


          • #6
            Originally posted by unbirthday View Post
            I didn't know about cl_beams_quakepositionhack
            You have to better read through the existing cvars if you want to mod for a specific engine. Make use of the apropos comand and you will be able to use wildcard-searches and find every cvar you want/need with a detailed description. Live in the console...


            Originally posted by unbirthday View Post
            I've got the position down, just about (Looking straight up or straight down seems to distort the origin and offset the beam somewhat).
            As I said, look into the smc code to find fixes for your issues.
            Because you seem to be lazy, here is the fix:
            Original quake code that doesnt take the player view into account when aiming up/down:
            org = self.origin + '0 0 16';
            Fix:
            org = self.origin + self.view_ofs + v_forward*8 + v_up * -6.5;

            Play with the values to place the starting point for the beam wherever you want, when cl_beams_quakepositionhack is disabled.


            Originally posted by unbirthday View Post
            I can see how it stutters a lot when you're moving. How would I go about fixing that?
            You will not be able to reach cl_beams_quakepositionhack visuals with simple ssqc, but you can improve it a lot by raising the frequence.


            Originally posted by unbirthday View Post
            Quake has a fixed low framerate on animations right?
            The gamecode/mod tells the engine how the animation frequence is. So it is in your hands to change it. Original animations are 10 fps. You can raise to 20 or any other frequence in the gamecode. You usually do this via the .nextthink values.
            10 fps is equal to 0.1 second. So change it according to your needs.
            Just keep in mind that all the sub functions that get called each frame, will also be called more often... sometimes it is not what you want.


            Originally posted by unbirthday View Post
            Should I have some function called regularly to check if the lightning gun is being fired, and to make more temporary lightning beams?
            You can look into the smc source for examples. The trick is to use a high frequence but only do actions every 4th or 10th loop with a simple counter in your function.
            You can use this to update the beam very fast (maybe 4 times faster), but only deal damage or reduce ammo every 4th or so loop if you want to keep the original Quake lightning gun behaviour.


            Originally posted by unbirthday View Post
            I'm not sure how you move a temporary entity.
            This is not directly related to the topic. Every entity needs an origin. You can place it wherever you like via its .origin vector. If this is what you are asking for.


            Good luck.
            Seven

            Comment

            Working...
            X