Content

Not quite a Yegge long.

OpenRA gets real “fog of war” support

Tuesday 30 March 2010 - Filed under Uncategorized

I finally got fed up with the level of brokenness in our RA-style shroud code last night, and implemented a real visibility system. We basically have an integer counter for each terrain cell now, which is incremented for each unit which can see the cell, and decremented when it leaves. The RA-style stuff is handled as always by an auxiliary bit per cell, indicating whether that cell has ever been visible to a unit.

This gives us a bunch of advantages:

  1. We now know exactly what cells are visible to the local player, without any more expensive checks (or any per-tick work at all, since the updater is incremental)
  2. We can model the “hide map” crate correctly. Previously, we relied on subsequent unit movement to reveal any shroud at all. Now we can just reset the shroud bits to match the current visibility, in one bulk operation.
  3. It encourages exploration, picketing, etc – whereas in vanilla RA, all you had to do was uncover a bit of terrain ONCE and you could see units moving through it for the rest of the game. This adds significantly to the tactical depth of the game.
  4. We have more options in the implementation of Spy Plane / GPS Satellite, which we’ll be exploring until we find something that plays well.
  5. It’s FAST. The comparison is a bit skewed because the old code *sucked*, but we’re doing significantly more with about the same CPU budget.

Enjoy a screenshot, full of foggy goodness:

Capture

Btw, it’s even better in the Command & Conquer mod, because the smaller sight ranges accentuate the effect.

2010-03-30  »  admin

Share your thoughts

Re: OpenRA gets real “fog of war” support







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>