PDA

View Full Version : RVTCS v3 Cog Problems...



CaptBevvil
05-13-2005, 10:23 AM
# RVTCS - Ranged Vector Thing Culling System
#
# Visibility controller - 10 objects.
#
# Version 0.3
#
# 06/2002 GBK
# Cog used to supliment as a primitive object culling system for JK. Good for up to 10 objects.
# Must be used with the JK.EXE Patch.

Flags=0x240
Symbols
Message Startup
Message Pulse

Thing Player Local

Int Used=0 #How many objects you've used. (count 0 as 1).

Flex Min_range=0 #Distance to/from player in which an object is visible.
Flex Max_range=2
Flex Pulserate=0.1 #How often the cog checks for distance.

Thing Object0
Thing Object1
Thing Object2
Thing Object3
Thing Object4
Thing Object5
Thing Object6
Thing Object7
Thing Object8
Thing Object9

Int I=0 Local

Vector Pos_T Local

End
Code
Startup:
Sleep(Getselfcog()/10);
Player = JKgetlocalplayer();
Setpulse(Pulserate);
Stop;
Pulse:
Pos_t = Getthingpos(Player);
For(I=0;I<=Used;I=I+1)
{
If(Vectordist(Getthingpos(Object0[I]), Pos_t) <= Max_range && Vectordist(Getthingpos(Object0[I]), Pos_t) >= Min_range)
Setthinggeomode(Object, 3);
# Set the object visible...
Else
Setthinggeomode(Object, 0);
# Set the object invisible...
}
Stop;
End


It doesn't seem to work at all. For one object, I tried both 0 and 1 for the Int number. I entered the things number in the first appropriate value space for it. Set the min to 0 and the max to 2. I left the pulse at 0.1. It never switches to Geo 0 like it's supposed to. :(

Emon
05-13-2005, 01:52 PM
Why are you still using that? The thing limit has been removed via a patch. The only thing you'd need RVTCS for is distance culling for video performance reasons.

LKOH_SniperWolf
05-13-2005, 02:42 PM
Which is exactly what it is, Emon, if you actually take the time to read it.

As for the cog, I actually see a few errors.
One, you wouldn't want SetThingGeoMode(object, 3);

3 is the geomode for solid colored objects, of which, I have no idea what it might do. I'd suggest 4.

The next is the verb he wants to use is SetThingCurGeoMode, not SetThingGeoMode. Things apparently have two GeoMode values. GeoMode, is (I'm assuming...) basically the default value, what by default the mode should be. CurGeoMode, is the geo mode used for rendering. It's the current rendering geo mode.

The other, is apparently he forgot how to use arrays for a minute or two...

SetThingCurGeoMode(Object0[i], 4);

and

SetThingCurGeoMode(Object0[i], 0);

Those are the lines you'll want to use for setting the thing visible and invisible.

Emon
05-13-2005, 04:35 PM
Originally posted by LKOH_SniperWolf
Which is exactly what it is, Emon, if you actually take the time to read it.
No, it was designed to get around the thing limit, video performance is secondary. I don't see where in his post he specifies what it's for. If it's for thing limit, then he shouldn't bother.

gbk
05-13-2005, 06:10 PM
Geeze, I must have been on crack. Here (http://shauri.info/src/rvtcs3.cog) is the new version...

LKOH_SniperWolf
05-13-2005, 06:18 PM
The version Bevil has wasn't for getting around the thing limit, but simply to not render things outside of a certain range.

# RVTCS - Ranged Vector Thing Culling System
#
# Visibility controller - 10 objects.

It never switches to Geo 0 like it's supposed to.

That was enough for me to know it wasn't about the thing limit.

Emon
05-13-2005, 06:28 PM
Well it was GBK's COG...I mean GBK wrote it...I can't trust what it says! ;)

Heh, actually I didn't look much at the COG. I didn't know RVTCS v3 was new. Though I should have noticed th length at least.

CaptBevvil
05-14-2005, 07:34 AM
Thanks GBK and SniperWolf!

You guys are da mad bombs! :em321:

[edit:] Woops, GBK forgot the SetThingCurGeo again..


# RVTCS - Ranged Vector Thing Creation System
#
# Visibility controller - 10 objects.
#
# Version 0.3.1
#
# 6/02,5/05 gbk
Flags=0x240
Symbols
Message Startup
Message Pulse

Thing Player Local

Int Used=0 #How many objects youve used. (Just put the number of the last object)

Flex Min_range=0 #Distance to/from player in which an object is visible.
Flex Max_range=2
Flex Pulserate=0.1 #How often the cog checks for distance.

Thing Object0
Thing Object1
Thing Object2
Thing Object3
Thing Object4
Thing Object5
Thing Object6
Thing Object7
Thing Object8
Thing Object9

Int I=0 Local

Vector Pos_T Local

End
Code
Startup:
Sleep(Getselfcog()/10);
Player = JKgetlocalplayer();
Setpulse(Pulserate);
Stop;
Pulse:
Pos_t = Getthingpos(Player);
For(I=0;I<=Used;I=I+1)
{
If(Vectordist(Getthingpos(Object0[I]), Pos_t) <= Max_range && Vectordist(Getthingpos(Object0[I]), Pos_t) >= Min_range)
SetThingCurGeoMode(Object0[i], 4);
# Set the object visible...
Else
SetThingCurGeoMode(Object0[I], 0);
# Set the object invisible...
}
Stop;
End


Now it works. :cool: