The Return of Viking Chess (Hnefatafl)

Want to talks about games you like, would like to see developed on the Oric, it's here.
User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Sat Dec 07, 2013 9:23 am

That means that the whole standard charset area is available for your own code or data, of course if you try to print any text it's going to be garbled, but it's just a matter of using the attribute 9 at the start of the line, and there you go: You are using the second charset instead.
I understand. The standard charset still gets copied when we enter hires but if I don't use the std chars I can use that memory for something else. Got it (just have to ensure i print attribute 9).

I now also understand about the osdkaddr. If i used TAP2DSK (so it could run as a disk image on say, the cumulus) it wouldn't work if I used $400 (as DOS gets trashed). Using $400 would free more memory but it would be restricted to tape only. Is that summary correct?

Lots to think about... :)

v0.092
Fixed yesterdays problem 100%. Later today I'll work on another hole in the AI using the newly freed memory (I think I'll be happy then) :D

User avatar
Dbug
Site Admin
Posts: 2668
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: The Return of Viking Chess (Hnefatafl)

Post by Dbug » Sat Dec 07, 2013 10:18 am

barnsey123 wrote:I understand. The standard charset still gets copied when we enter hires but if I don't use the std chars I can use that memory for something else. Got it (just have to ensure i print attribute 9).
You have two ways of doing it:
- Write to the TEXT location of charsets, and switch to hires after (then get copied)
- Switch to hires first, then write to the HIRES location of charsets.
Both methods are equivalent, but the second one has the advantage of not relying on somebody else copying the font for you, which means that if you decide later on to not use the system at all, and do the HIRES switch yourself, it will still work.
barnsey123 wrote:I now also understand about the osdkaddr. If i used TAP2DSK (so it could run as a disk image on say, the cumulus) it wouldn't work if I used $400 (as DOS gets trashed). Using $400 would free more memory but it would be restricted to tape only. Is that summary correct?
Mostly correct.
It will be not working with DOS, that does not mean it can't be made to run on DISK.

The DOS uses the page 4 so it can provide the user with a permanent section of code that can be used to switch between the BASIC and the OS, but nobody forces you to use the DOS at all: All the Defence Force demos are just using the bootstrap sequence of the disk controller rom, after the whole memory is available, it just mean that you don't rely on the DOS to load sectors, all the memory is yours, etc... of course that makes using the system kind of problematic because you can't really rely on the BASIC rom anymore :)

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Sun Dec 08, 2013 8:16 pm

v0.093 implemented new set of routines (Xenon,Xenon2 and ..XenonA,B,C,D
This bumped up memory too far. Have trimmed other things but bytes used = 37887. The game plays OK but XENON isn't working. Need to look into it properly...

I really need to look at the text routines so will look at dbug's suggestions and try and squeeze a few more bytes out the old girl.

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Wed Dec 11, 2013 7:11 pm

The Crucifix Conundrum... :?

"What's this?" you might ask. Well, it's an infuriating bug named after the shape of pieces which causes the game to HANG forever... :evil:

Below are two examples where this has occurred. In both cases the king can be captured. He is surrounded on three sides and an attacker can occupy the 4th square and achieve victory. At the same time another take would occur (the defender in the "stalk" of the crucifix).
In situations where the king is surrounded on 3 sides - and the 4th can be occupied by an attacker - all other possible targets are NUKED and a high value given to the 4th square (just to be sure). Therefore, the computer has no choice, he HAS to occupy this square as no other targets are available.
Crucifix.png
The Crucifix Conundrum
Crucifix.png (20.11 KiB) Viewed 8264 times
So why is it hanging? I don't know...

This is a b*tch for a number of reasons and I'm not releasing v1 until it's fixed (I hate buggy software).

It's a very rare situation but it's happened more than once (in v0.075 and again in 0.097) so I can't ignore it. On the plus side (besides this bug) it's been playing really well and gives me an interesting game. I can't always beat it at THOR level which is encouraging.

On the down side there's dozens of variables and routines to trace through. Perhaps this crucifix shape is God's way of telling me that I shouldn't write games featuring pagan gods... :wink:

User avatar
Dbug
Site Admin
Posts: 2668
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: The Return of Viking Chess (Hnefatafl)

Post by Dbug » Wed Dec 11, 2013 8:14 pm

You can help debugging by using the printer output, that's practical do dump information to a text file for later review :)

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Thu Dec 12, 2013 10:21 am

Problem solved and another revealed.

To detect an endless loop situation I added a loop counter in the most likely place and if it exceeded X amount it would ZAP and return. It ZAPPED and returned which narrowed down the possibilities and the problem revealed itself (now fixed). For the moment I'm leaving the ZAP there in case other loop situations occur.

Another method I used was making use of the "printturnline()" function. Handily, this allowed the on-screen printing of various target/enemy variables (instead of the turncounts etc). This revealed another problem. That square SHOULD have been occupied BEFORE the final move but for some reason the target value was 1. This means that the computer thinks it can be taken if it moves there. The previous screenshot clearly shows that in reality this is not the case. It could NOT be taken. So the next challenge is to work out why...
If I can fix that then this will probably sort out why it occasionally makes other sub-optimal moves. And if I can fix that then the computer will be harder to beat.

The Xenon routines have been much simplified and reduced in size so more memory is available.

Getting closer.... :)

