Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (727)
Games in Android Showcase (217)
games submitted by our members
Games in WIP (796)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  OpenTafl: old terminal graphics meet Old Norse board games  (Read 45107 times)
0 Members and 1 Guest are viewing this topic.
Offline Fishbreath
« Posted 2016-06-01 13:15:52 »



OpenTafl is an open-source engine for board games in the hnefatafl family, supporting local human-on-human play, a built-in artificial intelligence, external AI engines, and (very soon) network play. You can get the stable release or the bleeding-edge release at the OpenTafl website, and you can find the source code at Bitbucket. If you run into any issues, please report them there.

The hnefatafl board games are asymmetric abstract strategy games. The defending player, who starts in the center of the board, must get his king to a board edge space or a corner space, while the attackers, who start around the outside, must stop him. There's a thread here about the game, and a thread about the AI competition I'm running, too.
Offline J0
« Reply #1 - Posted 2016-06-02 20:22:48 »

Oooh I guess Ags1 would want to see that hahah!

Do you have Ard Ri implemented? Smiley
Offline Fishbreath
« Reply #2 - Posted 2016-06-03 11:42:46 »

Afraid not—I haven't had time to put in support for tafl variants which limit the range of taflmen yet. Perhaps over the summer.

The good news is that I have released v0.3.0.0b, which has network support. If you're interested in tafl, find a buddy and go play a game!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Fishbreath
« Reply #3 - Posted 2016-06-13 02:27:11 »

OpenTafl v0.3.1.0b has released, which adds spectator mode to online games and bumps the network protocol version. (The server running at my website has updated, so old v0.3.0.0b clients will have to update to the new version to play online.)
Offline Fishbreath
« Reply #4 - Posted 2016-06-15 17:08:52 »

Coming soon is v0.3.2.0b, which will have support for headless AI network clients. Headless AI clients can be set to join one game against a specific player, or to create permanent games on the server, playing against any opponents who care to try. To help AI authors diagnose issues with their AIs, headless clients automatically save a record of every game they play. A long-running headless client hosting games should, over time, build up a library of useful and instructive games. (Theoretically, anyway. Not a lot of average players on the server so far.) The headless client supports any engine using the OpenTafl engine protocol; no special work is needed.

Remaining on the hit list for this version:
  • Build out test coverage for network play
  • Update documentation, provide command-line documentation for headless mode
  • Hands-on testing pass, along with a longer test cycle on the server with headless clients
  • Finish implementing a chatty-normal-silent spectrum for debug prints
  • Built-in update checking/downloading

Once v0.3.2.0b comes out, all the groundwork will be in place for the AI tournament in December, and I can move back to additional OpenTafl AI development work. v0.3.2.xb (or v0.3.3.xb, if I punt on auto-updates for a bit) will be released as the stable version in the next month or so.
Offline Fishbreath
« Reply #5 - Posted 2016-06-16 16:25:11 »

v0.3.2.0b is released! This is the stable release for v0.3.x, and OpenTafl is unlikely to change much in its underlying mechanics between now and the tournament in December, so if you're interested in a good version to code against, this would be that one.
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #6 - Posted 2016-06-18 07:45:51 »

Quote
code against, this would be that one.
Let me just manipulate the connection between me and you and destroy your server.
Haha Smiley

Good work on everything you did. Creating a server can be lengthy work. I just yesterday made a Proxy Server, that is kindof crappy because my lack of how HTTP proxies underlyings work (learning to build one without resources), but it does transfer stuff. I also, like day or two before that, made an HTTP Server which is fully functional. It doesn't parse the request header at all though Smiley It just sends a 200.

Servers are fun. I suggest making a library.
And to never, ever use anything but the InputStream.

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Offline Fishbreath
« Reply #7 - Posted 2016-06-30 03:46:56 »

Hydroque, crashing the OpenTafl server is probably as simple as sending random bytes for an hour or two. Tongue

