It is currently 16 Apr 2024, 21:45
   
Text Size

Implementing NEW stuff to Magarena

Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins

Re: Implementing NEW stuff to Magarena

Postby elias » 03 Aug 2013, 16:24

melvin wrote:Thanks for starting this discussion on improving the battlefield UI to display the current phase as well as to show the past actions. Both are issues I've heard from players.

@elias: great looking mockups! I like the idea of displaying the phase along the side of the battlefield, we can use that to replace up/down arrow and the square box around the player avatar.

Having a slide out log is less jarring that the overlay window that pops out when you hover the log icon and it is easier to get to the right edge of the screen when the mouse is over the battlefield. One problem may be discoverability of this feature for new players, the other is that this feature is beyond my mediocre UI programming skills.

I'd like to propose another idea about how we could show the last few actions permanently on the screen. The idea is to use the empty space above the top of the stack. That is to display the last few items in the log from the top left to the top of the stack, most recent at the bottom. That way, when an effect goes off the top of the stack, it goes on the bottom of the log, which is just above the top of the stack. This allows us to better utilize the empty space on the left as the stack is normally quite small. If the stack grows, it will just temporarily shrink the size of the log.

What are your thoughts on this idea?
As for the log on the edge of the right side of the screen, to simplify it, it could mimic the current log icon function. Think of it as there being a 1x5000 transparent .png on the very right edge of the battlefield (it would stretch down the whole battlefield and player hand field, I doubt anyone has a resolution higher than x5000). When the mouse pointer is hovered above this invisible image the log is shown. So this would work in a very similar way as the current log icon function. Then the log window could be something like 30% transparent.

As for new players, there could still be an image on the edge of the right side see attached image, (but you still need to go to the very edge to show the messages). I guess there would need to be some kind of message somewhere to explain this feature. Maybe in the menu, under View you could choose Show Messages to also show them.

As for the idea of having messages over the stack, this could work, maybe the last two or three messages could be shown here. I guess the downsides are that it will clog up the game field a bit, and the size of this area are dependent on your screen resolution, this area will also shrink when playing Magarena in a window.
Attachments
mesprev.jpg
User avatar
elias
 
Posts: 33
Joined: 21 Jul 2013, 20:19
Location: Sweden
Has thanked: 2 times
Been thanked: 13 times

Re: Implementing NEW stuff to Magarena

Postby elias » 04 Aug 2013, 18:59

melvin wrote:Thanks for the suggestions! I think using sound is a nice way to help the player keep track of what is happening. Tracking this as https://code.google.com/p/magarena/issues/detail?id=375

In-game music, tracked as https://code.google.com/p/magarena/issues/detail?id=376

flash red when losing life, tracked as https://code.google.com/p/magarena/issues/detail?id=377

It is easier for us to manage requests on our issue tracker page as compared to the forum as it is easy to miss a new forum post in a long thread. New issues will automatically generate an email to the public dev mailing list, do consider posting directly to https://code.google.com/p/magarena/issues/list
I tried to do some kind of improved sound pack, having some kind of divine feeling to it. You can find the sounds in the attached .zip. The sounds comes from freesounds.org and I have modified them in Audacity to better fit MagArena.

But the current system does not work, the resolve and turn is very repetitive to hear (therefore I made these sounds silent). Instead there should be a different sound for each spell cast, ex a creature, enchantment, artifect, land etc. To add some variety to the sounds.

I also think it should be possible to adjust the volume of the sounds in the preferences. And it would be very awesome if looping music could be added to the title screen, prepare for duel screen and during a duel.
Attachments
angel sounds pack.zip
(1.95 MiB) Downloaded 380 times
User avatar
elias
 
Posts: 33
Joined: 21 Jul 2013, 20:19
Location: Sweden
Has thanked: 2 times
Been thanked: 13 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 19 Jan 2014, 01:55

I've encountered a slight structure problem with MagicWhenOtherComesIntoPlayTrigger.java

Taking the basic bones of Evolve, I was working on Graft

