Questions tagged [line-of-sight]

Indicates that an entity has an unobstructed view of another entity.

Filter by
Sorted by
Tagged with
1 vote
2 answers
992 views

Line-of-sight algorithm for tile-based tactics

I've tried Bresenham line and Raycasting, but they don't quite give the results I need (examples in the screenshot). '&' - character '+' - cells that can be attacked by the character '#' - walls ...
Clyeh's user avatar
  • 13
2 votes
2 answers
175 views

Need help with fixing Optimized Raycasting / Line of Sight algorithm

I'm trying to implement collision detection with raycasting for my 2D javascript game. The game uses equally-sized tiles as its level structure so to optimize collision detecton I'm trying to use a ...
Siggy7786's user avatar
4 votes
1 answer
866 views

Supercover line algorithm from corners instead of the square's center?

I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#...
Ainsley Harriott's user avatar
0 votes
0 answers
196 views

How to do draw a "visibility polygon" in 2D top-down Unity? [duplicate]

I've made a very simple 2D top down prototype with Unity. Now I want to expand the thing and add a feature where objects change when the player looks at them. So I have to add a visibility polygon ...
Gener4tor's user avatar
  • 156
0 votes
0 answers
161 views

Help me optimize my Line Of Sight on a 2d grid algorithm?

...
Tree3708's user avatar
23 votes
4 answers
9k views

How to make AI detect a target behind a wall, who is only partially exposed?

I'm making an FPS game where, even when a target's whole body is behind a wall or box, but its finger or foot exposed, the AI should be able to detect it and shoot its finger. So far the way I've ...
BrucePai's user avatar
  • 347
0 votes
1 answer
213 views

2D line of sight - hiding all tiles behind walls

I'm interested in knowing the techniques on how 2D games hide tiles that are behind walls. This is a really old MMO that is probably the easiest example to show what I'm asking. Here you can see ...
Manshoe's user avatar
2 votes
1 answer
2k views

3D line segment AABB collision, with hit normal?

I'm embarrassed I can't find this, but I'm wanting to detect intersection with a 3D line segment (not an infinite ray) with a 3D AABB, the AABB being defined as two Vec3f's which represent the Min and ...
ps48's user avatar
  • 69
1 vote
2 answers
984 views

How to make a vision cone for the enemy in game maker?

I'm making an enemy object where the enemy look for the player when he's going on a patrol I want the vision cone to changes direction corresponding to the sprite.When the sprite turn right,the cone ...
TankRocket's user avatar
0 votes
1 answer
33 views

How to determine if and when a point and triangle moving uniformly will collide?

TLDR; I just learned this problem can be simplified to: How to determine the time at which a uniformly moving point will intersect with a stationary triangle? Also, how to figure out the time when ...
Coco DaWhiteBerry's user avatar
0 votes
1 answer
140 views

NavMesh - LoS and "Containing"

For a gameserver/backend, I have a navmesh for "walkable" areas in form of points/triangles. Now I want to check every gametick if the client is still in a legit place and if he shots/casts a spell, ...
thetemplar's user avatar
0 votes
2 answers
152 views

Find if one player is visible to the other

