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 → Flicker cog.. Need some insight
Flicker cog.. Need some insight
2005-03-07, 10:16 AM #1
Ok, I've got a skybox 3do that goes around my entire level. All sky surfaces are flagged to geo 0. The 3do basically blocks out the hom from the level. But it needs a flicker cog to render, since it spans multiple sectors. Not a problem, Iv'e done this before.

This time, I've run into a problem where the player being on the surface of water, will not render the 3do. So I fixed it by getting the sector of a point just above the player (the view sector, thanks to Sige for the code :D )

Now here's where the craziness starts. It works perfect for the host, but a client joining the game will hom like crazy. I think its not getting the right sector for the client (as ocassionally the sky will show up, untill you move from a "stable" sector)

I also just added "nolink" to the flicker things... I'm not 100% sure what thats for :p anyway, here is the cog:

Code:
flags=0x240

symbols

int		ObjCount		local

thing		ObjThng0		nolink
thing		ObjThng1		nolink
thing		ObjThng2		nolink
thing		ObjThng3		nolink
thing		ObjThng4		nolink
thing		ObjThng5		nolink
thing		ObjThng6		nolink
thing		ObjThng7		nolink
thing		ObjThng8		nolink
thing		ObjThng9		nolink
int         running=0			local
int         sectorid			local
int         sectorcount			local
int         surfacecount		local
int         s				local
int         f				local
flex        dot1			local
flex        dot2			local
vector      testpt			local

template	ObjTpl0			local
template	ObjTpl1			local
template	ObjTpl2			local
template	ObjTpl3			local
template	ObjTpl4			local
template	ObjTpl5			local
template	ObjTpl6			local
template	ObjTpl7			local
template	ObjTpl8			local
template	ObjTpl9			local

vector		ObjPos0			local
vector		ObjPos1			local
vector		ObjPos2			local
vector		ObjPos3			local
vector		ObjPos4			local
vector		ObjPos5			local
vector		ObjPos6			local
vector		ObjPos7			local
vector		ObjPos8			local
vector		ObjPos9			local

vector		ObjLook0		local
vector		ObjLook1		local
vector		ObjLook2		local
vector		ObjLook3		local
vector		ObjLook4		local
vector		ObjLook5		local
vector		ObjLook6		local
vector		ObjLook7		local
vector		ObjLook8		local
vector		ObjLook9		local

message		newplayer                                                          
message		pulse                                                            

end                                                                           

code

newplayer:

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

	player=GetLocalPlayerThing();

	ObjCount=0;

	for(x=0; x<10; x=x+1)
	{if(ObjThng0[x] != -1) ObjCount=ObjCount+1;}

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

	for(x=0; x<ObjCount; x=x+1)
	{
		ObjPos0[x]=GetThingPos(ObjThng0[x]);
		ObjLook0[x]=GetThingLVec(ObjThng0[x]);
		ObjTpl0[x]=GetThingTemplate(ObjThng0[x]);
	}

	//Start our pulse
	SetPulse(0.01);

return;

pulse:

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;
      }
   }

	for(x=0; x<ObjCount; x=x+1)
	{	

//Printint(GetThingSector(Player));
//Printint(sectorid);
//Printint(ObjThng0[x]);
		//Destroy the 3do	
		DestroyThing(ObjThng0[x]);

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

		SetThingLook(ObjThng0[x], ObjLook0[x]);

	}

return;

end
Jedi Knight Enhanced
Freelance Illustrator
2005-03-07, 3:05 PM #2
Fixed it :D

I figured out that since the level object wasn't local, the host would join the game, and start delete/creating the template, and when the client joined, the object had already been deleted, so it had nothing to delete/create.

I made the object local, then created the template on startup, problem solved :)
Jedi Knight Enhanced
Freelance Illustrator

↑ Up to the top!