Questions tagged [line-of-sight]
Indicates that an entity has an unobstructed view of another entity.
50 questions
0
votes
0
answers
71
views
Line Of Sight in javascript DOM game
I am creating a 2D game in javascript using pure DOM, on my computer and on my cell phone WebGL or OpenGL do not work.
How can I create Lights and shadows effects using Line Of Sight, for example, I ...
1
vote
2
answers
1k
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
...
2
votes
2
answers
201
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 ...
4
votes
1
answer
1k
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#...
0
votes
0
answers
199
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 ...
0
votes
0
answers
173
views
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 ...
0
votes
1
answer
245
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 ...
2
votes
1
answer
3k
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 ...
1
vote
2
answers
1k
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 ...
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 ...
0
votes
1
answer
154
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, ...
0
votes
2
answers
158
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, ...
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 ...
2
votes
2
answers
876
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 ...
2
votes
2
answers
496
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 ...
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 - ...
2
votes
1
answer
130
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 ...
0
votes
1
answer
155
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 ...
2
votes
3
answers
193
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 ...
3
votes
0
answers
892
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 ...
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 ...
3
votes
2
answers
300
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 ...
3
votes
3
answers
888
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 ...
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 ...
4
votes
3
answers
12k
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 ...
0
votes
1
answer
956
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,...
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 ...
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 ...
3
votes
1
answer
524
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/...
2
votes
2
answers
345
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 ...
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 ...
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 ...
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 ...
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 ...
1
vote
1
answer
464
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 ...
1
vote
3
answers
370
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 ...
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'...
10
votes
2
answers
20k
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 ...
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 ...
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 ...
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 ...
2
votes
1
answer
768
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 ...
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 ...
4
votes
1
answer
779
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:
...
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.
...
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 ...
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, ...
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 ...
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 ...