Page 3 of 3

Re: JPortal current status

PostPosted: 25 Jan 2012, 16:51
by Malban
Hiho,

I am a bit frustrated. Things keep coming up - like getting a new Laptop (Win 7 on which I am currently mainly developing).
Also bugs/errors and things I missed entirely. I am programming (on and off) for about 1 1/2 year on the next version and I am still not nearly content on releasing it.
Worst thing is - for an outstander it appears to not have changed all that much...

Different things that came up...

I am changing the computer AI for battles. The whole thing with "trying out" all possibly permutations was really bothering me. It might produce good results - but - hell it surely sometimes takes its time.

For testing purposes I have quite large decks and computer players have 100 HP. So huge battle sometimes occur - like 10 attackers and quite as many defenders.
Doing something like that with all possible combination - well - doesn´t really work.

It used to be the way, that the blocking was the "bad one" and the attack calculation the "good one" now (for me) it is the other way arround.
Reason:
Blocking
--------
is a "closed" action. With that I mean, when I block I don´t really have to consider anything that comes after that block round.
I have a nice single input (the attackers) and a nice single output (blockers). Next round the cards a dealt anew I don´t really have to consider what comes next.

Attacking
---------
Is an "open" action. With that I mean I must consider my opponents next turn. If I attack, which cards are
after the attack tapped - and cannot be "used" in any other way? What do I have to keep untapped in order that I may block the opponents attack... etc
There is much more to consider!

Algorithm
---------
For blocking I use following quite simple - but I think very efficient algorythm:
(Scoring must be implemented. I need a score for a permanent on the battlefield - and a scoring for damage a player may take. Both scores must be compareable. For simplicites sake lets assume following scoring:
- a creature has a score of its "toughness + power", player health reduction has score of 2*damage (the scoring in reality should be adapatable in relation how low the health is)

The scoring goes as this, score of one single fight (1 attacker, x blockers, 1 attacked player):
- if attacker is dead: score = score + attackerScore
else: score = score - attackerScore
for each blocker:
- if blocker is dead: score = score - blockerScore
else: score = score + blockerScore
- if player health is reduced: score = score - damageScore

The algorithm than goes:

a) as long as there are attackers and blockers, get (from blockers view) the best scored
attack<-block combination, remove the attacker and blockers, and goto a)

result is the block formation
-> well that was trivial

how to determine the best scored current attack<-blocking:
Built following scorings and compare them:
a) takeDamageScore (determine the fight score if not blocked)
b) noDeadKillers (determine the best score of a blocker, that kills the attacker and does itself not get killed, score of a blocker is determined as above)
c) leastDeadKillers (determines the best score, that can kill the attacker, blockers might get killed to)
d) noDeadBlock (determine the best score of a blocker that can block the attack wihtout getting killed)
e) cheapestDeadBlocker (determine a blocker that gets killed, but the player does not receive damage)

not all scores are allways available. If a score is not available score = -10000 (or something like that)

The best score of above WINS and is taken as the best block for that attacker.

Example:

Attacker
(Overall Attack Score = 20)
Creature 5/5 score = 10
Creature 4/1 score = 5
Creature 4/1 score = 5

Blocker
(Overall Block-Score = 10)
Creature 1/1 score = 2
Creature 1/1 score = 2
Creature 2/2 score = 4
Creature 1/1 score = 2

1) get best scored block of above:
Attacker = 4/1 is dead -> score += 5
Blocker = 1/1 is dead -> score -=2
Player damage 0 -> score += 0
FightScore = 3

Remove attacker/blocker
Attacker
Creature 5/5 score = 10
Creature 4/1 score = 5

Blocker
Creature 1/1 score = 2
Creature 2/2 score = 4
Creature 1/1 score = 2

2) get best scored block of above:
Attacker = 4/1 is dead -> score += 5
Blocker = 1/1 is dead -> score -=2
Player damage 0 -> score += 0
FightScore = 3

Remove attacker/blocker
Attacker
Creature 5/5 score = 10

Blocker
Creature 2/2 score = 4
Creature 1/1 score = 2

