3D Chess 2K18

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
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 »

Hey, buddy, as a programmer myself, I know how you feel. I too have struggled with making a decision that would neat up the code at the expense of the game itself. One way of avoiding that trap is to move onto another aspect of the code, which is, in your case, the actual game logic. When you have the game basically finished, you can get back to fine tuning the graphics, drawing routines, et cetera. I know I’m stating the obvious, but it’s easy to forget those things when you’re deep inside the coding world.

Also, the white knight looks like a camel now. :lol:
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
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: 3D Chess 2K18

Post by Pegaz »

@Bizzley

I hope you stay on this topic, because I think your approach is more than constructive.
This project is one of the most exciting things on the Spectrum scene for a long time and I'm always looking forward to every new post.
As a chess fan (not as a programmer), I can only say that I really enjoy this discussion.
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: 3D Chess 2K18

Post by Einar Saukas »

If you are still enjoying the challenge of reducing code size, by all means keep doing it! This is a hobby, not a commercial project, so you don't have to make sacrifices to meet a deadline.

However I must confess I also prefer the old design with larger pieces. I don't think it's worth it to gain a few bytes, if it makes the board look less impressive.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Thanks for the support. I'm not sure its the most impressive thing out there, but I do enjoy seeing it develop and on a personal level, finding new ways to approach a problem and do it more efficiently/ faster is always pleasing.

I've added a line, so they're currently only 1 line shorter than before and only 1 byte less;

Image

I think the bases look more balanced, not as heavy as before. They're only 2 px narrower too. Remember, the graphics are a result of a very restricted set of parameters. Only a finite amount of possibilities exist for their design really, so you I have to be creative, otherwise, they could look a lot nicer. Take the top of the bishop for example. A long time ago, he looked much nicer. Now its a bit odd really. But that might change soon.

From a coding point of view and to improve the eventual experience there are 2 key areas I'm working on before I'll be happy to leave it and move to the next stage.
1. The board printing. That is bit-wise. Needs to be byte-wise to speed it up. Efforts so far have not managed to get close to the 39 bytes it currently takes up. I think 46 is my best effort so far.

2. Printing of the Left side of the pieces is also still bit-wise, as the buffer is mirrored due to restrictions in the way its formed. To flip it, auto mask and print is no easy task and currently happens in 23 bytes. I do have a version that is faster but is 24 bytes. Needs more work and a new approach.

So, when both those aspects have been addressed, then the speed should be good enough to achieve some better gameplay results. A GUI has to be responsive, and even though its small size doesn't allow for all bells and whistles, there has to be a satisfactory feel to it for me to be happy.

I'm glad I never worked in the software industry, I'm too picky to be any use to anyone! :lol:
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 »

The bases definitely look better now.
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 to hear. The idea wasn't actually to make the whole thing smaller, but to give a better feeling of separation between the bases to give a less cluttered look. When the square selection process happens, hopefully that will give a clearer view of whats going on.

Shall I stick with these as they are then? How about the tops of the Bishop? The much earlier version looked much nicer. I just don't want to add a load to the size thats all. There is a graphics encoding alteration possibly happening, which might allow a small size reduction though.
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 »

The bishop looks fine to me. The top of the rook is a little weird. Some of the battlement ridges look too spiky. And the white knight’s mouth still looks a little cartoony. The black knight looks okay.
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 »

The difficulty is that the White and Black are in many cases variations, or mirrored inversions of one another. I am of course perfectly happy to consider encoding any suggestions to see how they look. The Knights are the biggest pain of all the pieces as they're not symmetrical. They are the reason that printing is a longer process than it perhaps needs to be. But if you try to design one thats symmetrical, they look very odd. Thats part of the fun/ frustration of the process, trying to code around these restrictions.

The head of the Knight almost needs to be wider, bigger to be a more impressive grand piece.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Does this work as a compromise? Gets us down to 494 bytes if so.

Image
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: 3D Chess 2K18

Post by Pegaz »

