News:

NEW GAME and special BOOK (and more!) to come from Côté Gamers! ! Check this topic!

Main Menu

Porting my SHOGUN game to the Videopac

Started by dr beep, April 03, 2021, 07:51:42 PM

Previous topic - Next topic

dr beep

In the original game I used selfmodifying software to handle the AI from the computer.
Since the ROM can't be altered that same check is now done with a flag in RAM.

The first destination for a move is now reached. The evaluation of the move is the next to do. And then check it against best move.

Slowly getting the game ready.

Where I could code the entire game in 1K on a ZX81 it looks like I will need a bit more for the Videopac version. No problem since I have 2K ROM available without extra banks.

dr beep

The AI of che computer plays all moves and then evaluates each move in a score. A higher score is a better move.
At this moment the best move before playing the actual move is found. This needed a different startscore on the Videopac than on the ZX81. Due to the 2-complement check I can't start with the value 0 as start since that will never give a carry when a chcek is done. The startvalue is set to 1.

I also passed over the 1K boundary and I still need to code extra checks, winner check and signaling an attack on the shogun.
So far it goes well, although coding 8048 is quite hard to do as a first game.

dr beep

Arggghhhh,,,,

The compiler doesn't do a correct jump from 07FF to 0800. Must check it by hand.

Furthermore a bug in the computer AI. Somewhere a value is written to an address and I can see where.
No if the debugger could do a stop when writing to a certain address I could find the bug.
Now I am searching in the dark for several days already.

dr beep

I hope you love to read the struggle I have coding my game.

For this game I needed a whole new routine to find endplaces and to handle the computer AI. It looked like the AI did not save 2 registers in the right way. I altered that and now I will slowly adapt the AI-routine in it again.

Rafael

Of course, we love reading about game development. ;)

minodk


dr beep

I can now show you the very first AI-move from the computer.
Thanks to the reply a few days ago I now have the display working and a small part of the AI.
For development the board is now not random so I can replay situations.
In this board I move my stone to a position where the best move would be to capture the stone
(which is just a small part of the AI) and the computer does that move.


https://www.mediafire.com/file/4azabzuw0l6wgsn/compai1.png/file

dr beep

Although my AI is not complete yet I played a game against the computer where more AI was added. I still need extra checks, endgame testing, signalling attacked, but it is getting somewhere. Small bugs repaired which occured in AI, R0 was corrupted on return in checkloop so it is set again. For playerloop R0 stayed ok, so no repairsetting was coded.

The checkloop is used by both, but the ai uses the enddestinations where the player only gets a valid field check.

dr beep

The next step in the AI is the info after a move.
The info is still correct which means the temporary move is not working as it should.
That is the next thing to check.

dr beep

Bugs are often just typo's.

Like MOVX A,@R0 had to be MOV A,R0

Now I need to add another save of 2 positions as well.

dr beep

Debugging goes slowly, but another bug solved
Now the check on all positions on the board is working as it should.
Now I must check again why certain moves are not found as best move.

Slowly (too slow in my opinion) the game becomes as it should be.
When the AI is working as it should then I must add end of game checks and SHOGUN ATTACKED signalling.
Sound effects for selecting a stone is nice to hear what you did.
Finally 2 extra AI options will be added but those are extra.

It will fit 2K easily, but I am not ready yet.
1199 bytes at this moment.

dr beep

A bug in the AI solved which made me find another bug.
The board was not always resetted to the start of move.
After that the game became playable until an invalid move was done by the computer which lead to a crash of the game.

Now I need to find how this invalid move was selected. This part of the game is fully rewritten to make it fit for the Videopac
so I can check it with the original game.

dr beep

I was able to make an invalid move by the player. This simplifies the search for the bug.

dr beep

Bug found.... and another appeared..... and solved.

The game plays quite well although after many moves a display error appeared.
I think in a certain moment the VDC is written to and not ERAM.

Hope to find fixed steps to re0enact the error.

dr beep

Yes.... Displaybug finally solved.
This might even be the cause of incidental crashes.... I hope it is.

if so I can work on the final steps of the game.