Re: Forge 12/14 (unofficial BETA) version
Why is renaming necessary? The ones I uploaded were downloaded using Forge.
High Quality Resources for Collectible Card Games and Home of the CCGHQ Team
https://www.slightlymagic.net/forum/
https://www.slightlymagic.net/forum/viewtopic.php?f=26&t=1967
I do believe caching ONE picture is not the problem, so just remember the latest seen card picture - the main point here is not to store all pictures in memoryhow about checking at the end of each turn whether an image is currently shown on the screen, if not, kick it out of cache?
cache.put(name, resized);Ah yes, but in the current public release, pics.slightlymagic.com can't be used yet as a mirror (the next version will have it).Huggybaby wrote:Why is renaming necessary? The ones I uploaded were downloaded using Forge.
Thanks for your reply, it seems you know a lot more about this than I donantuko84 wrote:I do believe caching ONE picture is not the problem, so just remember the latest seen card picture - the main point here is not to store all pictures in memoryhow about checking at the end of each turn whether an image is currently shown on the screen, if not, kick it out of cache?
I've looked into the code: first, you need to update this line in ImageCache.java:In MagicWars I use more or less the same code (it will be strange if I don't as ImageCache came from MW
- Code: Select all
cache.put(name, resized);), but if cache.size() gets 30, I remove 10 images from it.
Take into account that reseting cache doesn't mean that all card images will be removed from battlefield, it is used just to reduce time for resizing every image in the game.
What can I say here, as this image is resized before putting into cache, it doesn't matter what quality (HQ or not) it was - so the issue didn't come from here.
Second suggestion is about how full image is displayed:
sorry, but it's really awful ;( let me show you the call stack:
MouseMotionAdapter->updateCardDetail->picturePanel.removeAll()+picturePanel.add(pic)->
getPicture(Card c)->new PicturePanel(file)->new ImageIcon(f.getPath())
so on every mouse move! you remove previous JPanel and create new one (even if it's the same picture). no need to say that it has low performance
at least you may
1. separate displaying image and card details (text)
2. cache what card has been seen last
3. may be cache limit amount of images not to read them from disk every time
and for sure no need to remove and create so many objects every time, you can change image directly on component (here is ImageIcon) and make picturePanel invisible if you leave its area
regards
What do you mean by "I do believe caching ONE picture is not the problem"?CardList visibleCards = new CardList();
PlayerZone hPlay = AllZone.Human_Play;
PlayerZone hand = AllZone.Human_Hand;
PlayerZone cPlay = AllZone.Computer_Play;
visibleCards.addAll(hPlay.getCards());
visibleCards.addAll(hand.getCards());
visibleCards.addAll(cPlay.getCards());
ArrayList<String> list = new ArrayList<String>();
Iterator<String> iter = ImageCache.cache.keySet().iterator();
while(iter.hasNext()) {
String cardName = iter.next();
if ( !(cardName.startsWith("Swamp") || cardName.startsWith("Mountain") || cardName.startsWith("Island")
|| cardName.startsWith("Plains") || cardName.startsWith("Forest")) &&
visibleCards.getImageName(cardName).size() == 0 ) {
list.add(cardName);
}
}
for (String s : list)
{
ImageCache.cache.remove(s);
System.out.println("Removing " + s + " from cache.");
}Check out this link:freestorageaccount wrote:About changing the heap allocation, I tried for a permanent fix by adjusting my Java control panel settings, but unfortunately there was no option for heap size! Must I override the default each time I run Forge?
intervention, which is impossible if state-based effects are run as often as they should be. (Relatively lengthy thought bubble containing sub-bubbles: On the other hand, you can cast Psionic Blast regardless of how many life points you have [or don't have], since its announcement isn't contingent upon your life, and as far as the game knows, any number of things could happen between that announcement and resolution, which would make forbidding playing it at certain times impractical [what if you're at two life but also have a Crystal Rod...?].)Wasn't it nantuko who originally provided the in-play mini card pic function?Sorry, but it would break the idea of caching.What I did as a test, is to loop through all of the image names that are currently in cache, and compare them with all of the cards that are currently in play or in the player's hand (which should be a good indication of whether they're visible on the screen). If they're not there, dump the missing ones from cache... and this could be done at the end of every turn (or heck, multiple times a turn). Is this a good idea, or is it not even worth it? At least it seems the relevant images are getting removed.
if (cache.size() == 30) {
// remove here first 10 leaving 20 pictures in cache
}
Counterspell should work just fine, just cast it whenever a spell is on the stack and the spell should be countered.Resonantg wrote:Counterspell also doesn't seem to be working, unless I'm just using it wrong.