I think it looks better now than ever, I really like it and I think you found the right balance.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Great, I agree. I'm feeling happier with them now. Just trying to address a few other issues, like the Cartoon-ish mouth of the Knight amongst other things. Might be able to save a little more. The Sprite data is incredibly now just 200 bytes

Upon conception, the very first version of the sprite data had masks, whereas they're auto calculated here, but they were exactly 4000 bytes. So currently they're only 5% of the original size.
User avatar
Kweepa
Manic Miner
Posts: 311
Joined: Sat Feb 03, 2018 6:14 pm
Location: Albuquerque, New Mexico

Re: 3D Chess 2K18

Post by Kweepa »

I think the problem with the knight is it looks like she's tilting her head way over.
I tried a paintover, where I moved the eye, add a bit more brow, added a nostril instead of a mouth, and added an ear.
It might be a little too cartoony though...
Image
User avatar
Turtle_Quality
Manic Miner
Posts: 502
Joined: Fri Dec 07, 2018 10:19 pm

Re: 3D Chess 2K18

Post by Turtle_Quality »

The set looks great and it's amazingly efficient, but... some of the pieces are obscured - basically the white pawns behind the white king and king's bishop, which might make it difficult to play. Options, in descending order of difficulty

1) A different angle of rotation of the board instead of 45 degrees
2) Thinner pieces, maybe offset the pawns a little to the right
3) An in game option to switch view by 180 degrees
4) Ignore me
Definition of loop : see loop
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Rotation is included
User avatar
DouglasReynholm
Manic Miner
Posts: 347
Joined: Wed Feb 20, 2019 8:38 pm

Re: 3D Chess 2K18

Post by DouglasReynholm »

Should the white knights (Edit: and the black bishops) be flipped to be 'facing' their opponents? I.e. 'into' the board?
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Yes, as discussed before, this is an issue with the board initialising routine. That will be eventually resolved.

I am in the process of redesigning the knight head, it is a tricky one, as several factors have to be considered to be able to achieve a small data set. The current iteration top part is about 72 bytes. The redesign is 98, and though it looks nice, that’s too big, so I’m fettling it.

There are situations where pieces are obscured, and for that reason, the game version will have a rotate feature. It’s actually not that hard to implement. There are two ways to achieve it.

1. Using a small 20 byte routine to rotate the board data and change one byte in the display engine to print the alternate squares of the board.

2. Read the board data in a different order which involves uncoupling the routine from its current read loop. This method is actually more efficient.

Some indication needs to be added to point to which is the current view orientation. Compass or similar I suppose.
I’ve deliberately not tried to gain any insight from other chess games so that I’m not influenced in a particular direction.
Last edited by arkannoyed on Sat Mar 09, 2019 8:33 am, edited 1 time in total.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Image

In progress musings. For the knights, see on the right.
Last edited by arkannoyed on Sat Mar 09, 2019 7:55 am, edited 1 time in total.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

DouglasReynholm wrote: Sat Mar 09, 2019 2:17 am Should the white knights (Edit: and the black bishops) be flipped to be 'facing' their opponents? I.e. 'into' the board?
To have facing pieces would be nice. Possible with the bishops, but not with the knights. The graphics format and the current piece design won’t allow it. If the piece was reduced in width to 16 bits then it could happen.

Having said that, my early morning brain has just thought of an obscure work around that could be implemented so that it could be done. It would be a small routine placed carefully to check the current piece and do a simple buffer swap if needed.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

DouglasReynholm wrote: Sat Mar 09, 2019 2:17 am Should the white knights (Edit: and the black bishops) be flipped to be 'facing' their opponents? I.e. 'into' the board?
I have a very quick and dirty fix in 10 bytes to take care of reversing the head of the White Knight so he faces towards the opposition. The problem is, that if its the case that they always need to face inwards, then we'd need 2 versions of the sprite data and logic to pick the appropriate one.

Would it be good enough to have the Knights and Bishops heads just facing the other way to its opposing piece?

If so, then it can be implemented maybe in a branched version, or the eventual game version at the expense of only a few bytes.
User avatar
DouglasReynholm
Manic Miner
Posts: 347
Joined: Wed Feb 20, 2019 8:38 pm