@dbug, I haven't used the print output trick you mentioned although I'll look at it if other methods fail. If I can fit it in somewhere maybe I could attach it to the ZAP loop detection mentioned above. So if a ZAP condition is detected it could print out the contents of various arrays/variables. I'm sure you've mentioned this method before but I just haven't got around to looking at it. So many todo's, so little time... :(

User avatar
Algarbi
Pilot Officer
Posts: 122
Joined: Thu Mar 19, 2009 10:47 pm

Re: The Return of Viking Chess (Hnefatafl)

Post by Algarbi » Thu Dec 12, 2013 12:10 pm

Courage Barnsey you are almost there :)

I must learn to play this game it sounds interesting.

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Fri Dec 13, 2013 7:00 pm

Algarbi wrote:Courage Barnsey you are almost there :)

I must learn to play this game it sounds interesting.
Thanks, I was working on the problem today and could not solve it. I knew I was close but I couldn't see the full solution. I switched off the computer in despair. I then made a cup of coffee and remembered your words and the solution came to me in a flash. Not sure if I would have solved it without your encouragement...

The missing piece of the jigsaw (called SPIKE) is now in place (v0.098) and it fixes a long standing problem. There are still some other issues but this one was a real stinker. I feel like I've just got to the top of the mountain and it should all be downhill from here... :)

When I've got time I'm going to produce a PDF with game instructions and a tutorial (this should make it easier to learn how to play).

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Mon Dec 16, 2013 4:28 pm

* Groan *
recent fixes are negatively affecting gameplay (it's less aggressive now and more easily beatable). Perhaps it's the flaws that make the game? Need to think...

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Tue Dec 17, 2013 7:13 pm

v0.100 fixed problem with the AI losing it's balls. I'd got some variables mixed up * Hic *

Just some stupid things to fix now. After that, make the loader prettier and then glue the bits together.

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Sat Dec 21, 2013 5:49 pm

viking-xmas.PNG
viking-xmas.PNG (18.61 KiB) Viewed 8099 times
Merry viking xmas dudes...I know it's messy but what the hell...

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Sun Dec 22, 2013 10:32 am

I'm desperately trying to finish this game so I can release it in this anniversary year.
The few quirks have turned out to be major issues...I'm simplifying some over-complex routines and going back to the roots of the game (a collection of simple rules combining to produce complex behaviour).
Frustratingly, the finish line always seems to be just out of reach... :(

User avatar
Dbug
Site Admin
Posts: 2668
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: The Return of Viking Chess (Hnefatafl)

Post by Dbug » Sun Dec 22, 2013 11:00 am

barnsey123 wrote:I'm desperately trying to finish this game so I can release it in this anniversary year.
The few quirks have turned out to be major issues...I'm simplifying some over-complex routines and going back to the roots of the game (a collection of simple rules combining to produce complex behaviour).
Frustratingly, the finish line always seems to be just out of reach... :(
Well, if it can make you feel better, the Slide Show demo I'm working on was supposed to be for Christmas, but it's probably going to be more like a mid January release instead :)

Btw, have you been thinking in having colors in our intro picture? If you want I can give a shot at colorizing it, can't promise miracles though, but I can try.

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: The Return of Viking Chess (Hnefatafl)

Post by barnsey123 » Sun Dec 22, 2013 6:42 pm

Dbug wrote: Well, if it can make you feel better, the Slide Show demo I'm working on was supposed to be for Christmas, but it's probably going to be more like a mid January release instead :)
Btw, have you been thinking in having colors in our intro picture? If you want I can give a shot at colorizing it, can't promise miracles though, but I can try.
Hi Dbug, thanks for that. I tried all sorts of stuff on loading picture but I found I get the best results with pure black and white. I've attached the original pictures for you to play with though (please include in the slideshow if you think they are worth it...) :)

The best news though is I've tracked down a nasty bug which was recently introduced. I'd been barking up the wrong tree for hours...I've also reduced the size/complexity of the code and had a brainwave. Note to self: SUCKER PUNCH. Back on track...
Attachments
MaskTest.png
Original full-color image (by Darren Bennett)
MaskTest.png (548.16 KiB) Viewed 8056 times
MaskSmallOric2.PNG
reduced size graphic with some bits added by me to optimize the oric conversion process (to look better after conversion)
MaskSmallOric2.PNG (12.42 KiB) Viewed 8056 times

User avatar
ibisum
Squad Leader
Posts: 994
Joined: Fri Apr 03, 2009 8:56 am

Re: The Return of Viking Chess (Hnefatafl)

Post by ibisum » Mon Dec 23, 2013 12:15 pm

13-year old mind is blown, yet again, that someone is doing real graphics on the oric. ;)

Post Reply