3) get best scored block of above:
Attacker = 5/5 is alive -> score -= 10
Blocker = 1/1 is dead -> score -=2
Player damage 0 -> score += 0
FightScore = -12

Remove attacker/blocker
Attacker

Blocker
Creature 2/2 score = 4

Done

In that scoring scheme killing the 5/5 would result in a scoring:

Creature 5/5 score = 10
Creature 4/1 score = 5
Creature 4/1 score = 5

Blocker
Creature 1/1 score = 2
Creature 1/1 score = 2
Creature 2/2 score = 4
Creature 1/1 score = 2

1) get best scored block of above:
Attacker = 5/5 is dead -> score += 10
Blocker = 1/1 is dead -> score -=2
Blocker = 1/1 is dead -> score -=2
Blocker = 1/1 is dead -> score -=2
Blocker = 2/2 is dead -> score -=4
Player damage 0 -> score += 0
FightScore = 0

ATTACKING
---------
This describes the current new implemented attack algorithm of the AI (done today), the reattack algorithm will differ! (and is not done yet)

I differentiate between 3 types of attackers:
a) varAttackers
these are attackers, that upon attacking may e.g. target an enemy
-> these attackers are either attacking "first" or not at all
-> withing the varAttackers, all permutations (also positions related) are played!
-> many variations

b) undangeredAttackers
These attackers are either unblockable, or have so much toughness that they
will not be killed.
These are either played out - or not, all unordered permutations (no order difference is made)
are built (this is only interesting, if opponent can reattack)!

c) all other attackers
These will be extrem "tested", meaning
extreme variations will be built and scored
(Not implemented: ), as long
as scoring is not descending in one way, the extremes will be built
further scoring is done, by locally simulating the match, till next opponents attack/ own block phase (combat resolved)

a) + b) are straight forward.

c) extremes are implemented as:
1) + 2) Order attacker by toughness, build variantions of descending and ascending orders.
3) + 4) Order attacker by power, build variantions of descending and ascending orders.
None
All
-> no doubles

That scheme still produces many variants - but nonetheless is a great reduction to older implementations.
If both attack/ and block algorithms work out -> I will keep them as this.


Regards

Malban

Re: JPortal current status

PostPosted: 06 Feb 2012, 13:04
by Malban
Hello all,

another short status. The frustration has passed :-)!

For the 1.3 release the EAI for now has a feature freeze. What comes after that - who knows. I implemented another caching and a flexible depth adjustment, both together should take care of all remaining memory issues and not influence the cleverness too much.

What is left todo is cleaning and checking.
- I will double check all implementation of cards in virtual match.
- I will adjust scoring again, to be a bit more clever
- UI cleanup
- remove unused code / unused switches
...

than upload V1.3 and keep quiet for a while :-).


Right now I am checking new EAI against old ones (for now only portal cards used in checking, ´cause I know all of them are implemented in virtual game 100%)

Malban vs Moses wins 66% of all matches (same deck, 100 testgames), which I think is a good result

Malban vs diverse opponents booster drawing - wins most of the time...

- No OOM issues
- No timing issues

While implementing the last stuff (1-2 weeks) I thanked myself for the most brilliant (*cough*) idea to implement automatic testruns. These were so helpfull, and doing regressiontest out of the box helped me so much to find issues.

I recommend to all other developers: "do automatic testruns"

Malban

Re: JPortal current status

PostPosted: 07 Feb 2012, 18:50
by jmartus
The question is can you beat your own creation? :)

Re: JPortal current status

PostPosted: 09 Mar 2012, 13:49
by Malban
Hi!
Oh well, it has already been another month.

People who read this will probably be sick by now by the statement "soon", sounds much like vaporware.

At work I have at the moment a separate programming project going on. Concentration on two different projects - I find kind of hard. Therefor JPortal again is a bit slower going.

