Can I make the area beyond unit's vision completely black?

Can I make the area beyond unit's vision completely black?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Can I make the area beyond unit's vision completely black?

Post by yanom »

So, I'm currently working on a game with some novel features, including "terrain based warfare" - modifiying the terrain to fit the features of your current army. Anyway, normally the area beyond your range of vision is darkened (can't see units) but you can still see the terrain. This means that certain events can be seen through the fog of war, such as rock mining (you can see the minerals disapear off the map) and terrain modification (i think). Also, I'm trying to make the map procedurally generated (like HexFarm).

Anyway, I wanted the area beyond units' vision to be completely black (can't see anything, not even the shape of the terrain). Is there a way to do this?
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Can I make the area beyond unit's vision completely blac

Post by gajop »

afaik, there is no way to do this properly atm.
You may want to check this widget that does something similar, but it's not reliable, and it's slow.
You are supposed to place this widget in LuaUI/widgets, but note it can also be easily disabled.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Can I make the area beyond unit's vision completely blac

Post by Google_Frog »

You'll have to find more examples to convince us that you need this feature.

The terrain is only updated when inside LOS.

Wrecks can be made only visible in LOS. Also I wrote a global LOS mineral system for knorke's game which has a good UI and does not give information away.
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: Can I make the area beyond unit's vision completely blac

Post by yanom »

Google_Frog wrote: Also I wrote a global LOS mineral system for knorke's game which has a good UI and does not give information away.
that sounds like what I need! Where does the code for this live? on SVN somewhere?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Can I make the area beyond unit's vision completely blac

Post by knorke »

for features:
http://springrts.com/wiki/Modrules.lua#featureLOS

googles code is in here:
http://pastebin.com/dtfsDFz7
It works by spawning multiple units and setting visibilty for teams accordingly.
Because script.HitByWeapon is called before UnitPreDamaged, there was problem that minerals would lose pieces (script thinks it is hit) but gadget said "no, you are not hit" but too late: pieces were already lost.
Kind of fuddled around that now but maybe something to watch out for.
If you want the units to move, you will have to add some SetUnitPosition stuff.

Or just make the rocks not be always visible?
Could also draw something like "ghosted building" widget does
In XTA see unit_ghostSite.lua and unit_ghostRadar.lua
Post Reply

Return to “Game Development”