Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old July 6, 2010, 03:46   #1
fizzix
Prophet
 
Join Date: Aug 2009
Location: Madison, Wisconsin, US
Posts: 3,023
fizzix is on a distinguished road
bug in head

I've noticed a bug with lighting, where, if I'm using a radius 2 light (like a torch or a lantern) and am standing in a room where there are walls on 3 sides of me, I cannot see the corners next to me. This is extremely obvious in checkerboard rooms, where I can't see anything on any other square.

In trying to debug it, I created a mage and used created doors and there's a second bug where create doors does not create doors diagonally next to you, only on the 4 squares adjacent. What's going on?
fizzix is offline   Reply With Quote
Old July 6, 2010, 06:14   #2
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
I haven't tried head, but there was a trac ticket saying that the distance function was changed. That's dangerous on balls. It used to be that distance((0,0),(1,2)) <= 2 but with a better distance function it is not. I'd guess that is the problem. I think I once thought the fix was to compare distance to r + 0,5 for a radius r ball but I don't remember for sure. There will also be questions about damage reduction. Before this change, that damage was divided by 3. Should that behavior remain or should it divide by 1 + \sqrt{5} ?

These things aren't helpful with integer arithmetic, unless you do things properly and compare squared distances rather than computed distances. You can compare dist^2 <= r^2 + r using integers.
PowerDiver is offline   Reply With Quote
Old July 6, 2010, 13:06   #3
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 41
Posts: 1,516
d_m is on a distinguished road
Quote:
Originally Posted by fizzix View Post
I've noticed a bug with lighting, where, if I'm using a radius 2 light (like a torch or a lantern) and am standing in a room where there are walls on 3 sides of me, I cannot see the corners next to me. This is extremely obvious in checkerboard rooms, where I can't see anything on any other square.
Yeah, that was me

I've had a more accurate distance algorithm for awhile, and I committed it this weekend. I noticed that bug and spent about 3-4 hours yesterday trying to fix it before deciding that:

1. I don't understand all the crazy details of update_view() et al.
2. I hate update_view() et al.

So I think I'm just going to roll this back to fix HEAD.

The one silver lining (for me anyway) was that this motivated me to actually write a permissive FOV algorithm in C along with a tester harness for other FOV implementations.
__________________
linux->xterm->screen->pmacs

Last edited by d_m; July 6, 2010 at 14:59.
d_m is offline   Reply With Quote
Old July 6, 2010, 13:19   #4
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 41
Posts: 1,516
d_m is on a distinguished road
This bug should be fixed as of r1995.
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old July 6, 2010, 14:10   #5
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Quote:
Originally Posted by d_m View Post

1. I don't understand all the crazy details of update_view() et. al.
2. I hate update_view() et. al.
That and the supporting functions can be pretty painful. When I did the 4gai upgrade in NPP I got a decent understanding of it. Feel free to fire any questions my way if you all have to play around with it any more.
nppangband is offline   Reply With Quote
Old July 6, 2010, 15:01   #6
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 41
Posts: 1,516
d_m is on a distinguished road
Quote:
Originally Posted by nppangband View Post
That and the supporting functions can be pretty painful. When I did the 4gai upgrade in NPP I got a decent understanding of it. Feel free to fire any questions my way if you all have to play around with it any more.
I will definitely do that. At this point I think I am not going to touch it again until it's really important (e.g. there is a new FOV/LOS strategy). Hopefully at that point there will be a new implementation

Do you ever stop by #angband-dev on IRC?
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old July 6, 2010, 15:06   #7
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 41
Posts: 1,516
d_m is on a distinguished road
Quote:
Originally Posted by nppangband View Post
That and the supporting functions can be pretty painful. When I did the 4gai upgrade in NPP I got a decent understanding of it. Feel free to fire any questions my way if you all have to play around with it any more.
Actually I should ask you... where do your monsters determine LOS to the player? Do they actively move to spaces where they can target the player without being targeted? Do they realize when they are going to be targetable by the player? It seems like you'd want to add reverse LOS information in update_view() or something.

I have been reading about FOV and am curious how to try to make asymmetric LOS play better. I still like symmetric LOS more, but that may be for reasons of implementation. It seems like with a FOV and reverse FOV calculated the monster AI could (in principle) play a lot smarter, and the symmetric/asymmetric distinction becomes less important.
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old July 6, 2010, 15:59   #8
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Quote:
Originally Posted by d_m View Post
Actually I should ask you... where do your monsters determine LOS to the player?
The monster movement in 4gai is quite different than the Angband movement code. Angband AI essentially has the monster attack (by either moving toward the player, or casting a spell), or running away if afraid.

