Announcement

Collapse
No announcement yet.

gawddawm observer mode dosent come quietly, where are they?

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

  • gawddawm observer mode dosent come quietly, where are they?

    is athere any kind of tutorial for an observer mode?

    i know runequake has one, but how to implament?

    after readig bakers posts have been brainwashed to include them

    but how

    (this is for my next mod [oh ya, another], benzines source code will be avalabe soon {so you can see the abominations inneards} the latest is at

    http://qrf.mine.nu/~metch/ <i like black and white web pages>
    )

    but back to subject, I NEEDA OBSERVER MODE IT SEEMS...

  • #2
    I recommend you examine Bam's XCTF source code.

    http://www.quakeone.com/index.php?in...ile&file_id=42

    It is a basic observer mode that allows you to fly around the map and watch other's play. I think you type "observer" in the console. You can connect to the XCTF server and see how it works.

    What would be easier:

    1. Take original ThreeWave CTF source code:

    http://www.quaketerminus.com/nqexes/3wave421d.zip

    2. Take xCTF source code

    3. Use WinMerge and open both QuakeC sources and it will highlight the differences.

    xCTF was based off ThreeWave CTF and mostly involved making a little more refined, so the changes probably shouldn't be drastic.

    That's my answer. Someone who knows more might have a better one.

    You probably should check out this tutorial:

    http://www.inside3d.com/qctut/cs-tut3.shtml
    Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

    So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

    Comment


    • #3
      hmm i tried option2

      and i guess i have to go through all the counterstrike clones and find wut i need

      perhaps i should try optiopn 1 now

      Comment


      • #4
        Metch it is actually relatively easy to add an observer mode.

        I don't know how much you know about coding so bear with me. The observer mode I'll show you is an extremely simplified and abstract version. You will need to customize a few things to implement it into your mod.

        There are 3 things you need to have for an observer mode:
        1. Observer flag (field variable assigned to player to signify if he is an observer or not)
        2. Observer functions to toggle observer mode and handle observer routines
        - Observer Think (takes care of things while observer)
        - Observer Start (starts player observing)
        - Observer End (ends player observing)
        3. Place the 3 observer functions in their designated place to be called.


        Step by step:

        In defs.qc at the end of the file add:

        Code:
        // This signifies whether a player is an observer or not
        .float observer;
        In client.qc in the function PlayerPreThink () right AFTER this code:
        Code:
        if (self.deadflag >= DEAD_DEAD)
        {
        	PlayerDeathThink ();
        	return;
        }
        ADD:
        Code:
        // This lets you fly through walls and
        // checks the ObserverThink function every frame.
        if (self.observer)
        {
        	ObserverThink();
        	return;
        }
        In ImpulseCommands () in weapons.qc or wherever you call your impulses add this:
        Code:
        // This makes a player start or end observer mode
        // change the impulse if needed
        if (self.impulse == 99)
        {
        	if (self.observer == FALSE)
        		ObserverStart ();
        	else
        		ObserverEnd ();
        }
        Now the meat and potatoes of observer mode, create an observer.qc file or add the code wherever you deem necessary:
        Code:
        void ()
        ObserverThink =
        {
        	local float invcos, nvp, nvpmax, sp, svz, d;
        	local vector f, vp, vs;
        	local entity tele;
        	
        	self.flags = self.flags | FL_ONGROUND;
        
        	svz = self.velocity_z * 0.75;
        	self.velocity_z = 0;
        
        	// v_forward is already normalized
        	f_x = v_forward_x;
        	f_y = v_forward_y;
        	f_z = 0;
        	invcos = vlen (f);
        	if (invcos)
        		invcos = 1 / invcos;
        	else
        		invcos = 0;
        	f = f * invcos; // normalize f
        
        	sp = f * self.velocity;
        	vp = sp * f;
        	nvp = vlen (vp);
        	if (sp < 0)
        		nvp = 0 - nvp;
        	vs = self.velocity - vp;
        
        	vp = v_forward * (nvp * invcos);
        	vp_z = vp_z + svz;
        	nvp = vlen (vp);
        	nvpmax = (320 - 100*(v_forward * '0 0 1'));
        	if (nvp > nvpmax)
        		vp = vp * (nvpmax/nvp);
        
        	self.velocity = vp + vs; // Finally we have our velocity
        	
        	if (self.button2)
        		self.velocity_z = self.velocity_z + 270;
        	if (self.button0)
        		self.velocity = self.velocity * 2;
        };
        
        void ()
        ObserverStart =
        {
        	bprint (self.netname);
        	bprint (" went observer\n");
        	
        	self.velocity 		= '0 0 0';
        	self.health           = 999;
        	self.takedamage       = DAMAGE_NO;
        	self.solid            = SOLID_NOT;
        	self.movetype         = MOVETYPE_NOCLIP;
        	self.deadflag         = DEAD_NO;
        
        	setmodel (self, string_null);
        
        	self.weaponmodel      = "";
        	self.weaponframe      = 0;
        	self.weapon           = 0;
        
        	setsize (self, '-12 -12 -12', '12 12 12');
        	self.view_ofs = '0 0 10';
        	
        	self.items = 0;
        	self.observer = TRUE;
        };
        
        void ()
        ObserverEnd =
        {
        	self.frags = 0;
        	bprint (self.netname);
        	bprint (" joined the game\n")
        	
        	// These 2 functions may need to change depending how
        	// you handle player respawns.
        	SetNewParms ();
        	PutClientInServer ();
        };
        There, I hope this helps, you will probably want to expand on this code but I'm leaving that up to you.

        Comment


        • #5
          seems to work but

          it dosent much like the last 2

          like:
          observer.qc(82): error: Expected ;, found SetNewParms

          ../progs.dat - 1 error(s), 0 warning(s)

          and if i comment it out:
          observer.qc(83): error: Expected ;, found PutClientInServer

          ../progs.dat - 1 error(s), 0 warning(s)

          it all works vary nicly acccept those 2, no matter where it is in the .src

          this is definatly helping tho, even if im not

          Comment


          • #6
            Oh wooops typo on my part: In ObserverEnd () where is says:

            Code:
            bprint (" joined the game\n")
            Add a semi-colon to the end of it:

            Code:
            bprint (" joined the game\n");
            Now it should work. haha

            Comment


            • #7
              oh thanks it works now [ it could have been worse, i had around 20 errors from missing one of those once .... ok, maybe more than once that has happend]

              Comment


              • #8
                Originally posted by Self
                That's my answer. Someone who knows more might have a better one.
                Looks like much better help arrived :d :d :d :d :d
                Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                Comment


                • #9
                  well, i did get some kind of observer mode from your suggestion[s], but i couldnt join or much of anything with that one :/

                  this one works well but theres one slightlymajor bug i have hit, if you scroll thru the weapons, not using the impulse numbers you get this error :

                  STORE_F 337(MSG_BROADCAST) 0.0 3669(am)
                  weapons.qc : CycleWeaponCommand
                  weapons.qc : ImpulseCommands
                  weapons.qc : W_WeaponFrame
                  client.qc : PlayerPostThink
                  weapons.qc : CycleWeaponCommand
                  runaway loop error
                  Host_Error: Program error
                  ]condump

                  is there a way to block cycling weapons while in observer to avoid this runaway?

                  or is there a long way i would have to take?

                  Comment


                  • #10
                    In weapons.qc, look for the ImpulseCommands function.

                    Move this code you added to the beginning of the function:

                    Code:
                    if (self.impulse == 99)
                    {
                    	if (self.observer == FALSE)
                    		ObserverStart ();
                    	else
                    		ObserverEnd ();
                    
                    	self.impulse = 0;
                    	return;
                    }
                    Note that I added two lines of code (the self.impulse line + the return), it'll be necessary for the next step. Right after the code (after the } character), add this:

                    Code:
                    	if (self.observer == TRUE)
                    		return;
                    After this line should be the rest of the impulse code.

                    Comment


                    • #11
                      I was thinking, and I didn't include the code to remove the observer flag. In PutClientInServer () in client.qc somewhere beside all the other variables to be reset, add:

                      Code:
                      self.observer = FALSE;
                      As for that runaway loop error, I think the cause is because as observer you have no weapons/items so the weapon cycle function doesn't know what to do. I forgot to restrict impulses to observers. The way Zop showed you will work perfectly fine. Depending on how far you take observer mode, you might want to make a separate function for observer impulses. That way entities in game use default ImpulseCommands () and observers use ObserverCommands (), it just keeps things tidy. I'm probably boring you now so tell me if anything else comes up!

                      Comment


                      • #12
                        heh thanks zop and bam [or is it bam and zop.....bzaomp], i also saw the observer flag not leaving because when i tried o go back in to observer it kept jumping me in to the feild, and after i was in observr mode i would jump like in space, couldent change weapns, and when i fired i would whiparind like i was in a tornado

                        Comment


                        • #13
                          I put this into RMQ. Works like a charm.

                          I had to disable Gyro and footsteps on the player when entering observer ;-)

                          Thanks, it's simple but will do. I hope I can make this coop-ready, too.

                          One more question, how do I create a readymade alias for this? I know I have to use stuffcmds, but I'm a mapper, not a coder.
                          Scout's Journey
                          Rune of Earth Magic

                          Comment


                          • #14
                            Originally posted by golden_boy View Post
                            I put this into RMQ. Works like a charm.

                            I had to disable Gyro and footsteps on the player when entering observer ;-)

                            Thanks, it's simple but will do. I hope I can make this coop-ready, too.

                            One more question, how do I create a readymade alias for this? I know I have to use stuffcmds, but I'm a mapper, not a coder.
                            Peek in the vote-map tutorial and you'll see ...

                            float POQ_BINDINGS_SENT = 2;
                            POQ stands for "plain old Quake", btw.

                            Anyway, a new client connecting won't have that set in their flags.

                            void ()
                            SetNewParms =
                            {
                            parm1 = IT_SHOTGUN | IT_AXE;
                            parm2 = 100;
                            parm3 = 0;
                            parm4 = 25;
                            parm5 = 0;
                            parm6 = 0;
                            parm7 = 0;
                            parm8 = 1;
                            parm9 = 0;
                            parm10 = POQ_NEW_CLIENT; // New client! They will need aliases sent!
                            };
                            Instead ... they will be set as POQ_NEW_CLIENT. So when the "does the client needs binds" logic kicks in, it'll see that "yes they do" and then some stuff in bindings.qc sends them what they need.

                            So just add in whatever alias + impulses you decide should be the observer ones in that.

                            bindings.qc file that comes with the vote-map tutorial and you'll get the idea on how to make add that in there too.

                            The key really is that it is best if also have the vote-map code integrated too. It allows you to leverage the same features and avoid duplication (i.e., part of the vote-map code clears the indicator on whether or not the client has received the bindings etc.)

                            If you have questions, ask back.
                            Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                            So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                            Comment


                            • #15
                              I do.

                              I followed the vote tutorial, and I'm confused about SetNewParms() versus SetNewParms2().

                              It's clear that the former should be called on client connect, and the latter on respawn.

                              However, in our mod, the original SetNewParms() is only called from SetChangeParms() - NO other place. So Bam is incorrect when he says that SetNewParms() is called from other places in client.qc AFTER you make all the listed changes to SetNewParms2().

                              Even in your own poq_votable progs, SetNewParms() isn't called at all anymore. o_O

                              Please clear up in which function the original SetNewParms() should be called, and which other functions should call SetNewParms2().

                              Second question: In observer.qc, in ObserverEnd(), I guess I should use SetNewParms2() because it's not a new client, right?

                              gb
                              Scout's Journey
                              Rune of Earth Magic

                              Comment

                              Working...
                              X