3D Chess 2K18

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: 3D Chess 2K18

Post by ZXDunny »

Actually, that doesn't look half bad.
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 know right?! Maybe he’s onto something! Option maybe?
Shouldn’t be too hard to implement, as it’s only masking and can be swapped by changing 1 byte.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

As far as general use is concerned, is it safe to use the R register? i.e. if I'm utilising it to store BIT 7, which in R remains unchanged as far as I can see, would that interfere with anything like attached peripherals that I'm not aware of?
User avatar
Metalbrain
Microbot
Posts: 107
Joined: Thu Feb 15, 2018 2:14 pm

Re: 3D Chess 2K18

Post by Metalbrain »

AFAIK bit 7 of register R is perfectly safe to be used. Jonathan Smith (aka Joffa) did use it as a flag in several of his games.
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: Mon May 13, 2019 3:54 pm As far as general use is concerned, is it safe to use the R register? i.e. if I'm utilising it to store BIT 7, which in R remains unchanged as far as I can see, would that interfere with anything like attached peripherals that I'm not aware of?
Perfectly safe. Go ahead.
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 »

Good, shame its a 2 byte instruction though! :x

I've utilised it to hold the status of the current square being printed to set the mask that shades it or leaves Black etc. The whole process has added 21 bytes to the routine, however it works nicely and with no messy writes to memory addresses as was the case in the earlier attempts.

Now to make a final decision as to whether the piece selected to move will raise up or have a great big arrow pointing at it. Not really much in it in terms of size to graft into the routine, probably slightly less for making the piece float in the air.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Amazing how quickly all this extra stuff eats into the spare bytes. Whereas there was 520 available, thats already dropped to 434 now that all of the visual extras are in. That might improve a little once I've tweeked a few things though.
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: Mon May 13, 2019 3:54 pm As far as general use is concerned, is it safe to use the R register? i.e. if I'm utilising it to store BIT 7, which in R remains unchanged as far as I can see, would that interfere with anything like attached peripherals that I'm not aware of?
There's nothing wrong with using the full register either (if you don't write to it too much). If there are no interrupt routines running and you've run out of registers, it's sometimes possible to use R as an automatically incrementing loop counter.
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 have experimented in the past using it as a counter, but I've no need to use it for anything cleaver in this production at the moment.

I could perhaps use the EXX set for something, but to save them all (or whichever I need to use) would be a bigger overhead.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Isn't it great when you change something that you think will have the desired effect, but then it turns out to achieve something quite different and unexpected. I added 3 bytes to try and alternate the squares select bit so that they showed grey, however this happened, which looks amazingly effective!

Image
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...
Post Reply