With 4gai, each monster has a desired distance they want to be from the player. Spellcasters want to be further back. Group monsters prefer to stay in hiding until the player is out in the open or otherwise vulnerable to attack.

LOS only affects the monsters decision to move forward or attack.

Quote:
Originally Posted by d_m View Post
Do they actively move to spaces where they can target the player without being targeted?
No, it isn't quite that sophisticated. When a monster tries to hide or flee it selects a spot it thinks is safe, and each turn where the monster moves it calculates a path to that spot. If the monster is at the desired range from the player it is more likely to cast rather than advance.

The monsters don't remember what they did in previous rounds or have a recorded plan of attack. They re-evaluate every turn as the player moves or gets wounded and/or heals.
Quote:
Originally Posted by d_m View Post
Actually I should ask you... where do your monsters determine LOS to the player?
The monster movement in 4gai is quite different than the Angband movement code. Angband AI essentially has the monster attack (by either moving toward the player, or casting a spell), or running away if afraid.

With 4gai, each monster has a desired distance they want to be from the player. Spellcasters want to be further back. Group monsters prefer to stay in hiding until the player is out in the open or otherwise vulnerable to attack.

LOS only affects the monsters decision to move forward or attack.

Quote:
Originally Posted by d_m View Post
Do they actively move to spaces where they can target the player without being targeted?
No, it isn't quite that sophisticated. When a monster tries to hide or flee it selects a spot it thinks is safe, and each turn where the monster moves it calculates a path to that spot. If the monster is at the desired range from the player it is more likely to cast rather than advance.

The monsters don't remember what they did in previous rounds or have a recorded plan of attack. They re-evaluate every turn as the player moves or gets wounded and/or heals. It is tricky, because if the decision making is too complicated, the monsters tend to start wandering around in circles rather than fighting if they cnage their minds too often about what they want to do.

I did add some code for monsters to fight back against some of the standard Angband tactics, such as the pillar dance or the hack-n-back. Monsters who get hit and then find the player out of line of sight during thier attack will try to fire back ball spells near the player in hopes of causing splash damage. Monsters who don't have ball spells are much more likely to do something else indtead of direct combat with the player, like summon, heal, phase door away.

Quote:
Originally Posted by d_m View Post
Do they realize when they are going to be targetable by the player? It seems like you'd want to add reverse LOS information in update_view() or something.
Nice idea. I think it was left out of the original 4gai for speed and efficiency purposes. But the 4gai code was written about 10 years ago, and I don't think it would be a problem today.

I don't go to Angband IRC at the moment, because right now I am playing catchup and trying to get NPP current with the latest version of Angband. I will probably start going on there soon, once I get everything working in NPP again.
nppangband is offline   Reply With Quote
Old July 6, 2010, 20:04   #9
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Quote:
Originally Posted by d_m View Post

Do you ever stop by #angband-dev on IRC?
I meant to add, although I probably won't be on there much until I get NPP caught up, I am happy to go on there sometime & chat if there is something I can help out with.
nppangband is offline   Reply With Quote
Old July 6, 2010, 20:51   #10
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
Quote:
Originally Posted by d_m View Post
Yeah, that was me

I've had a more accurate distance algorithm for awhile, and I committed it this weekend. I noticed that bug and spent about 3-4 hours yesterday trying to fix it before deciding that:

1. I don't understand all the crazy details of update_view() et al.
2. I hate update_view() et al.

So I think I'm just going to roll this back to fix HEAD.
Instead of reworking update_view, it might be better to just change the distance function to round. So instead of returning above, return the closer of above and below to the distance. At the end when below+1 == above, compare dist^2 > below^2 + below. I think that will give the current behavior on ball effects.
PowerDiver is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Targeting change in HEAD d_m Vanilla 11 November 22, 2009 01:04
head of Vecna PowerDiver Idle chatter 3 September 7, 2009 19:46
improved GCU code in HEAD d_m Vanilla 23 August 19, 2009 20:59
targeting differences between 3.0.9b and HEAD d_m Vanilla 4 December 21, 2008 23:22
DaJAngband -I'm in over my head will_asher Idle chatter 15 February 27, 2008 10:04


All times are GMT +1. The time now is 15:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.