Two players (p1 and p2) are standing in a 3D space, represented by points (x1, y1, z1) and (x2, y2, z2). Player 2 is holding a light source, pointing in the direction given by a normalised vector (xn, ...
rranjik's user avatar
  • 103
0 votes
1 answer
2k views

Unity Hit Collider GameObject is Null when Collider is Child (Line-of-Sight Detection Problem)

I'm creating line-of-sight code in Unity. It allows a radar to check whether it can see an object, or whether the object is behind an obstacle (a collider). Similarly to Unity's suggestion, I check ...
Denis G. Labrecque's user avatar
2 votes
2 answers
779 views

Fastest visibility calculation towards all possible directions

I am searching for your advice. I have a massive voxelized model, like the one in the picture (but with a few million voxels more..). To reduce the total number of the model’s triangulations, I can ...
Gouz's user avatar
  • 121
2 votes
1 answer
444 views

How to implement D&D 4e's line of sight algorithm?

D&D 4th Edition (the tabletop game) has combat on a 2D map with square tiles. A creature occupies an entire single tile. The attacker has clear sight on the defender if lines can be drawn from ...
user41258's user avatar
  • 131
3 votes
2 answers
4k views

How can I create a fog-of-war based on character line of sight mesh and a shader?

I've a 3D-game using perspective view, through raycasting, I create a mesh that represents the line of sight of my characters. I'm looking for a way to "darken" (think old-school Fog of War - ...
ag4w's user avatar
  • 101
2 votes
1 answer
127 views

Best way to get the maximum moveable Area

I was thinking about creating a polygonal area, for a given unit, in which it can move with a given range (radius) but with care for obstacles. Here is a picture to visualize my idea: My Ideas so ...
LuaNoob's user avatar
  • 161
0 votes
1 answer
141 views

Simultaneous line of sight for hundreds of individual agents on a grid?

I have a large grid with hundreds of individual agents, each of which is moving around based on its own visual inputs and a fast control algorithm. My question is: How can I efficiently provide each ...
Charles Ofria's user avatar
2 votes
3 answers
192 views

How to find grid cells not seen by an object

I am writing a VB.NET program. I have a grid view which is made of multiple small cells called grid cell. On the grid view, I have placed an obstacle (red box) and an observer (blue box). My task ...
hunterex's user avatar
  • 141
3 votes
0 answers
867 views

Proper Line of Sight in tile based game

My rendering engine currently takes "xMin, yMin, xMax, yMax" to render a rectangular region of tiles, and will automatically scale based on the size of the panel it is rendering to. However, I am ...
Someguynamedpie's user avatar
4 votes
1 answer
1k views

Calculate visible points in grid in 2D game

I have a game grid and I need to figure out which game grid points are not behind occupied grid point from players view. The visible points. I'd like to define a visible point first, because it can ...
Tomáš Zato's user avatar
3 votes
2 answers
292 views

Creating LOS zones on a 2D grid for chase AI

I have a 2D grid, around 20x20, stored as an array. Each grid cell can contain an opaque object or not. I also already have an algorithm to calculate LOS between any two squares via Bresenham. I want ...
Mark Green's user avatar
3 votes
3 answers
866 views

anisotropic fog of war

Here I am not talking about how to render fog of war, but how to model exploring of terrain in a more sophisticated way. In a straight-forward approach, terrain explored by a game unit is simply ...
shikui's user avatar
  • 31
5 votes
1 answer
2k views

Implementing line-of-sight in 3D?

I've been searching for information on implementing line-of-sight in my game. I've found some great resources for 2D implementations that produce pixel-perfect results, but there's very little info on ...
manabreak's user avatar
  • 1,048
4 votes
3 answers
11k views

How do I check whether a camera has unobstructed view of a GameObject?

I want to check if a GameObject is visible to the camera. The renderer.isVisible-method only checks if the camera is turned ...
Bitcoin M's user avatar
  • 143
0 votes
1 answer
929 views

Line of Sight with Bresenham

I have a simple function to determine whether an entity can see another, in a top-down tile-based game (this is actually a tiny bit more complex in my game, to determine whether to see the first block,...
user2499946's user avatar
7 votes
3 answers
1k views

Inconsistent movement / line-of-sight around obstacles on a hexagonal grid

In a roguelike game I've been working on, one of my core design goals has been to allow the player to "Play the game, not the grid." In essence, I want the player's positioning to be tactical because ...
Darq's user avatar
  • 173
58 votes
7 answers
10k views

Can I prevent diagonal movement from exploring more of the map?

In a tile-grid where movement in any of 8 directions takes exactly the same amount of turns (chess-board style rules), can I prevent diagonal movement from showing more new tiles than orthogonal ...
Mr. Smith's user avatar
  • 813
3 votes
1 answer
498 views

Determining whether an object is in field of view considering obstacles

I'm thinking of stealth games where an object has a certain field of view that you want to avoid otherwise game over. The field of view may be linear or circular or any arbitrary group of pixels/...
MxLDevs's user avatar
  • 143
2 votes
2 answers
344 views

Calculation: Is a sphere/square/plane visible from a certain point?

I'm searching for a way to detect if a form (shape can be changed if algorithm requires it) is visible from a single point in a 3D tile-based world. This should be used as some kind of wall-hack ...
Chris's user avatar
  • 229
4 votes
2 answers
1k views

MMO, server-side line of sight

I am working on a simple tile-based multiplayer game. I am rather experienced programmer, but not so experienced game developer. The players will see each other depending if there is a blocking ...
Jakub M.'s user avatar
  • 191
3 votes
1 answer
429 views

Effecient finding of long-range spotting targets

I'm creating a top-down 2d strategy game, with a square grid map. So far, I've used Bresenham's line drawing algorithm in a circle to determine what's in LOS of each unit, and then targedt one of the ...
nihohit's user avatar
  • 595
5 votes
1 answer
1k views

Line draw on “even-q” vertical flat topped hex grid

I'm trying to implement a Line Draw or Line of Sight algorithm for my hex boardgame. Upon reading several different solutions from most common places like the Hex Bible, none of the algorithms adapted ...
MLProgrammer-CiM's user avatar
10 votes
2 answers
1k views

Diagonal line of sight with two corners

Right now I'm using Bresenham's line algorithm for line of sight. The problem is I've found an edge case where players can look through walls. Occurs when the player looks between two corners of a ...
Ash Blue's user avatar
  • 254
1 vote
1 answer
461 views

Quick 3D sight calculation algorithm

I have a tile based board game where units move in 3D space on a 2D isometric view. When calculating attack tiles for a unit, how do I verify that they aren't shooting through a wall or a level too ...
Ash Blue's user avatar
  • 254
1 vote
3 answers
368 views

Geometry problem for area of sight

My player have a line of sight and all objects between the white lines, turns red. To compute this, the following conditions are met: if the angle between the yellow line and the red line are small or ...
Vinny's user avatar
  • 56
9 votes
2 answers
13k views

More efficient way to implement Line of sight on a 2d grid with ray casting?

Consider a 2d grid of tiles, and an approximated sphere of coordinates - centered on the player - that represents line of sight. The goal is to block the line of sight beyond obstacles (ie walls). It'...
CodeMoose's user avatar
  • 517
10 votes
2 answers
19k views

Simulating "line of sight" with obstacles on 2d grid?

Ran into an interesting problem. I need to figure out how to simulate line of sight - simple enough, just on a 2d grid with obstacles. Either a grid cell is visible, or it's not. I can get something ...
CodeMoose's user avatar
  • 517
6 votes
3 answers
4k views

Finding cells between two points (along line) to finding obstacles

My game is in 3D environment partitioned with 2D grids in 2 dimensioned array So I can get any cell/node by passing row and col like return _nodes[r][c]. When ...
Noob Game Developer's user avatar
6 votes
2 answers
1k views

Robust line of sight test on the inside of a polygon with tolerance

Foreword This is a followup to this question and the main problem I'm trying to solve. My current solution is an hack which involves inflating the polygon, and doing most calculations on the inflated ...
David Gouveia's user avatar
0 votes
2 answers
3k views

Detecting if line crosses rectangle in python. Need speed boost

I am currently writing a top down man vs robot shooter. The game works now, but if I have a decent sized level it runs slowly when you are being chased by robots. While just roaming around it can go ...
Sudo Bash's user avatar
  • 103
2 votes
1 answer
764 views

Most efficient way to implement walls and shadows in 2d

I am making a 2d top-down programming game similar to robocode. There will be up to 1000 walls (lines) in the arena, and up to 50 robots. Each robot can see in a 90 degree arc, and cannot see through ...
Joel's user avatar
  • 123
2 votes
2 answers
2k views

XNA 2D line-of-sight check

I'm working on a top-down shooter in XNA, and I need to implement line-of-sight checking. I've come up with a solution that seems to work, but I get the nagging feeling that it won't be efficient ...
bionicOnion's user avatar
4 votes
1 answer
766 views

How to calculate FOV with four-walled tiles?

I'm working on a 2D tile-based game. I'm trying to calculate FOV and I've implemented walls so they don't take up an entire tile. Instead, they just take up a side of each tile. Similar to: ...
bifflechips's user avatar
7 votes
4 answers
2k views

Efficient 2d Java Line of Sight for a lot of entities?

My problem today is this: I have many civilians going around, they are classes stored by an arraylist. The idea is when they see another civilian panic, they'll start to panic and it will spread. ...
user940982's user avatar
6 votes
1 answer
1k views

How to implement line of sight restriction in actionscript?

I have a problem with a game i am programming. I am making some sort of security game and i would like to have some visual line of sight. The problem is that i can't restrict my line of sight so my ...
Michiel Standaert's user avatar
12 votes
1 answer
3k views

Draw real time fog of war in 2d game [duplicate]

I have game situation as shown in picture: Red dot: player Brown dot: obstacle ( rock, tree, etc) Grey: non visible area ( under fog of war) My question is: how can I draw that kind of shape, ...
user avatar
5 votes
3 answers
3k views

Make my NPC "see" gameobjects around him in Unity

I have a walking NPC that will "see" the wall in front or behind him (2d gameplay) and that will react accordingly. I was thinking to attach him to an invisible collider that would react to objects ...
Sylario's user avatar
  • 263
9 votes
4 answers
2k views

Finding unoccluded tiles in tile-based game

I am working on a 2D tile-based game, and right now I'm trying to get a 2d equivalent of shadow volumes to work. I'm having trouble finding the surfaces that should cast shadows. From any point in the ...
Gray's user avatar
  • 799