3D Chess 2K18

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
hitm4n
Dizzy
Posts: 73
Joined: Fri Nov 17, 2017 12:56 pm

Re: 3D Chess 2K18

Post by hitm4n » Fri Apr 26, 2019 7:41 pm

Hi there, i know you may sometimes post some stuff and then get a lack of replies, but if many are like me, we sit and lurk and keep tabs on things. I'm quite keenly following your progress, i check in daily to see whats new here, and i have to say its astounding what you have squeezed into under 500 teeny itty bitty bytes.

We all know of the age old 1k chess that exists, ascii gfx, poor rule set and slow. But without doubt a marvelous achievement.
Is your ultimate goal to create a 1k chess game but with a 3d board and full rule set? If so, then that would be an even wilder achievement.

Anyway, back to lurking :)
4 x
I don't have anything cool to put here, so i'll just be off now to see a priest with yeast stuck between his teeth and his friend called Keith who's a hairpiece thief...

User avatar
hitm4n
Dizzy
Posts: 73
Joined: Fri Nov 17, 2017 12:56 pm

Re: 3D Chess 2K18

Post by hitm4n » Fri Apr 26, 2019 7:43 pm

Sheesh, and your last message before mine states exactly that...

Well, good luck, i'm keeping tabs.
1 x
I don't have anything cool to put here, so i'll just be off now to see a priest with yeast stuck between his teeth and his friend called Keith who's a hairpiece thief...

User avatar
arkannoyed
Manic Miner
Posts: 350
Joined: Mon Feb 05, 2018 9:56 am

Re: 3D Chess 2K18

Post by arkannoyed » Sat Apr 27, 2019 8:56 am

Yes, the ultimate goal is to create a chess game that’s as fully featured as will fit into the 1k limit. So although all this squeezing of the core display code might sometimes seem somewhat pointless, actually every byte saved allows more space to include more functionality. I already have the legal move checking etc pretty much done, and the method that the gui will adopt is between 2 options, both easy to implement within the structure of the display code.

As far as the code squeezing goes, I saved a further 2 bytes last night, both in key areas too, which is where it gives the biggest improvement results too.

The next line up routine is now a byte smaller, though perhaps a few clicks slower, but nothing significant.

Then I managed to save another byte with some nifty code recycling in the print the left part of the line routine. That came down from 24 to 22 bytes yesterday, which even I was astounded by.

Interestingly (well to me anyway!) the total size, which only a few months ago I thought would be impossible to get near 512 bytes, is now at just 516 bytes. I’ve managed to save 36 bytes in about 3 months.

I do STILL need to rewrite the board initialising routine, and attempts so far have not managed smaller than 41 bytes. I’m favouring a recursive approach where it’s created algorithmically. I have a version that dies that in 48 bytes, but that was an early attempt. I’m sure sub 40 is possible.

So far all this continual development has fortunately not made the code any harder to add the GUI functions into, which is lucky.
0 x

uglifruit
Berk
Posts: 13
Joined: Thu Jan 17, 2019 12:41 pm
Location: Leicester
Contact:

Re: 3D Chess 2K18

Post by uglifruit » Sat Apr 27, 2019 6:05 pm

I'm going to chip in and also state I'm a (gobsmacked) lurker in here too, and massively appreciated the time and effort you're putting into this, not only to code it, but also to share the process with the forum. My meagre z80 assembly efforts make me aware of his monumental a task you are setting yourself here. So on behalf of the silent onlookers I just wanted to say thanks, and say I'd welcome any further up updates as they come.
2 x
CLEAR 23855

User avatar
arkannoyed
Manic Miner
Posts: 350
Joined: Mon Feb 05, 2018 9:56 am

Re: 3D Chess 2K18

Post by arkannoyed » Sun Apr 28, 2019 8:00 am

Very kind, thank you. I appreciate that this is very much a personal crusade so far, and perhaps not something everyone might even understand the point of. But it good to know people are still looking at any updates that trickle through. I must confess, my z80 skills have improved a whole heap since I started this process. Although I still have a lot of areas of the Speccy that I’m not entirely familiar with, I’d like to think that the screen handling is now one thing I understand pretty well.

Anyway, another 2 bytes saved yesterday evening.

Incredibly, the left side print routine managed to shrink by another byte, so that’s 3 in as many days!!

I also moved the piece heights table to FF80h to take advantage of using the carry always being set prior to finding the current piece height for the print loop.

I’ll have to re-comment the altered source before I can post any details as it’s got a bit messy with all the changes.

Main routines are now only 249 bytes
Including the data 474 bytes

Total size 514 bytes

Maybe, just maybe development might move on to the next stage once those final 2 bytes can be saved. :o
1 x

User avatar
Pegaz
Manic Miner
Posts: 233
Joined: Mon Nov 13, 2017 1:44 pm

