Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #7171

Re: Visibility algorithm

Newsgroups comp.programming
Date 2016-12-16 12:01 -0800
References (1 earlier) <5707a105-caae-4fae-a74e-f42cfb35cb38@googlegroups.com> <16cc324c-a73a-42d3-b244-21178e44b717@googlegroups.com> <da37e5ab-f364-4923-bd7e-9790837e49ba@googlegroups.com> <b062f7d1-f2a2-4800-bf65-dd72cae37963@googlegroups.com> <9e67ff3c-7840-493a-96d0-b3c7898d9183@googlegroups.com>
Message-ID <eeb79cd9-458f-4582-abcd-c22d1c8a3593@googlegroups.com> (permalink)
Subject Re: Visibility algorithm
From fir <profesor.fir@gmail.com>

Show all headers | View raw


W dniu piątek, 16 grudnia 2016 20:56:04 UTC+1 użytkownik fir napisał:
> W dniu piątek, 16 grudnia 2016 20:46:20 UTC+1 użytkownik fir napisał:
> > W dniu piątek, 16 grudnia 2016 20:22:17 UTC+1 użytkownik fir napisał:
> > > W dniu piątek, 16 grudnia 2016 20:06:34 UTC+1 użytkownik malcolm...@btinternet.com napisał:
> > > > On Friday, December 16, 2016 at 7:00:31 PM UTC, fir wrote:
> > > > >
> > > > > are you sure it is worth doing? maybe it is worth but 
> > > > > im not sure,
> > > > >
> > > > The alternative is just to declare every visited "room" visible.
> > > > >
> > > > > You probably has some range in vision in tiles (how many it is?) 
> > > > > when i was writing something like that for rogualike vision was 
> > > > > short (dont remember but r<15 tiles  or so, and i could do it 
> > > > > more simple, sorta like bressenham based - i dont remember - 
> > > > > no any angle calculations needed) - esp where in game you wanted 
> > > > > czeck vuision not between all bots and all vicinity tiles but in
> > > > > pairs bots-bots or bots-items (dont remember the details)
> > > > > 
> > > > The visible portion of the map isn't very large. But you want to
> > > > be able to scale up for AI bots.
> > > 
> > > so what you wanna do coz i dont understand ?
> > > 
> > > if you want me to thinking of answer tell maybe how you plan to do it , i probably would do it at first draft as
> > > 
> > > for each ring form 1 to n
> > > {
> > >   for each cell in ring
> > >   { 
> > >     if(cell in angles) continue;
> > >     if(cell==wall) add_angle(angle[cell][ring]);
> > >   }
> > >   sort and merge angles //strightforward i think
> > > }
> > >  
> > > the details (of lookup, inserting and sort/merge)  should not be so hard - i would do it on normal arrays if i would chose such method at all
> > 
> > i think probably there is a way to do it better:
> > those precalculated angle[cell][ring] is just a array of angle[x][y] on the other side, you could just use this
> > or better skiop this at all - if given cell is visible 
> > it depends on some vicinity cells betwean this cell and vicinity cells on a way of radius, (so very little need to be checked) - those cells may be denoted as visible, non visible or nontested, some only need a way of wandering on all this and just set the satatus based on the neighbours
> > - it should be faster and it resembles midpoint algorithm in some way (midopint test for distance (if x*x+y*y >R*R) here one will need some test for "radiality" - dont know the detaild i would need pen and paper maybe)
> 
> this should be a candidate on recursive method, 
> 
> start from central visible point 
>  recurse on all potentially visible (it is not wall) neighbours - point is visible if at least one of his 
> radial neighbours is visible [what are exactly this radial neighbours im not sure now, but maybe simple chose of 3 
> neighbours would work ok]

ye this could work as each given pixel shows two walls and one corner to the radius/origin point (except those pixels that touch axes, thiose only show one wall) - this meand which 3 neighbours need to check for each (if im not wrong), so put it recursively and it should fast fill all visibles /woah) 

> - repeat until recursion ends

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Visibility algorithm malcolm.mclean5@btinternet.com - 2016-12-15 16:12 -0800
  Re: Visibility algorithm fir <profesor.fir@gmail.com> - 2016-12-16 11:00 -0800
    Re: Visibility algorithm malcolm.mclean5@btinternet.com - 2016-12-16 11:06 -0800
      Re: Visibility algorithm fir <profesor.fir@gmail.com> - 2016-12-16 11:22 -0800
        Re: Visibility algorithm fir <profesor.fir@gmail.com> - 2016-12-16 11:46 -0800
          Re: Visibility algorithm fir <profesor.fir@gmail.com> - 2016-12-16 11:56 -0800
            Re: Visibility algorithm fir <profesor.fir@gmail.com> - 2016-12-16 12:01 -0800
              Re: Visibility algorithm fir <profesor.fir@gmail.com> - 2016-12-16 12:07 -0800
                Re: Visibility algorithm Chad <cdalten@gmail.com> - 2016-12-16 15:05 -0800
                Re: Visibility algorithm fir <profesor.fir@gmail.com> - 2016-12-17 05:39 -0800

csiph-web