Code: Select all
public static final MagicWhenOtherComesIntoPlayTrigger Graft = new MagicWhenOtherComesIntoPlayTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent otherPermanent) {
            return (otherPermanent.isCreature() &&
                  otherPermanent != permanent &&
                  permanent.getCounters(MagicCounterType.PlusOne)>0) ?
                new MagicEvent(
                    permanent,
                    otherPermanent,
                    new MagicMayChoice(
                       "Move a +1/+1 counter?"),
                    this,
                    "PN may$ move a +1/+1 counter from SN onto RN."
                    ):
                MagicEvent.NONE;
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
           if (event.isYes()) {
              game.doAction(new MagicChangeCountersAction(
                 event.getPermanent(),
                 MagicCounterType.PlusOne,
                 1,
                 false
              ));
              game.doAction(new MagicChangeCountersAction(
                 event.getRefPermanent(),
                 MagicCounterType.PlusOne,
                 1,
                 true
              ));
           }
        }
    };
The event doesn't like the structure of having: permanent, otherPermanent and a MagicChoice

I confirmed this with trying to edit Archon of Redemption to allow for the 'may gain life' as it currently doesn't give the choice (and I can kinda see why now):
Code: Select all
new MagicWhenOtherComesIntoPlayTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent otherPermanent) {
            return (otherPermanent!=permanent &&
                    otherPermanent.isCreature() &&
                    otherPermanent.hasAbility(MagicAbility.Flying) &&
                    otherPermanent.isFriend(permanent)) ?
                new MagicEvent(
                    permanent,
                    otherPermanent,
                    new MagicMayChoice(),
                    this,
                    "PN may\$ gain life equal to the power of RN."
                ):
                MagicEvent.NONE;
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isYes()){
                final MagicPermanent permanent=event.getRefPermanent();
                game.doAction(new MagicChangeLifeAction(event.getPlayer(),permanent.getPower()));
            }
        }
    }
I've searched further to edit it myself, but looking at the different MagicEvent formats in MagicEvent.java, I couldn't see any referring to permanents anyway, only MagicPlayer - so gave up. Is it possible to allow this structure? Or is there a better way of getting the same result?
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 19 Jan 2014, 08:10

ShawnieBoy wrote:The event doesn't like the structure of having: permanent, otherPermanent and a MagicChoice
The otherPermanent should be after the MagicChoice. i.e.

Code: Select all
new MagicEvent(
    permanent,
    new MagicMayChoice(),
    otherPermanent,
    this,
    PN may\$ gain life equal to the power of RN."
)
A card that uses such a structure is https://code.google.com/p/magarena/sour ... nce.groovy
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 22 Jan 2014, 18:41

Thanks for that! And adding Remembrance wasn't that long ago, doh!

I have another question though: In MagicCounterType, is the 'text' string only used for the no-images option for displaying cards? The only reference I could find was in Magic.ui.Viewer.PermanentViewerInfo.

I only ask as I'm wanting to add all the other counter-types, and the thought of coming up with 100+ unique abbreviations for them all is kinda putting me off :)
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 23 Jan 2014, 03:45

ShawnieBoy wrote:I have another question though: In MagicCounterType, is the 'text' string only used for the no-images option for displaying cards? The only reference I could find was in Magic.ui.Viewer.PermanentViewerInfo.

I only ask as I'm wanting to add all the other counter-types, and the thought of coming up with 100+ unique abbreviations for them all is kinda putting me off :)
My own investigation reached the same conclusion, the counter's text is only showed in text view of permanents.

Do note that in src/magic/ai/ArtificialScoringSystem.java, the number of charge counters on a permanent is used in computing getVariablePermanentScore. If other types similar counters are added, it will have to be accounted for as well in the scoring. Also src/magic/ui/viewer/ImageDrawingUtils.java's drawCountersInfo renders each type of counter.

If the counter is functionally similar to Charge counters, eg Spore counter, Study counter, Level counter, I think using a single counter type is simpler.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 23 Jan 2014, 14:25

Thanks for that - The only problem is when you get counters moving around, or being placed on different permanents. Even though they function the same, they kinda need to be named different.

e.g. Sporoloth Ancient allows a Mirrodin's Core enchanted with Wind Zendikon to produce Saproling tokens (tap to add charge counters, remove them as spore counters). The same can be done with any creature with level counters on it, Coralhelm Commander is the cheapest :)

Grimoire of the Dead allows Coretapper to put Study tokens on it.

Ion Storm can remove all types of counters (except -1/-1, feather, and gold - the only others defined) to deal damage.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 24 Jan 2014, 02:23

