3D Chess 2K18

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: 3D Chess 2K18

Post by djnzx48 »

That's pretty cool. How does it look with the ULA colour ramping thing enabled?
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Do you mean the one from our friend d2010?

He'd probably get quite excited by all that shading going on! :lol:

I'm not sure its entirely practical as a workable option, but certainly a surprise as I still can't entirely figure out why its doing it :oops:

Oh, and by the way, the White pawn at the Left most end of the line is raised as its the selected piece. I have changed from 8 lines in that example to 16 lines as it gives a much clearer indication of whats selected.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: 3D Chess 2K18

Post by Ast A. Moore »

arkannoyed wrote: Wed May 15, 2019 10:00 am which looks amazingly effective!
Hmm. I’m not sure about this. It’s too fuzzy and distracting. :? I’d stick with the good-old black and white.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Oh I will be sticking with the traditional simple look, but if space allows, there may be options available if they're simple enough to add into it. The more functionality available, the more impressive it'll look hopefully.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: 3D Chess 2K18

Post by djnzx48 »

arkannoyed wrote: Wed May 15, 2019 10:18 am Do you mean the one from our friend d2010?
Well no, I was referring to this: https://www.worldofspectrum.org/forums/ ... ce-demo/p1

Transitions between colours (especially black and white) look different on a real machine than on some emulators due to stuff going on in the ULA. I was just wondering whether this example would be particularly affected due to the stippling. Did you figure out what was causing it?

Some kind of textured board would be interesting, if there were enough spare bytes left over. Maybe some shading at the corners of the squares near one end of the board. And a border like in your original design would be very nice.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Aaah, I see what you meant now. I've no real hardware readily available to test it on and no CRT TV anymore, but looks great on an Emulator!

If there was sufficient memory available, then any number of options for squares shading might be possible, but anything I might be able to add would have to be a simple addition to the masking code. I've a better idea now of what caused it, but its still a nice effect for the addition of just 3 bytes! :lol:

The shaded squares are controlled by a bit being set (currently BIT 7) of the board square. The contents of that square are stored in the R register, as that can hold BIT 7 continuously without being corrupted. if the square is solid black, then BIT 7 of R must be '0' and the subsequent test of the current square number must give a result that its a Black square (BITs 0 and 3 control this). If its a shaded square then the mask is set to 55h but inverted to AAh according to the flip-flop of BIT 0 of the line counter. Sounds complicated perhaps, but actually its fairly low level.

the strange shading happened when I attempted inverting BIT 7 of R, which was intended to make the square turn on/off, sort of flashing. However, the process needed to be done after each completion of the routine to make it work, whereas in a moment of early morning stupidity I plonked an inversion after each line pass.....I'll get my coat! :lol:
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: 3D Chess 2K18

Post by Pegaz »

arkannoyed wrote: Wed May 15, 2019 11:12 am Aaah, I see what you meant now. I've no real hardware readily available to test it on and no CRT TV anymore, but looks great on an Emulator!
Yes, you can test this ULA behavior with SpecEmu, which fully supports it, as well as some version of Spin.
In SpecEmu, you must enable Ula Artefact in the Display Option menu and you can see this four shades effects.
This old topic is very interesting to read.
As you can see, some didnt even believe that it was really possible on Spectrum, but Woody did a great job and managed to implement that ULA quirk into SpecEmu in just a few days. :)
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

I'm trying to decide upon the best balance between total direct access, i.e. with some sort of mouse type pointer, or cycling through the pieces as I've demonstrated before. Both seem to eat up memory, but they have to be in there to make it work. Heres a quick example of in progress, which uses Space to choose the piece, with Enter to select. Then followed by the same keys to choose the square to move to, which when the legal move checking is in there will likely show the available squares to move to and let you cycle through them with Space, then select with Enter. Not lightening quick by any means, but there are key areas in the routine that if space allows can be speeded up a fair bit.

Image
KayBee
Drutt
Posts: 17
Joined: Thu May 31, 2018 3:14 pm

Re: 3D Chess 2K18

Post by KayBee »

Image

On my chess device, I use 2 arrow keys to select the piece, which is more flexible than a single key for cycling. So, I suggest the 5 and 8 keys. I also have a pleasant -click- sound via small speaker.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Mmmmmmmm maybe, and a click might enhance things.
KayBee
Drutt
Posts: 17
Joined: Thu May 31, 2018 3:14 pm

