Fog of war =

1)  Divide world into tiles.
2)  Tile can have any of 3 states { FOGGED, PARTIALLY FOGGED, CLEAR }
3)  If tile = FOGGED, draw black (or don't draw at all if you're
clearing to black)
4)  If tile = CLEAR, draw normal stuff.
5)  If tile = PARTIALLY FOGGED, draw normal stuff, determine which
direction the blend is in (examine surrounding tiles) and draw a pre-
made tile of partially blended fog at the orientation you determined
it to be in.

As far as drawing or not drawing characters under fog of war, just
examine the tile they are currently standing on to figure out whether
or not to draw them.

It's actually not that hard to implement in Canvas or OpenGL if you
plan ahead a little and tile your world.

The one thing you do not want to do is draw everything and then try to
draw the fog on top.  That's way more pixel writes than optimal and
will probably give subpar performance on many devices.

On Sep 7, 8:08 pm, Miguel Morales <[email protected]> wrote:
> Um ok, my solution would work just fine.  Except maybe speed-wise.  In
> which case you can then add a GL overlay to your 2d canvas.
>
> On Fri, Sep 3, 2010 at 7:37 PM, John Paul Bernal <[email protected]> wrote:
>
>
>
>
>
> > we are using overhead view and 2d graphics on canvas. Our "character"
> > is a ball where it needs to find key items to be able to exit the
> > world map.
>
> > On Sep 3, 2:17 am, String <[email protected]> wrote:
> >> I can imagine several ways to accomplish it, but it completely depends
> >> on what graphics approach you're using in your "maze game." 2D using
> >> Canvas? 3D using OpenGL? Is it first-person or overhead view? Etc.
>
> >> String
>
> >> On 2 Sep, 07:52, John Paul Bernal <[email protected]> wrote:
>
> >> > we're making a maze game and we've been thinking if we added fog of
> >> > war in our game so it would be more challenging but we're stunned on
> >> > how we can implement it or is it even possible?
> >> > Help would be really appreciated. ~JP
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> ~ Jeremiah:9:23-24
> Android 2D 
> MMORPG:http://developingthedream.blogspot.com/,http://diastrofunk.com,http://www.youtube.com/user/revoltingx

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to