PROGRESS with HNEFATAFL

(design and related document)


16:35 Finnish time, Turku.

Well, got home and started up my computer. Windows ME.
With Leifang (DAO wallpaper) as background. Nice.

So my project is a computerised version of Hnefatafl. What the
heck is Hnefatafl, I here you think. Well, that is explained in
the manual. Haven't written it yet, but it will be there.

Main structure for the game:

Title screen

Menu
	- options
		- sound-effects on/off
		- music on/off (if I get it to work and manage to compose something)
	- one-player (disabled until I get AI working)
		- side choice (brown or white)
			- game
	- two-player local
		- player's names and side choice
			- game
	- two-player network (disabled until I implement it. and I probably won't for this SpeedHack;)
		- host
			- player info and ip and wait for incoming request
				- game
		- join
			- player info and ip of server and connect
				- game
	- credits
	- quit
		- end title

That's about the main flow of the program.

I just called a friend of mine, who has a dig. cam. I'd like to have my clay gameboard in the
game, rather than to have to draw a board myself. Dig. cam. is apparently not functioning
properly, so he will call back if he gets it working. Would be nice. On the other hand, I have to
make _some_ drawings to keep moving.

The particle engine I'll use as pixelbursttrail when pieces are moving. So that part of the rules
will be fullfilled. The high score board: the player with least moves as winner ranks highest. I'm
thinking of making a 'high score board' for players that got beaten in just a few moves, or
something like that. I'll be using runes in the game, for they are (sorry, were) the alphabet
(called futhark) of Old-Norse. I followed a course in Old-Norse back then, when I still studied
at the university of Groningen (Netherlands), so I should have enough material for that :)

Now onwards, programmers. Coding awaits us!

Saturday 0:23, Finnish time, Turku.

Well, I think I got the menu system sort of working. I am able to show the game board and 
place pieces on it. I'm going to bed now. Tomorrow I'll work on the input and move-checking part.

I made some graphics, that actually look very nice (the ingame graphics). I think I'll keep using
them. For the menu-system I'll be doing some better stuff. I think I'll be able to finish the
input and checking system by about 15:00. I will do a very simple AI after that (like: can I take
the king? DO IT. if not: can I take a piece of the player? DO IT, if not: some move that might
look intelligent. How? I really wouldn't know. Need some sleep:)

I might go in the morning to the university and update my .plan with what I've written sofar.

Get set! Go Go Go (count sheep. b, b, b).

Saturday 10:31 Finnish time, Turku

And a good morning to y'all. I have been coding for about one and a half hour now. I discovered
some stupid flaws in the checking code. I have it ironed out allmost completely. If that works 
I have to do the updating of the board (shouldn't take more then an hour for someone like me :(
After that I'll be animating the moves and implementing the obligatory particle engine. A nice 
pixeltrail when a piece is moved. And maybe some decorative use outside the board... I have to see.

And then an AI-player. The one I described last night. Should be do-able. Not? I might start to 
do some better menu-graphics before the AI, though. It's quite crappy.

But now, first of all the <F12> for screenshots. Nothing dandy, my game's outfit, but I like it (and
so does my girlfriend, so THAT counts).

Saturday 13:03 Finnish time, Turku.

Well, I can now move pieces around the board, within the room the rules of the game give. Selection
and deselection is possible (have to make some graphic gig to show the players what has been selected,
though). And in the bottom box there are some informational messages (who's turn it is, illegal
move, not your piece. That kind of text).

I have to do the checking of 'eating' and win/lose-conditions. And the particle engine. I have to 
rethink my ideas of a high score table, because it is quite difficult to decide on what basis to 
give points. I might of course have a list in which will be recorded how many wins and losses a 
certain player has played...

Saturday 15:02 Finnish time, Turku.

Except for the 'eating'-rules everything works as it should. All the checks are done as they should.
Now make the 'eat'-rules complete and then for the graphical effects :)  It feels good to get something 
working in a day!

Saturday 17:09 Finnish time, Turku.

The actual game-play is now finished (no AI, but two-player is finished). I think I'll take a break. 
My shoulders are locked up. 
When taking pieces they show up on the right side of the screen. I have to organise it somewhat in 
a more orderly fashion, but it does its work for the moment.
I think I'll go update my .plan and put some screenshots... (or are we only one allowed?). 

Saturday 21:00 Finnish time, Turku.

