Reduce jumping of screen while healing/cure

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
vvb
Posts: 33
Joined: July 1st, 2007, 6:28 pm
Location: Russia, Nijniy Novgorod
Contact:

Reduce jumping of screen while healing/cure

Post by vvb »

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...
User avatar
grzywacz
Inactive Developer
Posts: 303
Joined: January 29th, 2005, 9:03 pm
Location: Krakow, Poland
Contact:

Re: Reduce jumping of screen while healing/cure

Post by grzywacz »

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?
vvb
Posts: 33
Joined: July 1st, 2007, 6:28 pm
Location: Russia, Nijniy Novgorod
Contact:

Re: Reduce jumping of screen while healing/cure

Post by vvb »

grzywacz wrote:Can you submit a feature request/bug report at bugs.wesnoth.org if a similar one doesn't exist already?
Whoa! It's exist already!
https://gna.org/bugs/index.php?9087
It's two years passed and it seems nobody interested in it. 8(
Gaiyamato
Posts: 30
Joined: August 13th, 2009, 10:26 am

Re: Reduce jumping of screen while healing/cure

Post by Gaiyamato »

I quite like the idea. :)
User avatar
defunct
Posts: 19
Joined: March 17th, 2007, 5:11 pm

Re: Reduce jumping of screen while healing/cure

Post by defunct »

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?
vvb
Posts: 33
Joined: July 1st, 2007, 6:28 pm
Location: Russia, Nijniy Novgorod
Contact:

Re: Reduce jumping of screen while healing/cure

Post by vvb »

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...
User avatar
defunct
Posts: 19
Joined: March 17th, 2007, 5:11 pm

Re: Reduce jumping of screen while healing/cure

Post by defunct »

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.
vvb
Posts: 33
Joined: July 1st, 2007, 6:28 pm
Location: Russia, Nijniy Novgorod
Contact:

Re: Reduce jumping of screen while healing/cure

Post by vvb »

Nevertheless, I think it will be more efficient than current algorithm.
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Reduce jumping of screen while healing/cure

Post by Max »

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)
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...

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?
Post Reply