3D Chess 2K18

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
Einar Saukas
Manic Miner
Posts: 758
Joined: Wed Nov 15, 2017 2:48 pm

Re: 3D Chess 2K18

Post by Einar Saukas » Fri May 03, 2019 11:04 am

arkannoyed wrote:
Fri May 03, 2019 7:37 am
I don't understand entirely what its doing?
The first loop sets white pawns. The other white pieces were already set using DEFB. The second loop copies pieces white to black, then finally there's an explicit LD to switch King and Queen positions.

The initialization only works once, and it's assuming that any position not explicitly assigned will be zero. But under these assumptions, why not simply use DEFB to set all 32 pieces, thus only requiring 32 bytes?
1 x

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

Re: 3D Chess 2K18

Post by arkannoyed » Fri May 03, 2019 11:20 am

A DEFB is all ok from an assembler point of view for a one off game, but to copy 32 bytes of data and clearing the board would still be bigger. As its going to be replayable, it needs a board reset routine.
0 x

User avatar
Einar Saukas
Manic Miner
Posts: 758
Joined: Wed Nov 15, 2017 2:48 pm

Re: 3D Chess 2K18

Post by Einar Saukas » Fri May 03, 2019 11:51 am

arkannoyed wrote:
Fri May 03, 2019 11:20 am
A DEFB is all ok from an assembler point of view for a one off game, but to copy 32 bytes of data and clearing the board would still be bigger. As its going to be replayable, it needs a board reset routine.
I know.

I was suggesting DEFB for chesSkelet only, since it doesn't clear the board and it's not replayable.
0 x

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

Re: 3D Chess 2K18

Post by arkannoyed » Fri May 03, 2019 1:21 pm

Oh I see, sorry!

We we're just discussing the possibility of making it replayable, perhaps in one of the larger fuller versions, and whether some sort of board setting/ resetting routine could work for both of us.
0 x

llewelyn
Dizzy
Posts: 55
Joined: Thu Feb 22, 2018 3:27 pm
Location: virginias eastern shore

Re: 3D Chess 2K18

Post by llewelyn » Fri May 03, 2019 2:14 pm

[/quote]


It was more a jab at the idiocy of the zack4mac's assessment of the state of PC software.
[/quote]

Hey Dunny? Please excuse my probable idiocy but why did you say zack4mac's comment about the state of PC software was idiotic?

I'm constantly annoyed by bloatware. The difference in functionality versus size came up yesterday when I went looking for an RTF to HTML conversion utility. Some of them were several megs in size, the one I eventually chose was around 700k and works just fine (not sure if I got that size right but there was a huge difference between the various examples)
0 x
tempus fugit

User avatar
ZXDunny
Microbot
Posts: 189
Joined: Tue Nov 14, 2017 3:45 pm

Re: 3D Chess 2K18

Post by ZXDunny » Fri May 03, 2019 2:33 pm

llewelyn wrote:
Fri May 03, 2019 2:14 pm
Hey Dunny? Please excuse my probable idiocy but why did you say zack4mac's comment about the state of PC software was idiotic?

I'm constantly annoyed by bloatware. The difference in functionality versus size came up yesterday when I went looking for an RTF to HTML conversion utility. Some of them were several megs in size, the one I eventually chose was around 700k and works just fine (not sure if I got that size right but there was a huge difference between the various examples)
There is a prevailing view that PC software is becoming bloated which, although true to an extent, is not as due to poor programming as you might think. Spectrums use 1Bpp graphics, beeper or AY code to produce sound etc - none of which is really viable on a PC as things are these days. 32Bpp graphics, high resolution textures, intricate control routines for moveable objects (such as enemies etc) and enormous, detailed level designs not to mention the fact the nearly everything is now 3D accounts for most of the bloat in games these days.

Poor programming (or at least a poor choice of tools) does have an impact - your RTF->HTML converters could probably done in raw C in just a couple of Kb - if you don't want to handle things like Unicode, and only a small subset of the RTF standard for example. Add to this that the author might be using a scripted language with included runtime libraries embedded means that you quickly bloat to MBs. Of course a 32bit architecture may mean a 4x bloat in code size alone, double that for 64bit possibly. So 700Kb is considered a pretty light application nowadays.