After playing the game for a while I noticed to great discomfort, that the checking rules aren't 
complete after all :( Oh well, it shouldn't be too difficult to repair.

Saturday 22:13 Finnish time, Turku.

Dammit. That took a bit longer than I expected. Well, I optimized the checking code the same time, 
contracting where I could. If I had done that earlier, I wouldn't have had to type that much. All this
rule-checking code was kilometers long. Well, I put it in some subroutines and it is also easier to
change without having to search for all the places that would have effect and change. It goes now more 
easily. Phew.

I have planned to clean the code tomorrow evening. Put it in some sensible modules. I have at the moment 
everything in one file. Not exactly neat programming practice, but the program works. YoY.

Saturday 0:42 Finnish time, Turku.

I have been reading a bit about particle engines. I know how they work, but it is still good to 
refreshen the mind. I have setup the code so I can start implementing the particle effects tomorrow
first thing in the morning.

Until know I have refined some code for checking rules. I also added a coloured rectangle that shows 
what has been selected. I still haven't done a proper menu (layout), but it works, and that'll 
do for now. I give the ingame effects a higher priority for now. Tomorrow and Monday final touch 
on that area.

Good night.

Sunday 10:32 Finnish time, Turku.

And a jolly good morning to y'all. I slept until 10 this morning. Was not in my plans, but I feel 
rested now. (how come;). Just looked a bit at my code and when I started doing the animations, I
got some kind of a flash of a genius. I altered the code, and now it saves me tons of writing and 
adding animation code. Before I have even started I have finished it almost! Just one or two in 
essence quite small routines (compared to the rather inefficiently written rule-checking routines;) and 
reducing existing code in size as well!! (at 2013 lines of code at this moment)
It feels real good to have a brain sparking that way. Especially when I really hadn't programmed 
on this graphical area. Until now I mainly coded the inner-workings of games...

Well, back to coding, before things get sentimental. But first change my Ex Deus wallpaper back to 
one of the Dao-girls (Dreamcast homepage for that, me lads). This time Kasumi.

Sunday 10:55 Finnish time, Turku.

Only twenty minutes of changing and adding some code, and the pieces are moving. Joepie!

Sunday 12:20 Finnish time, Turku.

I've decided NOT to have a pixeltrail. Somehow the checkingrules don't really cope too well with 
the added code. Oh, don't worry, I'll be using a particle engine allright. But not as pixel-trail 
for moving pieces.

Sunday 14:25 Finnish time, Turku.

The particle engine is done. I have two little fountains on either side of the 'score board'. As 
extra feature, the player can play with them for a bit with aswd and numpad_2468 keys.

Now for refining the menus and implementing the help and stuff. Writing a manual/readme and testing 
the program under DOS and Linux would be a good idea. Oh yeah, an AI-player. Maybe. I first want it 
to look better.

And if time permits, cleaning up of the code. I have quite a lot unused variables lying around, and 
it is not very easy to read, when all the code is in one file...:)

Sunday 17:37 Finnish time, Turku

I have once again proved myself, that I'm no wizzard when it comes to creating goodlooking graphics that 
fit in only a few kb. So I decided to just use paint and do it the easy way. When the competition is over I'll be doing that. 
I also noticed that I don't have time to look into Allegro's sound stuff. (The test-programs that come 
with Allegro don't work too well). So no sound. And actually no OPTIONS-menu. But I have used it, though, 
users can click on it to get some surprise. :) The one-player option might be done before tomorrow. 
I give it a higher priority than this halloffame-stuff. If I have time enough I'll be doing that as well, allthough 
I think it is quite stupid in this game. Maybe least-moves-win/lose tables. Or maybe I'll do the 
highscore tables first and see if I can get some AI working. Chess would've been easier, those rules I have (and 
can be found on the net). But this is a new game for me, so... We'll see. I have now 2325 lines 
of code. The testing on other OS's will probably have to wait 'till after the comp. Sorry for that.
Now taking a break (shoulders and neck are hurting like hell :(
The files together, non-packed, take 230 kb. Nice.

Monday 0:07 Finnish time, Turku.

Windows version is now working as it should. There are some features I didn't implement yet. I'm going to get this working 
in DOS and Linux. Write some manual and the like. If there is time enough I'll do the AI. I have been looking into some 
literature for chess (move generating, searching, etc.). Would be nice if I could use some 121-bit variable. Maybe I
can typedef one of my own (by combining somehow in a clever way two doubles (yielding 128 bits for use). One such structure 
could present a whole board (with 7 bits free for some other use). This would greatly help in move searching and generating 
and the like. But we'll see. As I said, up to the portability.

Monday 2:25 Finnish time, Turku.

I gave a shot at modularising the code, but that gives too much headpain, so I'll leave it all just in one big file. :p
I changed the code to make no video_bitmaps, but only system_bitmaps, because in Linux I seem to run out of video_memory 
very soon (in X. I don't use svgalib yet, because it Allegro's mouse doesn't behave like it should). I made a release build 
for Windows (ME) and discovered it was only about 60k, there where the debug build was about 208k! The program compiles with 
no pain on all three operating systems, except for a warning about the use of floats in some function (once) when compiling 
on DOS and Linux. MSVC doesn't seem to care about it.

This night I'll stay up and do coding. I try to get some AI going, but if I don't succeed, I'll put the zip I just made. Oh, the 
manual and other obligatory literature has to be made. No big problem. So documentation and AI.

BTW, I noticed that the checking-rules take about half of the code... 2442 lines total code at this moment.

Now to the documents and the bitboards.

Monday 3:30 Finnish time, Turku.

readme.txt finished. It begins to look like I won't get AI finished in time. Still trying though. My code shows what a 
lousy programmer I am. Well, I'll have to live with it, not you ;)

Monday 4:12 Finnish time, Turku.

No, AI won't be ready. But the program is working. Hot-seat. Tired. Sleep. Tomorrow upload. Then 
wait for results. Sleep. Tired. (Did I already mention that I'm tired?)

Put all in a zip, with the windows binary, try them in DOS and Linux and then to bed!
It was a nice competition. I'll be there next time.