remaining tasks for beta3

Thus spake “Brent Easton”:

So you know, I’m working on this now, but it might take me a few days
to encapsulate everything into a working ImageOp. (Actually, several
ImageOps, it looks like.)


J.


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

Post generated using Mail2Forum (mail2forum.com)

Brent, are the images created by GamePieceImages saved in the module or
are they recreated each time the module is loaded?

They are saved in the module. The idea is they are only re-created of one if the definition changes.

The original idea was that the images where to be created on the fly on each individual users machine, however, this turned out to be impracticable due to font issues.

B.


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

Post generated using Mail2Forum (mail2forum.com)

They’re saved as PNGs in the module file.

rk

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

I’m finding this problem to be terribly vexing. The images created by
GamePieceImage are, like other images, keyed by name only. Uncaching or
replacing images in the cache is something we should avoid, for at least
three reasons: In order to proprely uncache an image, you can’t just uncache
that image, you also need to uncache every image which depends on that
image, which means that you have to track all of those dependencies. Second,
I haven’t implemented request cancellation yet becuase it’s rather complex;
having images which can change out from under you during a request is going
to make that even more complicated.

I guess we have a similar problem when the user replaces one image with
an image having the same name, so this isn’t limited to GamePieceImages.
If the map from image names to images isn’t a function (in the mathematical
sense), then we can’t key on it—a key to a memoizer has to procude the
same value every time. We have to add whatever hidden paramters are needed
to make the map from image names to images a function, but I’m not seeing
what those are at the moment.


J.


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

Post generated using Mail2Forum (mail2forum.com)

It’s a problem, and I’m seeing an easy solution. I favor the un-caching approach myself.

rk

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Rodney Kinney”:

Perhaps I’m not describing properly just how difficult that will be.
In order to remove a key-value pair from the cache and have everything
respond properly, you need to be able to do the following:

  1. Remove that kek-value pair.
  2. Recursively find every other key-value pair which depends on that
    key-value pair, and remove those.
  3. Interrupt any running thread doing a calculation which recursively
    depends on any key-value pair which you’ve just removed, and restart it.
  4. Callback to everything which is using the uncached values to tell them
    they need to update themselves.

Sure, 1 is easy. The mechanism for doing 2 isn’t there at all right now,
and will result in tons of keys never being garbage collected because
there’s some other key they depended on which is still in the cache.
Doing 3 is going to be a huge pain. Doing 4 is going to involve writing
a lot of new code.

Building an image is not the result of a random process, it’s a function
of some variables, and we should be able to encapsulate those into a
cache key without having to do all of this.


J.


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

Post generated using Mail2Forum (mail2forum.com)

GamePieceImages do have a key - There is a definition that is saved in the buildfile that uniquely creates/identifies an image for a given layout. I have to go out now, but will look it up when I get back.

Brent.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

On reflection, I don’t think that will work either—anything which
looks up an image created by a GamePieceImage will still look it up
by name. It won’t know that the image was created by a GamePieceImage,
so it won’t have that information for making a key.


J.


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

Post generated using Mail2Forum (mail2forum.com)

On Aug 15, 2008, at 3:38 PM, Joel Uckelman wrote:

Well, 1 and 2 can be finessed by just blowing the cache away
completely. Instead of dependency tracking, just clear the entire
cache and refill it. It will take longer than a more directed
approach, but unless this happens often, it may be worth the simplicity.

It may also make solving 3 & 4 a little easier, too. You again just
have everything abort and restart. It will still involve some non-
trivial effort, though.


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

Post generated using Mail2Forum (mail2forum.com)

It gets harder the closer to perfection you try to get, I guess

Easy. Scaled maps and rotated pieces would be the biggest remaining bugs.

A pain, admittedly, but at least the Scale/Rotate ImageOp classes have references to the ImageOp instances they depend on. After fixing this, the remaining bugs would be pretty rare, not worth the effort of implementing 3 and 4 to solve them.

The alternative of changing the semantics of how to identify an image by adding more information to the key is no better than the cache-clearing solution. You still have to communicate to all users of an image that they need to stop using the old key and start using the new key.

This problem can only happen when editing a module. If we can come up with a solution that, say, nukes the image cache when you close a game while editing, that would pretty much solve the problem for practical purposes.

rk

Post generated using Mail2Forum (mail2forum.com)

Yes, that’s right. For GamePieceImages, we can easily bypass the caching for the image visualiser. The GamePieceImage code automatically recreates the image anyway whenever any of the parameters change. It would only be an issue for existing GamePieces in a game open concurrently with an editing session. Clearing the image cache on game close would fix that.\

B.


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)

Thus spake Thomas Russ:

That’s shockingly inefficient. In a game with large maps, that might
make working with GamePieceImages unusable.

If I’m going to go through the effort of changing the way caching works,
I’m not going to do it in away that I expect to be inadequate pretty much
right away.


J.


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

Post generated using Mail2Forum (mail2forum.com)