But I DID some work :-), check the ChangleLog (http://jportalgame.de/3.html).
Virtual Match supports the complete implemented sets - this is verified (which was quite a lot of work).
Many, many small bugs were removed.

Main Testing of AI is again automatic:
- select booster match
- select 8 players
- select a "set" to test
- select win 10 games
- select draw from ten boosters

and about 200 games will be played by the AI against each other with randomized decks. Two hours later I get back to my computer and see if it has "paused" - if it has - I debug, fix and start a new session.
(there were already quite a lot of sessions without any bug)

After a couple of more testing I will release the beta :-).
It will NOT be polished.
- no new quests
- achievments will be "rough"
- etc

But I will get this "vapor"-feeling off my back - and will concentrate on
polishing rather than bugfixing.

regards

Malban

PS.
I do both - winning and losing. Like in real life it heavily depends on the deck.

PPS.
So you get the "Dimensions" of the changes, I did just run a Code Analysis:
(*.java, JPortal directory)
JPortal 1.2b
/src -> 105297 -> Total Code Lines

JPortal 1.3 (current)
/src -> 156296 -> Total Code Lines

-> about 50k lines of code additionally - not counting lines that were just "changed".

(obviously (*.java) not included are additions/changes to html / or xml files, which also includes much meta-information)

Re: JPortal current status

PostPosted: 28 Mar 2012, 18:33
by Malban
Oh well...

so much for a feature freeze.
Running these tests tends to be so boring that while running them - I tend to think of little non time consuming things to add (just finished another 100 games test...).

So there are already again some new features which I never really planned:
- added support for HQ Pictures (copy and paste follows)
Starting with JPortal V1.3 there is limited support for HQ Pictures.
Since this was implemented in the time of about 1/2 an hour the support is:
as said - limitted
you have to "install" the pictures manually
What steps to take:
first identify the sets you have in JPortal, pictures of supported sets (once downloaded from gatherer) are kept in the directory (allways starting of with the main dir JPortal) "sets" within that directory subdirectories are kept for all downloaded sets, like sets\Portal sets\Portal Second Age etc.
Within each of these directories manually create a directory called full
download the HQ pictures for the sets you need from the Slightly Magic forum: viewtopic.php?f=15&t=445 remember to download the sets marked as full
extract the downloaded pictures from their ZIP archive and copy the pictures in the corresponding "full" directory.
done
To view a HQ picture of a card press CTRL and LEFT MouseButton. In almost all windows/screens this should open a seperate modale window which shows the HQ picture of the card.
If no windows appears - than the HQ picture was not found!
- started theme support (copy and paste follows)
Themes
With the overhelming success of the release of JPortal version 1.2 - people started "modding" JPortal - to have it look like something which it is.
Starting with version 1.3 there is limitted theme support.
Here a short list of "features".
- a new directory "themes" was added
- within this directory there can be several sub directories
- per default there is only one directory called "default"
- this directory contains all pictures (images) used in the game, like title picture and mana symbols and the like
- this directory also contains a file called "Theme.xml", which contains (and in the future even more) additional information
- you can build your own directories (themes) by copying the default and giving it another name
- you can then replace all pictures with you own pictures (type and size must be the same, there is no ingame calculation provided as yet)
- Withing the configuration you can find under "Visual" a
+ combobox which contains all themes - select the one you would like
+ and a button called Config Theme, to edit additional theme parameters (for now only three)