Re: 3D Chess 2K18

Post by DouglasReynholm »

arkannoyed wrote: Mon Mar 11, 2019 9:49 am
DouglasReynholm wrote: Sat Mar 09, 2019 2:17 am Should the white knights (Edit: and the black bishops) be flipped to be 'facing' their opponents? I.e. 'into' the board?
I have a very quick and dirty fix in 10 bytes to take care of reversing the head of the White Knight so he faces towards the opposition. The problem is, that if its the case that they always need to face inwards, then we'd need 2 versions of the sprite data and logic to pick the appropriate one.

Would it be good enough to have the Knights and Bishops heads just facing the other way to its opposing piece?

If so, then it can be implemented maybe in a branched version, or the eventual game version at the expense of only a few bytes.
Oh dear I feel like I've lit the touchpaper and run off.. I mean it is only an aesthetic decision really isn't it, secondary to the quality of game it plays.. I should think out loud less. If the size of the code is still a priority then maybe leave as-is, but as ever seeing you think about solutions is also entertaining.
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 like input. If there are ideas that need to be tried, then I'm always happy to have a go. In the case of the reversed facing, it was something I thought about a long time ago, but dismissed it as it looked at the time to be too difficult to implement. However, now the code is far friendlier it seems to be quite easy to put in at only the expense of a few bytes. If it improved the aesthetics of the game then I'm sure it could eventually make an appearance. In fact, if I get several other things working too and smaller then I might leave it in just to make it look more natural, less like its procedural if that makes sense.

Just trying to get the squares to draw byte-wise. The existing routine is 23 bytes with 16 to calculate the line length at a given height position up the square. Currently it basically has to draw 1.5 lines as it starts at the centre and works its way left to find the end, then doubles the counter to fill all the pixels going right.

Not very fast, but then again, not bad. But to do it byte-wise is more complex and so far I've only got down to 29 bytes. It does make building the populated board happen 0.1 seconds faster though.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Development of several User Interface options are well underway. Options include;

1. Piece selection is shown by the piece being raised as its selected. Now the whole thing runs much faster, its not too bad actually.
1a.Then, once Enter is pressed, the square to move to is selected by pressing Space. Basic legality of selection is currently nearly working as far as allowing movement to an empty square, or that of an opposing piece. The square currently selected is greyed out (AA/55 mask)

2. Piece selection is indicated by an arrow above the 'head' of the piece, movable with space and selectable with Enter.
2a. Then, again, the target square is greyed out until selected.

3. The piece selected is masked to give a shaded look. This doesn't always look very pleasing to the eye as it sometimes interferes with the automasking functionality.
3a. Same square selection as above.

Basic algorithmic checking of moves available is under development. This would involve the selected piece being given all the move options available to it by them being shown as greyed squares that can be scrolled through (flashing on/off when selected).

This approach might be better to run with, as then legal move checking is just done per piece once its selected and shouldn't take too long in processor terms.

Once the many bugs and irritations are ironed out a bit, I'll post some sort of Demos of the various systems possible.

Any further suggestions kindly welcomed. :shock:

Oh, and as per an earlier suggestion, the Knight and Bishop opposing pieces will face inwards, towards one another. Unfortunately, they won't face each other if they move to the opposite side they started from, as that would need extra sprite data, which there won't be room for I don't think.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

This is using the arrow above head method. Not optimised, so a bit slower than possible, but gives an idea. The arrow could go bigger.

Image
redballoon
Manic Miner
Posts: 390
Joined: Sun Nov 12, 2017 3:54 pm

Re: 3D Chess 2K18

Post by redballoon »

The problem using that arrow at its current size is the difficulty in seeing it when it’s above the front row as it gets lost against the back row. I’d try a bigger sized arrow and maybe even a thicker outline.
User avatar
Ersh
Manic Miner
Posts: 480
Joined: Mon Nov 13, 2017 1:06 pm

Re: 3D Chess 2K18

Post by Ersh »

Yeah, it's a bit small. I'd try to forgo masking all together and simply have a slightly bigger rectangle with the arrow inside.
Post Reply