Silver Chess - My first LOVE game!

Show off your games, demos and other (playable) creations.
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Silver Chess - My first LOVE game!

Post by Sir_Silver »

ivan wrote:Having a different Lua "object" for each piece is just not a good approach,
it's possible to make something like that work, but it's going to be a memory hog at best.
Can you please go into detail as to why this is a bad idea? I'm not sure what your expertise is, or if you're familiar with metatables, but all of the methods associated with each of my pieces is stored on it's respective metatable, and not the object itself. If you print out the contents of one of my pieces, say, that pawn on a2 you will see the following:

Code: Select all

	for k, v in pairs(board[1][2]:GetPiece()) do
		print(k, v)
	end
	
	square	table: 0x005ee520
	color	 white
That is the extent of the object, there are 32 of these piece objects on the board at most at any one time, I don't understand why you think this is a "memory hog at best".
ivan wrote:Less code and it can generate all legal moves (both "to" and "from" any square).
Except that, in the latest version that I downloaded from your post, it doesn't seem to support castling, which, by the way, is a move.
https://en.wikipedia.org/wiki/Castling

Forgive me if I sound defensive, it's because I am. I don't see the legitimacy to some of the claims you made about how this game is unfinished and "a good start" when, aside from A.I., is actually more feature complete than the version you tried to suggest that I look at. :ehem:

All-in-all, I am actively working on, albeit, minor optimizations - I'm not gonna completely rewrite this game - to the drawing and other parts which would greatly benefit from optimization. Other new features to be added are actively in the works also, which will be showcased as soon as possible.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Silver Chess - My first LOVE game!

Post by ivan »

Sir_Silver wrote:I don't understand how this pertains to the game, code, or performance at all. I load up an image one time, which is 25 KBs in size, and then create quads based on the image and store those, again, one time to be used for drawing.
Ah, I meant PGN as in Portable Game Notation, not PNG, the image format!
Sir_Silver wrote:Can you please go into detail as to why this is a bad idea? I'm not sure what your expertise is,
I'm not sure either! :)
Sir_Silver wrote:That is the extent of the object, there are 32 of these piece objects on the board at most at any one time, I don't understand why you think this is a "memory hog at best".
I suppose it's a matter of opinion, but I don't believe in using short-lived tables in Lua.
Creating a few tables per frame is fine, but you want your move validation to crunch thousands of moves per second.
Let's say you want to search for a given board position in 100 saved games, you would create 100*32 tables just for the pieces.
Again, something like that could work, but IMO it's just shifting too much memory around to be on par with other, existing techniques.
This is a great resource for chess programming:
https://chessprogramming.wikispaces.com ... esentation
Sir_Silver wrote:Except that, in the latest version that I downloaded from your post, it doesn't seem to support castling, which, by the way, is a move.
Briefly looking at the code, it seems that it should support castling.
Having said that, it's a WIP project so it very well may be broken.
Threefold repetition is missing too as well as a few other features.
I posted the link as a reference, not as a "complete" solution.
Sir_Silver wrote:Forgive me if I sound defensive, it's because I am
No worries, there's not a lot of people who do chess programming in Lua so we have to stick together! :)
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Silver Chess - My first LOVE game!

Post by Sir_Silver »

Lol, you're response has made my day. Honestly, I was having a bit of a rough morning and seeing your comment made me smile and feel a whole lot better, thank you for being so nice and humble. :awesome:
Ivan wrote: Let's say you want to search for a given board position in 100 saved games, you would create 100*32 tables just for the pieces.
Again, something like that could work, but IMO it's just shifting too much memory around to be on par with other, existing techniques.
This is a great resource for chess programming:
https://chessprogramming.wikispaces.com ... esentation
Thanks for the resources, I will surely check them out when I get the chance. I agree, my move validation checks need to be a lot more efficient, especially when I decide I want to have A.I. that can delve deeply into potential moves, 5, 10, or even more deep. I don't think, however, that searching for your board position in potentially 100 saved games will be within the scope of the game I'm trying to make.
Ivan wrote: Threefold repetition is missing too as well as a few other features.
I posted the link as a reference, not as a "complete" solution.
Yeah, now that you mention it, mine doesn't bother to check for threefold repetition, thanks for mentioning that one. Also, I am definitely checking out your reference to see if there is anything that I can learn from it.

My apologies for being so rude to you!
Post Reply

Who is online

Users browsing this forum: No registered users and 62 guests