Reduce jumping of screen while healing/cure
Moderator: Forum Moderators
Reduce jumping of screen while healing/cure
Right now (in 1.6.4) when units get their healing/cure, screen goes often from one side of map to another several times.
I think current algorithm is just scanning through units and check could it be healed/cured. And it doesn't concern about their coordinates.
Is it possible to create some sort of list of this units and just sort it by coordinates before showing unit's cure/heal? This could reduce "jumping of screen".
Sorry if I'd make a mistake somewhere...
I think current algorithm is just scanning through units and check could it be healed/cured. And it doesn't concern about their coordinates.
Is it possible to create some sort of list of this units and just sort it by coordinates before showing unit's cure/heal? This could reduce "jumping of screen".
Sorry if I'd make a mistake somewhere...
- grzywacz
- Inactive Developer
- Posts: 303
- Joined: January 29th, 2005, 9:03 pm
- Location: Krakow, Poland
- Contact:
Re: Reduce jumping of screen while healing/cure
Indeed, that would be nice to have. Can you submit a feature request/bug report at bugs.wesnoth.org if a similar one doesn't exist already?
ORCS WIN!
User:Grzywacz Wiki Site
User:Grzywacz Wiki Site
Re: Reduce jumping of screen while healing/cure
Whoa! It's exist already!grzywacz wrote:Can you submit a feature request/bug report at bugs.wesnoth.org if a similar one doesn't exist already?
https://gna.org/bugs/index.php?9087
It's two years passed and it seems nobody interested in it. 8(
Re: Reduce jumping of screen while healing/cure
I quite like the idea. 

Re: Reduce jumping of screen while healing/cure
This problem has already been discussed in http://www.wesnoth.org/forum/viewtopic.php?f=12&t=15285 . Unfortunately the last post to this topic is over two years old.
Basically we have to deal with the so called "travelling salesman problem" wich is a very hard problem to solve if there are a lot of points to be visited. In Wesnoth there won't be really a lot of units to be healed each turn. So depending on processor speed a approximate solution should be doable (but tedious to implement). Interestingly humans are able to find relativly good solutions for this problem quickly.
Just as a thought, could we overlay the hex grid with a space-filling curve and follow it instead of the current ordering?
Basically we have to deal with the so called "travelling salesman problem" wich is a very hard problem to solve if there are a lot of points to be visited. In Wesnoth there won't be really a lot of units to be healed each turn. So depending on processor speed a approximate solution should be doable (but tedious to implement). Interestingly humans are able to find relativly good solutions for this problem quickly.
Just as a thought, could we overlay the hex grid with a space-filling curve and follow it instead of the current ordering?
Re: Reduce jumping of screen while healing/cure
I'm not talking about IDEAL "route" of showing units.
It's possible to create list of them and just sort their, say, Y coordinate. And after that sort elements with the same Y coordinate (this time sort their X coordinate). And that's all. I think this could reduce jumping of window...
In this case moving of point of view would be resemble "reading a book" -- line after line... And that's all...
It's possible to create list of them and just sort their, say, Y coordinate. And after that sort elements with the same Y coordinate (this time sort their X coordinate). And that's all. I think this could reduce jumping of window...
In this case moving of point of view would be resemble "reading a book" -- line after line... And that's all...
Re: Reduce jumping of screen while healing/cure
I don't know if Wesnoth is already doing this but your proposal is no real solution. Imagine a very large map. If there is a healable unit in the top left corner, one in the top right corner and another healable unit on the left just below the first one the screen would scroll to these unit in exactly this order. It would cross the entire map twice instead of just once.
Re: Reduce jumping of screen while healing/cure
Nevertheless, I think it will be more efficient than current algorithm.
Re: Reduce jumping of screen while healing/cure
not sure, but i thought that's how it's implemented now. depending on the way your units are located that still can lead to quite a lot of jumps...vvb wrote:It's possible to create list of them and just sort their, say, Y coordinate. And after that sort elements with the same Y coordinate (this time sort their X coordinate)
sounds a lot like a case for cluster analysis (e.g. something similar to this). but i've got no idea of the complexity of such an algorithm. implemented e.g. as a special iterator for unit maps/lists? there might be more places where this could be useful (e.g. for (future) ai ). how does the existing grouping work? maybe some sort of clustering is already in use somewhere?