Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → GBK's Flicker Cog... PROBLEM!!!
GBK's Flicker Cog... PROBLEM!!!
2005-08-05, 7:27 PM #1
Yes. GBK's flicker cog has some weird stuff going on.

I am using it in one of my new levels. Unfortunatly, it doesn't work right. Instead of stoping the 3do from flickering when it goes into multiple sectors, it doesn't do anything to the 3do. <-- Thats the minor problem

The big problem is that it turns every walkplayer into that same 3do. They still act like walkplayers but they aren't using the proper 3do. They are using the one I specified in the flicker cog.

Can anyone help me figure out what is going on?
2005-08-05, 9:35 PM #2
Post the cog.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2005-08-06, 4:31 PM #3
Code:
# Jedi Knight Cog Script
#
# flicker.cog
#
# Makes it so that 3dos crossing more than one sector don't
# flicker or disappear and also when the player looks at it
#
# Go go Hellcat for explaining this to me. =)
#
# Concept by Hellcat (and GBK?)
# Raped for TDiR by Hell Raiser [Jon Harmon]
# Some bug fixing modifications by Shred18
# Implemented sector finding code by Sige

flags=0x240
symbols

int		ObjCount		local

thing		ObjThng0		local		
int         running=0			local
int         sectorid			local
int         sectorcount			local
int         surfacecount		local
int         s				local
int         f				local
int	    x				local
flex        dot1			local
flex        dot2			local
vector      testpt			local

template	ObjTpl0

vector		ObjPos0			local

vector		ObjLook0		local

message		startup                                                          
message		pulse                                                            

end                                                                           

code

startup:

//Sleep while the level loads
	sleep(0.25);

	ObjThng0=CreateThingAtPos(ObjTpl0, GetThingSector(Player), GetThingPos(player), '0 0 0');
	player=GetLocalPlayerThing();

	ObjCount=0;

	if(ObjThng0 != -1) ObjCount=ObjCount+1;

	//Get the rotation and position and template of the object

		ObjPos0=GetThingPos(ObjThng0);
		ObjLook0=GetThingLVec(ObjThng0);
		ObjTpl0=GetThingTemplate(ObjThng0);

	//Start our pulse
	SetPulse(0.01);

return;

pulse:

//if(GetThingSector(ObjThng0) == sectorid){return;}

testpt = VectorAdd(GetThingPos(player), VectorSet(0,0,0.037));  //actual camera position vector

sectorid = -1;
   sectorcount = GetSectorCount();
   for (s = 0; s < sectorcount; s = s + 1)
   {
      surfacecount = GetNumSectorSurfaces(s);
      for (f = 0; f < surfacecount; f = f + 1)
      {
         dot1 = VectorDot(testpt, GetSurfaceNormal(GetSectorSurfaceRef(s, f)));
         dot2 = VectorDot(GetSurfaceVertexPos(GetSectorSurfaceRef(s, f), 0), GetSurfaceNormal(GetSectorSurfaceRef(s, f)));
         // outside of the sector
         if (dot1 < dot2)
         {
            f = 9999999;
         }
      }
      if (f != 10000000)
      {
         sectorid = s;
         s = 9999999;
      }
   }
	

//Printint(GetThingSector(Player));
//Printint(sectorid);
//Printint(ObjThng0);

// if (sectorid != GetThingSector(player)) 
//{
//jkStringClear;
//jkStringConcatFormattedInt(GetThingSector(player), "player sector: %d   ");
//jkStringConcatFormattedInt(sectorid, " SectorID: %d ");
//jkStringOutput(-1, -1);
//}
		//Destroy the 3do	
		DestroyThing(ObjThng0);

		//Recreate the 3do
		ObjThng0=CreateThingAtPos(ObjTpl0, sectorid, ObjPos0, ObjLook0);
		//SetThingLook(ObjThng0, ObjLook0);


return;

end


This is the only version of the cog I can get.
2005-08-06, 10:27 PM #4
Nooo, GBK couldn't have used my way of finding a posistion in a sector. *sigh* Well, my bet is because this cog operates on templates, and it creates a thing using that same template, and in the template, you are getting the default player model because thats what it is in the template. The 3do should not flicker, thus therefore do nothing. This PREVENTS that from happening by setting the things sector to the players sector by creating and destroying the thing rapidly, that is how this cog operates. The cog is correct in short.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2005-08-06, 11:21 PM #5
I'd create a ghost with the new sector and use teleportThing() on the 3DO to be "flickered". Finding the position within a sector would be significantly more overhead than just destroying it and recreating it. You probably won't notice in most circumstances on modern machines, but it's not a good idea when there's a better alternative.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2005-08-07, 5:09 AM #6
Originally posted by Descent_pilot:
Nooo, GBK couldn't have used my way of finding a posistion in a sector. *sigh* ...


I didnt write that cog. Hell Raiser, Shred18 and Sige did. The *concept* is by me...I wrote the first of these sort of cogs to handle dynamic lighting.



The cog seems to be using one of those silly sector locator algorithms. That may be the cause of your problems...
And when the moment is right, I'm gonna fly a kite.
2005-08-07, 6:43 AM #7
Ouch, I didn't know my sector finding code got around so much :P
Air Master 3D (my iPhone game)
My Programming Website
2005-08-07, 6:56 AM #8
Originally posted by gbk:
The cog seems to be using one of those silly sector locator algorithms. That may be the cause of your problems...
That "silly algorithm" is used for everything from CSG to collision detection.
2005-08-07, 10:20 AM #9
Yea... but :( I thought I discovered something. :p Any comments to me will have to be directed to me secretary (if I had one), I'll be gone for a week. :p
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2005-08-08, 10:22 AM #10
The sector finding code is because of a problem with the camera. Apparently on the surface of water the things weren't being rendered.
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come

↑ Up to the top!