Agree, some cases will not work, so far this simplification of counters hasn't been an issue yet from the lack of comments/feedback on this discrepancy. Our principle has always been reducing complexity of the game to enable the AI to play at a stronger level.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 26 Jan 2014, 16:40

I'll continue with this as a side project, on a repository on my HD. Won't be pushing anything :)

The ArtificialScoringSystem could even be improved by grouping counters into pos and neg groups, counting only beneficial counters (charge, spore etc.) or even make a distinction between counters that count up, and those that count down.

But yes, it will only pop up in particular niche cases - will make sure to not contribute cards that will complicate matters (apologies for Sporoloth Ancient, maybe he should be in semi-retirement?)
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 27 Jan 2014, 00:19

Actually going smoother than I thought, I have a separate clone at https://code.google.com/r/shawnieboyuk- ... ter-types/ if anyone fancies a look, just need to do removing counters as a cost which I knew would be a headscratcher.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 27 Jan 2014, 01:59

When I think about this more carefully, a big benefit of using different counters (not just a single charge counter type) is the reduction in interactions between cards, which is good for the AI.

I'm pro merging this change if the scoring system and counter rendering can be improved as well.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 27 Jan 2014, 05:28

Thanks for the positive feedback :) - Those two suggestions are now the only things left to do.

May also change the 'Sacrifice a <type/subtype>' to a similar format I used for 'Remove <amount> <counterType> counters from SN' while I'm there, so all possible options will already be available.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 28 Jan 2014, 19:03

If you're willing to cast your eye over these additions/modifications to the score system, they feel right, but it's tricky to see changes in action while playtesting:

All in ArtificialScoringSystem - and to make more sense, each CounterType has a score value which can be retrieved with .getScore(), their current values are either -1,0 or 1

Code: Select all
    public static int getVariablePermanentScore(final MagicPermanent permanent) {
        int score = getAllCountersScore(permanent)*30;
        if (!permanent.canTap()) {
            score+=getTappedScore(permanent);
        }
        if (permanent.isCreature()) {
            // used to consider pt and abilities without EOT effects, now includes EOT effects
            final MagicPowerToughness pt=permanent.getPowerToughness();
            final Set<MagicAbility> abilityFlags=permanent.getAbilityFlags();
            score+=pt.power()*300+pt.getPositiveToughness()*200+MagicAbility.getScore(abilityFlags)*(pt.getPositivePower()+1)/2;
            score+=permanent.getEquipmentPermanents().size()*50+permanent.getAuraPermanents().size()*100;
        }
        return score;
    }
Code: Select all
    public static int getAllCountersScore(final MagicPermanent permanent) {
       int amount = 0;
       for (final MagicCounterType counterType : MagicCounterType.values()) {
          if (permanent.hasCounters() && permanent.getCounters(counterType)>0) {
             amount+=permanent.getCounters(counterType)*counterType.getScore();
          }
       }
       return amount;
    }
I can post the ConterType list to show their values if you want, it's a bit spammy though :)
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 29 Jan 2014, 01:55

Nice, now the positive and negative counters can cancel out each other.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Implementing NEW stuff to Magarena

Postby ShawnieBoy » 12 Feb 2014, 00:23

Ok, I can't get this to work properly - I've submitted it but then realised that the calculation int isn't final, scores are going all over the place. Any ideas how to fix this? :(

Code: Select all
package magic.model.target;

import magic.model.MagicCounterType;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;

public class MagicCountersTargetPicker extends MagicTargetPicker<MagicPermanent> {

    private static final MagicCountersTargetPicker INSTANCE = new MagicCountersTargetPicker();

    private MagicCountersTargetPicker() {}

    @Override
    protected int getTargetScore(final MagicGame game,final MagicPlayer player,final MagicPermanent permanent) {
        int calculation = 0;
        for (final MagicCounterType counterType : MagicCounterType.values()) {
            calculation += (permanent.getCounters(counterType)*counterType.getScore());
        }
       
        final int score=calculation;
        return permanent.getController()==player?-score:score;
    }

    public static MagicCountersTargetPicker create() {
        return INSTANCE;
    }
}
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

PreviousNext

Return to Magarena

Who is online

Users browsing this forum: No registered users and 34 guests


Who is online

In total there are 34 users online :: 0 registered, 0 hidden and 34 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 34 guests

Login Form