Re: 3D Chess 2K18

Post by Pegaz » Sun Apr 28, 2019 11:10 am

arkannoyed wrote:
Sun Apr 28, 2019 8:00 am
Maybe, just maybe development might move on to the next stage once those final 2 bytes can be saved. :o
I totally agree with that. :)
1 x

User avatar
arkannoyed
Manic Miner
Posts: 350
Joined: Mon Feb 05, 2018 9:56 am

Re: 3D Chess 2K18

Post by arkannoyed » Mon Apr 29, 2019 8:15 am

Changed the left print routine now to this at 21 bytes;

Code: Select all

get_lhs:
           ex de,hl                          ;swap addressing SCReen to DE
           pop hl                            ;LHS data retrieve from stack
           ld c,80h                          ;left bit mask set +1 right so that DEC L happens
left:
           rlc c                             ;next left bit
           jr nc,left_ovr                    ;
           dec e                             ;next left screen address
left_ovr:
           ld a,(de)                         ;get the SCReen byte in A
           or c                              ;set bit to 1
           xor c                             ;reset bit to 0
           adc hl,hl                         ;propagate data in HL to get MSB
left_set:
           ld (de),a
           ret z                             ;if result of shift gave zero then RET
           jr nc,left                        ;if no carry then loop
           or c
           jr left_set                       ;write result by looping back and as OR has cleared carry
                                             ;and the result will not be zero then we can continue
                                             ;the loop
First time I've really had an opportunity to use ADC HL,HL, but its 2 bytes smaller than doing individual register shifts, and it affects the Zero flag too, which in this case is a big help!

Also, as the next line up routine that follows once we RET has to POP the previous screen vector as a pre-corrected address, theres no need to restore the screen address when we exit here either.
0 x

reeagbo
Berk
Posts: 38
Joined: Mon Apr 29, 2019 8:11 am

Re: 3D Chess 2K18

Post by reeagbo » Mon Apr 29, 2019 8:36 am

Hi there,

Here Alex, the chesSkelet author. I just found this post accidentally and it's nice to see that we get to similar conclusions when thinking about this crazy thing. I need to dig into the details of your 3D Chess. I´m pretty curious at the moment.

FYI, I´m about to release a new version of the code, which is 370 bytes. It has many coding improvements and additional "strategy" improvements, particularly for the king under check, escaping and not being left uncovered. The big size version now will also include an option for castling. Let me know if you have any doubts on the current code (0.802c).
http://chesskelet.x10host.com/snapshots/

I saw the question on the pieces value, the thing is that those values are used for both pointing them for display, for move list generation and also the piece value during valuation. I have changed the king value to 8, so the I can identify it easily on the board through bit 3, (hl) whenever i need to.

I'm wondering if it would be worth opening a thread discussion details on chesSkelet...maybe later.

Alex
3 x

User avatar
arkannoyed
Manic Miner
Posts: 350
Joined: Mon Feb 05, 2018 9:56 am

Re: 3D Chess 2K18

Post by arkannoyed » Mon Apr 29, 2019 9:02 am

Hi Alex,

I've not yet been back to your code to investigate the workings any further, but its an impressive achievement. The numbering of the pieces was of interest as far as any scoring or strength calculating thats done to decide upon the most suitable move to perform. Mine are simply numbered 1-6 (actually 2/3, 4/5, 6/7, 8/9, A/B, C/D when their Black or White identifier bit is added in) which is very very for indexing graphics data. Doesn't have to be, and they could be in any order actually.

I did begin to look at the possibility of a simple interpreter to scan through your board and piece format and display it using my 3D engine. You use a 128 byte board, whereas mine is 64 bytes. I can quite easily adapt to the larger format, which is easier to use for various legal move checks. Only adds about 5 bytes.

I'm now at the point where for my own sanity I need to save the final 2 bytes just to give me that satisfying 512 bytes total size. 1 disk sector!

Once thats done and I've fixed the board setting/ resetting routine, then it will be in its final release state. Then development and integration of the GUI aspects can be done, tested and finalised so that I can then move onto the game logic, some of which follows a similar route that you've taken evidently.

I'll be interested to see how you achieve castling, as I've not figured that one out yet.

Keep up the great development, really impressive effort!
0 x

User avatar
arkannoyed
Manic Miner
Posts: 350
Joined: Mon Feb 05, 2018 9:56 am

Re: 3D Chess 2K18

Post by arkannoyed » Mon Apr 29, 2019 9:12 am

I think you would get a lot of interest in a thread detailing Chesskelet. Chess still remains a fascinating subject in terms of programming etc.

If you do want to delve deeper into the 3D display routines, then I'm happy to send you the source, though I've posted it earlier in this thread. It has changed a bit since though.
0 x

Post Reply