As a quick example, take my own SpecBAS. The executable is 16MB in size! But that's including the interpreter, the editor, all the runtime code for the myriad routines you might or might use. And then there's debug information. Without the debug info, it's 5MB. And it ain't gonna be any smaller. Why? Despite looking retro, SpecBAS runs 32bpp graphics with alpha blending and is not hardware accelerated aside from actually getting the graphics on the screen. The default font is 64KB as opposed to the same font occupying 767 bytes on the Speccy - the font is 32bit. There's masses of tables used to get things done quicker than you could on a Speccy. And of course, it's a win32/64 executable built with a modern compiler so there's runtime support libs built-in.

I'd love to get things down to less than a meg, but it's not gonna happen. And never will anymore, aside from demo coding contests where really small stuff can be built but is useless for anything other than showing off an effect.

I might have been a tad insulting back there, but you tend to get really tired of these people that can't code on modern platforms complaining that all their bytes have gone missing and you could do so much more with 16Kb back then.

Now back to your scheduled chess shenanigans.
4 x

User avatar
Einar Saukas
Manic Miner
Posts: 758
Joined: Wed Nov 15, 2017 2:48 pm

Re: 3D Chess 2K18

Post by Einar Saukas » Fri May 03, 2019 4:38 pm

On another subject...

The classic 1K Chess by David Horne was never intended to be the SMALLEST POSSIBLE chess. It was the opposite. The author was trying to PUT AS MUCH CONTENT AS POSSIBLE (full chess rules, good AI, etc) within the memory limitations of the original 1K ZX81.

David Horne wasn't saving bytes to make his program smaller. He was doing it so he could have enough room to improve AI logic, for instance.

Nowadays there are several even smaller chess programs (I mentioned a few here at the time). They are all certainly impressive, but their AI is typically so bad they are not fun to play.

Your 3D chess will never be smaller than those existing 2D versions anyway. Therefore I see no point in just adding a simplistic AI to the code you already have. Instead, I suggest your goal should be achieving the BEST POSSIBLE chess game in exactly 1K. Which means supporting 100% of chess rules, and the smartest possible AI you can fit.

It seems both chesSkelet and David Horne's 1K chess play better than others. I would first play a few rounds between them to compare AIs, then use the best players as starting point to implement yours...
4 x

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

Re: 3D Chess 2K18

Post by arkannoyed » Sat May 04, 2019 8:42 am

I agree regarding the 1k issue. I’ve exactly 513 bytes left to play with and intend using them all. Even when it gets to the point where it works well, if it’s left any spare space then I’ll unroll some of the key routines to get better speed. Some interesting tests were performed yesterday to try different methods of updating the display. Moving forwards from the tiny version, the game variant will require the board to be built in a buffer at C000h and then copied to the screen. This will give more fluid animation. I used block clear and copy routines that just update the 2 squares that are being swapped (piece moved from to etc). This gave much better results than straight full buffer copy and actually wasn’t much bigger to do. Once all of the shared routines are removed from the main display code then I think the result should still achieve good speed. Doesn’t sound fast but 2 frames per second is achievable. After all, Chess isn’t generally considered to be a fast game! Once these routines are all in, then I’ll re-integrate some of the GUI elements and optimise them.
2 x

DarkTrancer
Berk
Posts: 8
Joined: Mon Jan 22, 2018 5:48 am

Re: 3D Chess 2K18

Post by DarkTrancer » Sat May 04, 2019 9:22 am

Been reading your posts since the beginning because i found the optimisation interesting,did not understand it all but did enjoy reading.
Can't wait for a release so can play it and appreciate it. 8-)
1 x

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

Re: 3D Chess 2K18

Post by arkannoyed » Sat May 04, 2019 10:03 am

One day, and hopefully it’ll live up to expectations!

As I’ve said before, if any aspect of the system or the mechanics of it is of particular interest and you want to know more, just ask. I’m always happy to expand upon anything. A good example is that when I posted the breakdown of the source here, I then spotted a few improvements. Sometimes examining or explaining a system in more detail bears fruit!
1 x

Post Reply