Coming soon is v0.3.2.1b, which will have some OpenTafl AI performance improvements, along with a benchmark mode. (Turns out my new work laptop, with a Skylake i7, is about as peppy as my desktop's Sandy Bridge i5 at 4 GHz, at least as far as mono-core performance is concerned.) It's a little faster now than it was before v0.3.2.0b; v0.3.2.0b caused some serious performance issues as a result of a bugfix for server mode. Now that I have a good profiling setup, I expect some further improvements in the medium term.

The pace of releases will probably slacken somewhat over the summer—I don't have nearly as much planned, now that network mode is finished. Possibly support for online tournaments, and support in the headless AI client therefore, but that's a luxury feature, not a requirement. The fall will probably see some OpenTafl AI improvements, in the hope that I might be a slightly better competitor in the pool stage of the tournament.
Offline Fishbreath
« Reply #8 - Posted 2016-07-03 19:20:04 »

v0.3.2.1b is out, at the usual place. Also has 19x19 tafl, and a functional terminal-only mode.
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #9 - Posted 2016-07-04 17:56:42 »

Is this pronounced "taff - ull"?

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #10 - Posted 2016-07-04 18:26:23 »

Is this pronounced "taff - ull"?

I pronounce it more like taa-ful.

Offline Fishbreath
« Reply #11 - Posted 2016-07-05 16:34:33 »

v0.3.2.1b had some embarrassing JAR build bugs, so v0.3.2.2b is out now to correct those. (Oops.)

I've always said 'taa-ful', like ags1. I don't know how Old Norse went, but I've heard some people suggest the original pronunciation was more like 'taa-vul'. Personally, I'm fine with the unvoiced labiodental fricative.
Offline Fishbreath
« Reply #12 - Posted 2016-07-14 17:04:13 »

v0.3.2.3b has been out for a day or two now. In the next few days, I expect to have v0.3.3.0b released, which will implement loading of saved games over the network, as well as provide additional configuration options for more competitive games, allowing hosts to turn off replay mode and spectator chat.

Following that, v0.4.x is on the horizon, to include two main features: playable variations, which will be built into saved games and will enable features like tafl puzzles, and OpenTafl AI improvements.
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #13 - Posted 2016-07-14 17:57:32 »

Steady progress! How is your AI coming on?

Offline Fishbreath
« Reply #14 - Posted 2016-07-14 18:58:56 »

Nothing to report since a few versions ago—the networking stuff and UI improvements have really eaten up my time.

I have a lot of fun AI stuff planned for 0.4.x: improvements to the evaluation function should net me some better play, and I have a few heuristics left to add which should improve my alpha-beta performance. I'll write about those more when I'm closer.
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #15 - Posted 2016-07-14 19:26:53 »

OK, now you've got me worried. That all sounds very formidable.

Offline Fishbreath
« Reply #16 - Posted 2016-07-14 19:41:34 »

For all that it sounds impressive, it still can't even come close to beating me, unless I really misplay badly, and I'm not all that great a tafl player.
Offline Fishbreath
« Reply #17 - Posted 2016-07-16 01:45:35 »

v0.3.3.0b is now released. This one wraps up network play functionality, including playing saved games over the network and some configuration options for hosts to disallow spectators to talk to players and to disable analysis and replays for the players.

v0.4.x is moving from 'on the horizon' to 'coming soon'.
Offline Fishbreath
« Reply #18 - Posted 2016-07-24 12:22:17 »

There will be at least one more release in the v0.3.x series before I move on, to correct two issues:

1. On large boards (15x15 and 19x19 especially), having the rank and file labels on the top and left alone makes for very difficult reading in the bottom right corner. To fix this, I'm now rendering the rank/file labels on all sides of the board, and the 'info' command now shows the coordinates for all moves a piece can make.
2. When loading a saved game over the network, the time-remaining information from any previous game loads is lost when the game is re-saved. I'll have to change the network protocol version again, but it should be a fairly easy fix. (I just have to send the info along with the move list.)

In other news, I made what may turn out to be an AI improvement, but I haven't had OpenTafl play enough games against itself to know for sure yet. While I'm off at church this morning, I'm going to have it run 100 or so and see what happens.
Offline Jono
« Reply #19 - Posted 2016-07-25 07:31:57 »

My AI has soaked up more time than I expected. It's playing ok, but I don't think it's anywhere near human level yet. At least it's at the point where all I have left to do is the fine tuning, so it'll definitely be playing in December Smiley
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #20 - Posted 2016-07-26 18:46:00 »

Could you explain the AI that goes behind this? The class structure and methods, really. How are you going about this?

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Offline Jono
« Reply #21 - Posted 2016-07-27 08:36:54 »

Could you explain the AI that goes behind this? The class structure and methods, really. How are you going about this?
That would be quite a long explanation.. but in brief, the important classes:
  • Board: maintains game state (positions of pieces) using minimal memory. Provides useful functions that make some assumptions about rules, e.g.: get all open spaces vertically and horizontally from a given piece, or from all pieces of a certain colour. Also whether the simple win conditions have been met -- white in a corner or king captured.
  • "Heavy" Board: a sub-class of Board that adds more information that can be inferred from the game state. E.g. counts of pieces, whether white is surrounded, which pieces are threatened (can be captured in one turn) etc. Ideally the extra information should be able to me modified incrementally when a piece is moved.
  • Transition/HeavyTransition: classes that can apply moves to a Board and can undo moves.
  • Evaluator: An interface that provides a function for evaluating who is winning in a given Board position. The simplest one says 0 when black has won, 1 when white has won, and 0.5 otherwise. This is where heuristics can be implemented.
  • Search: Interface that takes an initial board state, an Evaluator, a Transition factory (that produces valid transitions for a given Board), and returns the move that produces the best looking Board. I have two implementations:
    • IDDFS (iterative deepening depth-first search) using min/max with alpha/beta pruning. As this is depth-first, adding and undoing moves as it goes, memory is no issue. You can leave this running for days to evaluate positions if you want so is good for testing the correctness of other search strategies.
    • MCTS (Monte-Carlo tree search). This can be much better than IDDFS if you can get good playouts. This requires selecting fairly reasonable moves from any board position. Without lots of examples or good knowledge of the game this is pretty hard so I decided to shelve this strategy.

There are other bits that get added to improve things. For example, visited sets so you can reuse values when you encounter the same state multiple times. A function for classifying moves as interesting/unintersting that can be used either for MCTS playouts or for ordering the search in IDDFS. Plus plenty of heuristics that appear as concrete evaluators.

The light-weight states almost always lose out to heavy-weight states coupled with computationally expensive heuristics. Basically you should always do more work and search less. That seems to hold for Tafl, at least for me.

On my anemic PC I get 400k nodes per second searched using a vanilla board, and about 30k/second with heavy boards and heuristics. The slower search absolutely clobbers the faster one in games. It only gives up about 1 or 2 depth but has far better evaluation of position.
Offline Fishbreath
« Reply #22 - Posted 2016-07-29 03:03:45 »

Great to hear, Jono! I look forward to seeing your entry play. Well done on the speed: OpenTafl's built-in AI can be either fast or memory-efficient, but not both, and right now, it's more on the memory-efficient side. (To a degree. It's all fairly heavyweight, since I'm using the same code as for the engine.) I think the best I ever did was 200-300k nodes per second on fairly beefy hardware.

I'm fascinated by your results w.r.t. old-school technique against Monte Carlo. My gut suggests that MCTS will produce better results in the long run, although you're probably right that there isn't nearly enough expert knowledge, nor a large enough corpus of games, to make it workable. Maybe later on in the fall, I'll ask for game records from Aage Nielsen's website—there have been a few thousand to maybe a few tens of thousands played there. It would be a handy thing to have.

Hydroque, if you want to look at another, less well organized approach, OpenTafl's built-in AI package is here. Start with AiWorkspace.explore.

Anyway, OpenTafl is now up to v0.3.3.2b, which is I-swear-for-real the v0.3.x stable release, barring any bugfixes required. Network play is feature-complete, including loading saved games. v0.4.x is upcoming, with two things solidly in line: variations during replays, along with support for puzzle-type saved games, and AI improvements. There are lots of heuristics known for chess programming I'd like to try to apply here.
Offline Hydroque

JGO Coder


Medals: 25
Exp: 5 years


I'm always inspiring a good time.


« Reply #23 - Posted 2016-07-29 04:49:40 »

Interesting. I read Jono's post, and I will take a look at your link.

You think I haven't been monitoring the chat? http://pastebin.java-gaming.org/c47d35366491fHere is a compilation <3
Offline Fishbreath
« Reply #24 - Posted 2016-08-04 17:47:30 »

I have a 1200-word post on the playable variations feature coming with v0.4.x. Or, more correctly, on a single point in the implementation: building the system for addressing variations. It turns out that naming lines of play through a move tree which can be created or deleted at will is not an altogether trivial problem, but I've hit upon a solution I'm not too unhappy with.
Offline Fishbreath
« Reply #25 - Posted 2016-08-07 11:43:30 »

It turns out that was the hard part: building the actual variation functionality into the engine, and creating some UI to go around it, was relatively easy. I'm about 90% done with what I would consider prerelease-worthy functionality, so later today, I'm going to spin a v0.3.3.3b stable to fix a bug in game loading over the network, and a v0.4.0.0pre to demo variations while I continue to work on them. Hopefully. I'm pretty wiped out from my Saturday, so I may be a bit delayed.

Edit: double release day it is! v0.4.0.0pre and v0.3.3.3b are available now.
Offline Fishbreath
« Reply #26 - Posted 2016-08-10 16:34:04 »

v0.4.1.0b is now released and, as far as I know, it's now the only tool which allows for easy authoring and watching of annotated games. The feature list includes variations, as in 0.4.0.0pre, and now has support for variations in saved games and an in-replay UI for authoring annotated replays.

Remaining on the docket before the major AI push: a few more rules variations to support custom play at PlayTaflOnline.com, a new site for head-to-head tafl play set up by an Internet acquaintance of mine, which uses OpenTafl as a bot player.
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #27 - Posted 2016-08-10 16:50:02 »

Tried to register on playtaflonline.com but not getting the registration email. Also, I would be more comfortable with google authentication...

Offline Fishbreath
« Reply #28 - Posted 2016-08-10 18:51:19 »

I'll pass that feedback along next time I see the guy there.
Offline Fishbreath
« Reply #29 - Posted 2016-08-11 19:37:44 »

Busy few days: I just put out v0.4.2.0b, which adds variants with speed-limited pieces, and a new kind of king capture option.

Releases going forward will probably slow down a lot: v0.4.2.0b is basically feature-complete, and my next task is AI improvement, which will take a long time and a lot of testing to be sure that I'm actually making a positive difference.
Pages: [1] 2
  ignore  |  Print  
 
 

 
Archive (299 views)
2017-04-27 17:45:51

buddyBro (486 views)
2017-04-05 03:38:00

CopyableCougar4 (933 views)
2017-03-24 15:39:42

theagentd (946 views)
2017-03-24 15:32:08

Rule (955 views)
2017-03-19 12:43:22

Rule (924 views)
2017-03-19 12:42:17

Rule (925 views)
2017-03-19 12:36:21

theagentd (988 views)
2017-03-16 05:07:07

theagentd (903 views)
2017-03-15 22:37:06

theagentd (696 views)
2017-03-15 22:32:18
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!