The new theme will be active after you save the config and restart the game.
- also added an avatar picture of your player (although as of now only shown in player configuration and in the overview of booster draft

- Help file updated - although in many places outdated :-(

Regards

Malban

Re: JPortal current status

PostPosted: 03 May 2012, 13:50
by Malban
Hello to you,

a small status update.
Till this weekend I was still removing and finding small bugs - that were able to be determined automatically.

Since JPortal played about 1000 games in a row without any exceptions - I think it is now quite stable.

Hurray!

Well I didn´t exactly debug 4 weeks in a row - I did a great deal of nothing JPortal related (like going on a Holiday to Milano, played through Portal and Portal II (the ones from Valve - didn´t play them befor) etc...).

Today I programmed a new feature for JPortal - a deck generator. Seems to work quite well. Dunno when I will be doing a "full" release - I don´t know yet how I will handle quests in the future and thus enabling further sets.
Seems stupid - if I do more sets - that a player should allways be forced to do quests. Hm... Dunno yet.

I might do some more themes. Found man beautyfull pictures. All copyrighted for sure. But I might add a feature to load directly all parts of a theme from web...

Anyway - here a small Screenie... of GenDeck

GenDeck.jpg


Malban

Re: JPortal current status

PostPosted: 05 May 2012, 23:06
by Malban
Hi again.

I was quite intrigued by the idea I had while writing the last post.
Here comes the result:

Title:
Bildschirmfoto 2012-05-06 um 00.52.05.png


Game background:
Bildschirmfoto 2012-05-06 um 00.54.10.png


Game progress:
Bildschirmfoto 2012-05-06 um 00.55.26.png


Here the configuration screen:
Bildschirmfoto 2012-05-06 um 00.56.22.png


What you see:
1) Themed pictures in use of JPortal
2) These pictures are loaded from "somewhere" from the internet
3) These "somewheres" can be bundled to a INet-Theme, which can be localized by a press on a button

As of now you can:
a) enter an URL (of a picture)
b) you can tell which portion of the picture you would like to get (there is a little "editor" enter a rectangle via mouse for that - which you can't see)
c) and you can scale the picture to any size you want

Even with these baby-steps the results are very nice indeed - and probably no copyright issues :-)!

Regards

Malban

Re: JPortal current status

PostPosted: 10 May 2012, 14:09
by Malban
Hi ho again,

since I will be going on a holyday soon, and probably I will not give any updates since well after the holyday, here another short one.

At the moment I fill in "small" stuff, like

- updating help (http://www.deamonsouls.de/jportal//index.html)
- correcting some GUI settings
- finding and using new art
- doing a few quest for the new set
- adding features to quests/rewards
- adding features to players
... and the like

After that I plan to do something I like to call "easy mode".

Playing a game in JPortal (and I feel ANY other TCG around) is "complicated".

You have to edit a deck here, read information there, chose an opponent, chose another deck etc etc etc.
If you don´t know the game -> you are lost.

You have to invest quite some time in any TCG befor you can actually enjoy them or apreciate them.

For JPortal I would like to implement in easy mode - with a starting screen of three or four buttons.

Quick Game
Quest Game
Help
Quit

From that you should be able to start the game and not bother about all the checkboxes, comboboxes etc. Menus? -> Bah! throw them away.

(You can allways switch back to "advanced mode")

After that I will probably do a "final" v1.3 release.


Second stage of easy mode would be to actually change the game GUI, but I think that will have to wait untill way, way later.

For quite some time now I have the itch to do a campaign mode. I might do that after the above.
Since I am not fanatic about card numbers to support, or at having the latest cards implemented - new cards or sets might have to wait. I would rather have some other interesting/challenging features, that hopefully will be fun to play.

The campaign mode will make it possible to "develop" the player, I implemented baby steps to possible developments in the newest Quest Designer - result can be seen here:
gamestat.png

Most of these setting would only really make sense in a campaign mode. And no quests use them as yet (only the enabled ones are fully implemented anyway).

Regards

Malban

Re: JPortal current status

PostPosted: 10 Jul 2012, 21:16
by Malban
Hi to you all!

I just uploaded version 1.3 of JPortal to sourceforge.
Changes from 1.3 beta:
- small bugs removed (quite a few, nothing really serious though)
- polished some of the rough edges
- new avatar pictures
- 3 quests added for Starter Set 2000
- enhanced AI playable with AI "Falban" (or in later quests -> Fynn)

Not done:
- update to help file
- "easy mode"
- some edges are still quite sharp (quests, shop,...)

I play tested quite a bit. E.g did do all quests to make sure they are still valid. Actually I still think JPortal is a very nice game and quite playable - even if I made it myself :-).

Hope you enjoy it. Feedback as always welcome.

I will take a pause from JPortal now - next update might include Fifth Edition - but it will be quite some time. Might do another project first.

Bye

Malban

Re: JPortal current status

PostPosted: 11 Jul 2012, 02:28
by Huggybaby
Thanks Malban! I'm sad that you're taking a break, but excited about what your next project might be.