Re: 3D Chess 2K18

Post by KayBee »

In my opinion, you have some up with something special here, it is impressive immediately, regardless of size. If I could wish for one feature it would be to have a mode whereby you get to see the moves it is considering and rejecting. 1k chess for the ZX-81 does this. It is a fascinating thing to watch.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Possibly a feature that could be optional. That’s actually not very difficult to implement, but could be a long process when a lot of moves are possible. Move generation is completely separate to the display and piece building part.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Afternoon all!

Been a while, but whilst I’ve a few days off I thought I’d try out a couple of ideas. However, as I was refreshing everything in my brain, I managed to save another byte on the display engine. Bit boring maybe, but it is now 503 bytes.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

A coming together and shifting about of two other key routines (might) give the possibility of saving one or perhaps two more bytes too. More time tomorrow, so I’ll get my abstract thinking cap on. Sometimes it’s a case of looking at how things work from a different point of view, so as to figure out the clever methods. That’s why humans will always triumph over machines...even a Speccy!!! :D
User avatar
hitm4n
Manic Miner
Posts: 604
Joined: Fri Nov 17, 2017 12:56 pm

Re: 3D Chess 2K18

Post by hitm4n »

I think theres still some mystical wizardry going on here...
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
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: 3D Chess 2K18

Post by Pegaz »

Totally agree.
If this great piece of code gets its equally compact chess engine, it will be one of the biggest events in the Spectrum homebrew scene in the last couple of decades.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Very kind of you to say so :) I’ve been in awe of Alex’s ChessKelet development for a while now. In fact, what he’s achieved way outshines my efforts, but remains a massive inspiration and guiding light for my future developments. The reason I keep on with the squashing of C2k18 is that as I find ways to implement the logic for the playing part, I sometimes have to alter the display code. That sometimes gives rise to new ideas and ways of achieving the same end, thus saving the odd byte here and there. I’m sure the core display engine will creep down towards -500 bytes eventually. Only 3 bytes to go!!!! The more saved there leaves more for the game and gui which has to all cram into -1k.
User avatar
uglifruit
Manic Miner
Posts: 700
Joined: Thu Jan 17, 2019 12:41 pm
Location: Leicester
Contact:

Re: 3D Chess 2K18

Post by uglifruit »

I'm amazed by what you've achieved here. When the whole finished thing eventually clocks in at less than 1k, you should hold off on releasing it until you've made another 40 odd similarly amazingly small games that can all be loaded at once, with a front end to choose them. By my calculation it might be ready by the year 2100. ;)
CLEAR 23855
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

2100 is pushing it a bit. Chess has taken since about 1993 to get to where it currently is :D
I did adapt the routines that draw the chess board (well, the addressing part anyway) to be used as an isometric room builder, with a compressed block printing routine. That would allow for an isometric game in less than 1k.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Quick question that someone might be able to answer for me, as I’m not in the vicinity of a speccy or emulator to test. When calling a routine from basic (rand usr etc) does using the alternative registers set (exx) cause issues upon the RET? Would the always need to be pushed prior to messing with and obviously have interrupts disabled?
User avatar
uglifruit
Manic Miner
Posts: 700
Joined: Thu Jan 17, 2019 12:41 pm
Location: Leicester
Contact:

Re: 3D Chess 2K18

Post by uglifruit »

The epic program I've just compiled:

DI
EXX
EI
RET

causes a hang on return to basic.

If that helps at all.

Edit:
DI
EXX
Ld hl, bc, de, a with some arbitrary numbers
EXX
EI
RET

Gave me a "c nonsense in basic" but did return
CLEAR 23855
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: 3D Chess 2K18

Post by Ast A. Moore »

Yes. You need to save HL’ and restore it before returning to BASIC.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Just HL’ ?
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: 3D Chess 2K18

Post by Ast A. Moore »

Well, IY, too, obviously, since it holds the base address for all the system variables. But as far as prime registers are concerned, yes, just HL’.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

No need to worry about iy. But being able to use one of the alternative register pairs for addressing instead of Ix may give the possibility of saving a few bytes.
Post Reply