Game Development Community

Enemy Unit Model Visibility

by Univ. of Michigan Dearborn (#001 · in RTS Starter Kit · 03/25/2006 (9:22 am) · 1 replies

I've just started toying around with unit visibility in the RTSK and am having some problems. Here's what I'm doing and what I want to accomplish.

I am loading 7 units into a level, each evenly spaced apart in one row. Each of the units can belong to one of two teams (blue or red, blue's can be controlled by the player). From left to right, here are their team colors: R R B R R B B. Each of these units are about 20 lengthUnits apart (using %this.createPlayer("-50" SPC "-350" SPC "20", 0); where the first parameter is changed to -30, -10, etc).

Now when I move that first B on the left either forward or backward a short distance, the R's on either side tend to disappear. Meaning, the models become invisible but their health bars can still be seen if you know where to click.

What I'm trying to do is to find a way to change the distance at which these units can be seen (and perhaps disable invisibility altogether). So far I've poked around in a couple of files. One that seems to be of the most interest to me is ~\engine\game\RTS\visManager.cc.

In this file I've set the "gFogOfWarIsOn" to false and left gTeamsShareVision to true but all that seems to do is completely turn the enemy models invisible no matter how close you come to them. So I've just left both of those variables set to true.

I've also done things such as changing thisConn->setUnitInvisible(unit); to thisConn->setUnitVisible(unit); in multiple places (around lines 35, 48, 110, and 121). The only thing that seems to disable any kind of hiding of enemy models is by changing the conn->setUnitInvisible(unit); call in VisManager::processClient() to conn->setUnitVisible(unit); I know I probably shouldn't be mucking with the engine but I can't seem to find anyplace to change visibility in the scripts sans one location.

And that location is in the actual unit's avatar .cs file. I can change unit's "vision" variable to something like 500 and it still won't have any affect. But I can change other attributes -- like doubling the unit's move speed -- and the unit does move faster on the screen. I read the Manual and noticed that range variable relates to how far the unit can see (is this just to attack or is it to actually draw enemy models?). Again, I've cranked this up from 2 to 50 and there was no change in terms of seeing distance.

Also, due to the size of the models, I've had to scale them up by 20 in each direction as well as shrink their boundingBox down to 0.3 in each direction. Not sure if that would have anything to do with the visibility or not.

#1
03/30/2006 (4:10 am)
Check the thread in the Error/Bug section "RTSUnitData missing addfield"
There is a vision variable/field that was left out that affects the VisManager