3D Chess 2K18

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Well, I've put a good few hours into trying to shave off more bytes in the past 2 weeks, but despite several useful optimisations and slight speed improvements, I've only managed to save one lonesome byte!

I'm working on several areas to try and just squeeze out anything that's wasted, but its become almost impossible.

Now at 584 bytes :?
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: 3D Chess 2K18

Post by Pegaz »

Well, maybe it's time to think about installing a engine. :)
That would be a complete masterpiece...
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Not yet, I've still to lose -33 bytes. If I put the board initialising routine and data aside, that loses -39 bytes, so 584 - 39 =545

545 - 33 = 512 bytes!

Thats the goal!
User avatar
Pegaz
Dynamite Dan
Posts: 1209
Joined: Mon Nov 13, 2017 1:44 pm

Re: 3D Chess 2K18

Post by Pegaz »

This is a worthy goal.
You obviously intended to overthrow the famous zx81 1k chess in terms of optimization and far better board, ofc. ;)
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Absolutely! I'm pretty sure ZX81 chess was 672 bytes actually, but though it displays little more than a bunch of letters representing the pieces, it does do a decent job at playing the game. I've studies the Disassembly at length for pointers!

If I can achieve something in 1k I'd be quite happy.
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Getting nearer!

With some flashes of brilliance (maybe overstating a bit!) I've managed to quite easily save another 2 bytes that have long been annoying me!

Only 31 to go! Now at 582 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 »

Its all about the loops!

Saved another 2 bytes by collecting bytes recursively via a loop. Looks messy, but what the hell! :lol:

Now at 580 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 »

Just when you though it was safe to look away.......another 4 bytes disappear!!! And a little bonus one too with a 2 byte jump

Now only 575 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 »

Proof that it does still work!

Image
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

...And with some cheeky byte sharing I've saved another byte

574 now!
Bizzley
Microbot
Posts: 124
Joined: Thu Nov 16, 2017 10:47 am

Re: 3D Chess 2K18

Post by Bizzley »

arkannoyed wrote: Thu Feb 07, 2019 9:11 am Proof that it does still work!

Image
Sometimes you get so wrapped up in the coding that you fail to see the bigger picture. Can you spot what's wrong here :?:
"He made eloquent speeches to an audience consisting of a few depressed daffodil roots, and sometimes the cat from next door."
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: 3D Chess 2K18

Post by Einar Saukas »

White queen and king starting at wrong position.
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, work in progress, it will be sorted!!
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Fridays are always good for optimizing code!

Now 568 bytes :o
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Finally re-written the other main line building algorithm and managed to save another 4 valuable bytes.

Possibly uninteresting, but now down to 564 bytes

Technically now only -13 to go!
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 »

Rewrite it into checkers. :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
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Ast A. Moore wrote: Thu Feb 14, 2019 3:24 pm Rewrite it into checkers. :lol:
Genius! 256 bytes easy!
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

...And -1 more byte 8-)

Now 563 bytes -12 to go
Bizzley
Microbot
Posts: 124
Joined: Thu Nov 16, 2017 10:47 am

Re: 3D Chess 2K18

Post by Bizzley »

arkannoyed wrote: Thu Feb 14, 2019 4:40 pm ...And -1 more byte 8-)

Now 563 bytes -12 to go
Does that include a fix for the incorrect start positions?
"He made eloquent speeches to an audience consisting of a few depressed daffodil roots, and sometimes the cat from next door."
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 positioning is merely the way the board initialising routine works, in its current state, incorrectly. The board can be set to display anything manually. Once all the other optimising is done, I’ll work on that separately. As the bytes have continued to fall away, it became apparent that to achieve the goal of sub 512 bytes, the initialisation routine can’t be counted in that, otherwise I’ve still got to shift 51 bytes, which I seriously doubt possible. Even now, to achieve it I need to make a few careful graphical tweaks, as saving another 12 bytes from the routines is highly unlikely.

I do have a final idea waiting in the wings to try out, and if I can make it work, and if the decoding isn’t too heavy, then it could save probably -40 bytes from the graphics data. That’s still in the planning stage, but fortunately the code structure would allow for it to integrate without too much hassle.

When I rewrite the board initialiser it will hopefully be no more than the 39 bytes it is now. One reason for leaving it be for the moment is that other factors elsewhere might affect how it needs to operate. Once they’re finalised, then it can have some attention.

I promise I’ll post some properly commented source soon too!
User avatar
arkannoyed
Manic Miner
Posts: 435
Joined: Mon Feb 05, 2018 9:56 am
Location: Northamptonshire

Re: 3D Chess 2K18

Post by arkannoyed »

Ast A. Moore wrote: Thu Feb 14, 2019 3:24 pm Rewrite it into checkers. :lol:
On a serious note, it could be done easily, just new gfx data and a suitable board initialising routine. Graphics currently 256 bytes, so probably possible in around 45-50 bytes max, total size no more than 350!
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: Thu Feb 14, 2019 6:30 pm
Ast A. Moore wrote: Thu Feb 14, 2019 3:24 pm Rewrite it into checkers. :lol:
On a serious note, it could be done easily, just new gfx data and a suitable board initialising routine. Graphics currently 256 bytes, so probably possible in around 45-50 bytes max, total size no more than 350!
Are you willing to put your bytes where your mouth is? ;)
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 »

You design the gfx then?! No more than 22 bits wide though! Then I’ll encode it.
Last edited by arkannoyed on Thu Feb 14, 2019 7:04 pm, 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 »

Or rip off the ones from draughts genius, even easier!
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: Thu Feb 14, 2019 7:04 pm Or rip off the ones from draughts genius, even easier!
I have a better idea: to rip off the base of your chess pieces.
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.
Post Reply