zbizu
Legendary OT User
Hello.
If you regularly browse issues and pull requests of master branch you probably know about problems with
I believe that all three problems can be fixed by reimplementing the
I also believe that area spells could be slightly easier to process if we skip already checked tiles (will discuss that later in this post).
Summary of current problems:
1.
2. There is some problem with area spells (they can't be cast in some scenarios)
- although I'm not entirely sure what is causing it, one of possible reasons for that might be weird behaviour of
A quick rundown on the progress in developing the solution:
Now that the code is close to being finished, I've noticed the area spells performance could be improved in the future as well (image version here):
If you regularly browse issues and pull requests of master branch you probably know about problems with
isSightClear
function (responsible for throwing items and attacks, ranged monster behaviour, and obstacle detection in area spells). Because all three problems are related to each other and there are already lots of PRs and issues referenced, I decided to post here instead of opening yet another one in github repo or causing unnecessary noise in existing PRs/issues.I believe that all three problems can be fixed by reimplementing the
isSightClear
function.I also believe that area spells could be slightly easier to process if we skip already checked tiles (will discuss that later in this post).
Summary of current problems:
1.
isSightClear
is far from rl (this is huge issue when a pvp fight happens in a narrow diagonal cave)- this causes throwing items and distance attacks different (also applies to area spells although the difference isn't big here)
- this also causes weird positioning of ranged monsters during combat
2. There is some problem with area spells (they can't be cast in some scenarios)
- although I'm not entirely sure what is causing it, one of possible reasons for that might be weird behaviour of
isSightClear
when the points A
and B
are next to each other (eg. 1000,1000
and 1000,1001
). Places to look at: combat.cpp
, methods: Combat::doCombat
(the one with caster, position params) and AreaCombat::getList
A quick rundown on the progress in developing the solution:
- A potential solution for accurate lines of sight in a single floor: using xiaolin wu's algorithm
- Early implementation with the consideration of throwing items between floors: link to pr
- Code improvements and further research in Gigastar's PR, more suitable for tfs standards plus some corrections: link to pr
- Continued research, small fixes and slightly more specific functions in MillhioreBT's PR: link to pr (sorry for abandoning the early code, I lacked time to work on it. I'm glad you all continue working on it though)
Now that the code is close to being finished, I've noticed the area spells performance could be improved in the future as well (image version here):
- current area spells call
isSightClear
to every tile (notice the loop above this line) - a new function, something like
getSightLine
could be written to obtain the path between two points - an empty matrix could be used to draw obstacles and their shadows (between caster and most remote points) on it
- a matrix with spell area could be used to compare it with the shadows to figure out available tiles
- not really sure of it, but I have a feeling that this could even use gpu acceleration for vector operations assuming someone is turbobrain enough to code it