zoom and rotate

Another potentially hairy problem.

VASSAL seems to grind to a halt when rotating counters. An incredible amount of cycles is spent in GeneralFilter.zoom(WriteableRaster,Rectangle,BufferedImage,Filter). I checked the arguments, and after a single piece rotation, it appears to attempt to operate on the entire board instead of a single piece. srcI is the entire map board. When we get down to apply_horizontal, src_data ends up pointing again to the entire board and we’re then stuck in a loop over every pixel. Needless to say, zoom spends a lot of time in apply_horizontal and apply_vertical.

Am I barking up the wrong tree here or is this serious? If I’ve got a couple of counters rotated, everything grinds to a screeching halt.

  • M.

Thus spake “mkiefte”:

I’m betting these are tokens which have movement trails, and the movement
trails are applied before the rotation.

There is a general problem with any trait that greatly enlarges the
bounding box of a piece prior to rotation. The only solution I see to
this problem is to handle bounding boxes differently.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I thought of that too, but these units have not moved before being
rotated. Also, it’s the entire mapboard that’s being processed, not
just a subset. The first thing I do when opening the module is rotate
one piece, then a second, then a third, and we have to stop.

I think there’s something else going on, but I don’t know what. Is
anyone else seeing this or is it just me?

  • M.

Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Which module?

J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

That’s an interesting question. It’s imported. Any recommendations
for a downloadable module with rotation?

  • M.

Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thanks Jeff, I might take a look at that.

It turns out that it is because of the movement trail, but for some
reason, it assumes that the movement trail is the size of the board,
even if the unit has never moved… If you get rid of it, then
VASSAL becomes quite a bit peppier.

I’ll take a closer look at this. In the meantime, do have any suggestions Joel?

  • M.

On 29/02/2008, Jeffrey Brent McBeth mcbeth@broggs.org wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Hi Michael,

*********** REPLY SEPARATOR ***********

On 29/02/2008 at 3:38 PM Michael Kiefte wrote:

Looking at the code, I find this hard to believe. Do you have an example module for me to test that actually exhibits this? I wrote the original Movement trail code and after a quick review, I just can’t see how this can happen. Does the Car Wars module actually have this problem? As far as I know it is in regular use and I haven’t heard any complaints?

If the Rotation trait has been specified below the Movement Trail, then this is a bug in the module. Do you really want the Footprint to rotate and be displayed sideways when the piece is rotated? Unlikely, so Movement Trails should normally be defined below rotations.

Cheers,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Hi Jeff,

Yes, but I need to see a broken module to diagnose the problem, not one that is working :slight_smile: It is my belief that there is no problem at all when the Movement Trail is defined below the rotation trait and Car Wars is the proof of that.

Cheers,
Brent.


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@uws.edu.au


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

It turns out that the Movement Trail was before the Rotation property.
I had forgotten about that and it’s only just come up for me.

I’m just writing up the patch now. Thanks for the tip.

  • M.

On 29/02/2008, Brent Easton b.easton@exemail.com.au wrote:


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Hi Jeffrey,

Thanks for the suggestion, but I solved the problem and it was simply that the Rotate property followed the Trail. I remember this discussion vaguely in the past, but I wasn’t writing an ADC2 importer at the time and I guess I had never tried to rotate so many counters at the same time before… Makes you wonder how many other bugs are lurking. However, I’m trying to play a few
games using imported modules just to make sure and I figure since Rodney, Brent, and Joel are still bogged down, I can squeeze in a couple more patches on the importer over the weekend if need be.

  • M.

On 29/02/2008, Jeffrey Brent McBeth <mcbeth@broggs.org (mcbeth@broggs.org)> wrote:

Post generated using Mail2Forum (mail2forum.com)

Different problem now: here’s a save map from VASSAL:
http://myweb.dal.ca/mkiefte/BitterWoodsMainMap.png

When taking a shot of the map, it’s not getting all of the blocks updated in time. If you don’t manually visit, and therefore update the map at every location, the capture leaves big holes. This one was taken after a zoom out. When all this got updated, did the capture tool have a command left out?

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

That’s an oversight. The snapshot tool should force the loading of
the remaining tiles.

J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake Joel Uckelman:

This is a very difficult problem to solve with the existing ImageSaver
code, as there’s no way to ensure that all of the map tiles will remain
loaded while you’re drawing the map.

I’m still working on this…

(BTW, you managed to center the map on someplace I’ve been—last October
I was in Han-sur-Lesse, which would be in the two hexes containing the
bridge over the Lesse on the road between Rochefort and Wellin.)


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Your graphics code is nicely done, though.

I can see how it could be a problem. That particular map is very large – that is only 57% zoom. At 100% it took too long. There’s another problem of how practical it is to convert large maps to PNGs.

Any Panthers or Jagdtigers?

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

I found a solution just now, but can’t commit it—something seems
to have gone wokny at SF.

There’s not much we can do about the practicality aspect.

No. Sadly, I had time to see almost nothing while I was there. There’s
quite an impressive set of medieval fortifications at Namur which you
can see from the train, though. :slight_smile:


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake Joel Uckelman:

Fixed now, in trunk@3230 (or so I think).

nomic.net/~uckelman/tmp/vassal/


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Hi Joel,

This is a big improvement. However, for really large maps, VASSAL hangs. Is it at all possible that blocks are still being GCed for any reason? I haven’t run the profiler on it, but what do think might be happening for very large maps?

  • M.

On 07/03/2008, Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net)> wrote:


Michael Kiefte, Ph.D.
Associate Professor
School of Human Communication Disorders
Dalhousie University
Halifax, Nova Scotia, Canada
tel: +1 902 494 5150
fax: +1 902 494 5151

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

How large is “very large”? If the map is so large that after allocating
a new BufferedImage for it there is only enough room in memory left
for a few tiles at a time, then you could end up with a lot of cache
clearing and reloading.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

It’s 4495x3141. Just hangs, but no Exceptions.

I’ll take a look at it with the profiler. However, based on what you’re telling me, there may be no solution.

  • M.

On 11/03/2008, Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net)> wrote:

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Any progress on this?


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)