Page 1 of 4

[Mod] Chess [1.0] [chess]

PostPosted: Tue Aug 14, 2012 00:30
by Bas080
A mod where you have nodes with which you can make a chess board and chess peaces and play chess

Made possible by
Bas080 - Project initiator and developer
Tonyka - 3D model designer
Rubenwardy - Developer

NEW FEATURE!!!
Node ownership
1. Only the placer of the chess spawner can also remove it. (admin)
2. After placing the spawn spawner, all players are prompted to hit the king of his/her desired color if he/she want's to play. This can be the admin or another player.

Recipe also changed because mese is gone:
W=wood
T=tree

WTW
TWT
WTW

Screenshot
Made textures 16x16

Download
https://github.com/bas080/chess/zipball/master
...or see code https://github.com/bas080/chess

Current features
- /giveme chess:spawn and place Chess box in open area
- Border nodes with coordinates NEW tonyka's contributed textures
- Detailed 3d models for the pieces tonyka's contribution
- Chess box that creates the board and pieces when placed rubenwardy's idea
- When chess box is mined it removes all the board and pieces on top of it.
- Chessboard has a border
- All chess pieces (black and white)
- Pieces give light at night tonyka's idea
- Improved texture lighting of pieces tonyka's contribution
- Chess piece ownership.

Must have
- Clear crafting recipes for different pieces in black and white

Should have
- Functions to re-assign ownership
- Chessboard creator can reset match by punching spawn block
- Chessboard creator can interfere in match replacing or removing chess pieces.

Could have
- Rules to avoid illegal moves
- Selection feature where pieces are moved not by digging and placing but by punching piece and punching move to position.
- Time and stats User interface
- Commands and chat messages /move rook a8 to a7 InfinityProject's idea

Please share your ideas on what you would like to see in this mod.

PostPosted: Tue Aug 14, 2012 01:22
by tinoesroho
If one wanted to, it's easy enough to create lua entities. Actually coding game rules can be tricky. Off the top of my head, I recommend checking DreamChess's archives for the models. Swipe code from 3danimals or something.

PostPosted: Tue Aug 14, 2012 02:04
by tonyka
I like playing chess, and therefore your idea

the chess pieces need not be the typical game, may have inspired minetest forms...

ideas of chess pieces:

rook = Dungeon Master
knight = cactus
bishop = a tree
queen = a golden apple
king = the cat nyan
pawn = a rat

PostPosted: Tue Aug 14, 2012 02:11
by tonyka
another idea is that the pieces could have some lighting,...

thus would be beautiful even night play...

PostPosted: Tue Aug 14, 2012 16:36
by rubenwardy
Good idea, the rule coding will be hardest

Also, what is the size?

Solution:

I suggest using a real sized board and
use a "door" spawn like thing so when you place a chess spawner block, the black and white appears around it

No Rules, Players can move the pieces around, but it is not determened if they have won, the players have to notice like in real life.
Maybe if you click the spawn block all the pieces go back to the original.

PostPosted: Wed Aug 15, 2012 20:42
by Bas080
rubenwardy wrote:Good idea, the rule coding will be hardest

Also, what is the size?

Solution:

I suggest using a real sized board and
use a "door" spawn like thing so when you place a chess spawner block, the black and white appears around it

No Rules, Players can move the pieces around, but it is not determened if they have won, the players have to notice like in real life.
Maybe if you click the spawn block all the pieces go back to the original.


The "door" (chess box) idea is good. And hitting it to reset the chessboard really keeps the focus on the game and not the building and placing of the pieces. I consider it a "should have"

PostPosted: Thu Aug 16, 2012 01:29
by InfinityProject
An idea: a grid. Recognizes if pieces are on the grid. Now movement. Commands? Example: /move rook a8 to a7. Just an idea.

PostPosted: Thu Aug 16, 2012 04:09
by tonyka
this is the minimum version for the shape of pawn

Nodebox pawn:

Code: Select all
minetest.register_node("chess:pawn",
    {description = 'pawn',
    tiles = {"default_wood.png"},
    drawtype = "nodebox",
    sunlight_propagates = true,
    paramtype = 'light',
    paramtype2 = "facedir",
    light_source = 15, --max light is 18
    node_box = {
        type = "fixed",
        fixed = {
            {-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
            {-0.3, -0.5, -0.2, 0.2, -0.4, 0.3},
            {-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
            {-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
            {-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
            {-0.2, -0.1, -0.1, 0.2, 0.1, 0.1},
            {-0.1 -0.1 -0.2 0.1 0.1 0.2},
        },
    },
    selection_box = {
        type = "fixed",
        fixed = {-0.3, -0.5, -0.3, 0.3, 0.2, 0.3},
    },
    groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
}),


other textures that suggest:
white pieces: default_lava.png
black pieces: default_water.png

not promise anything, but if I have some time, I'll do the rest of figures ...

PostPosted: Thu Aug 16, 2012 09:53
by rubenwardy
Has anyone started coding this? we should set up a github page, i would like to help.

If you want me to setup the page, i can do

PostPosted: Thu Aug 16, 2012 09:55
by rubenwardy
tonyka wrote:this is the minimum version for the shape of pawn

Nodebox pawn:

Code: Select all
minetest.register_node("chess:pawn",
    {description = 'pawn',
    tiles = {"default_wood.png"},
    drawtype = "nodebox",
    sunlight_propagates = true,
    paramtype = 'light',
    paramtype2 = "facedir",
    light_source = 15, --max light is 18
    node_box = {
        type = "fixed",
        fixed = {
            {-0.2, -0.5, -0.3, 0.2, -0.4, 0.3},
            {-0.3, -0.5, -0.2, 0.2, -0.4, 0.3},
            {-0.1, -0.4, -0.2, 0.1, -0.3, 0.2},
            {-0.2, -0.4, -0.1, 0.2, -0.3, 0.1},
            {-0.1, -0.3, -0.1, 0.1, 0.2, 0.1},
            {-0.2, -0.1, -0.1, 0.2, 0.1, 0.1},
            {-0.1 -0.1 -0.2 0.1 0.1 0.2},
        },
    },
    selection_box = {
        type = "fixed",
        fixed = {-0.3, -0.5, -0.3, 0.3, 0.2, 0.3},
    },
    groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}
}),


other textures that suggest:
white pieces: default_lava.png
black pieces: default_water.png

not promise anything, but if I have some time, I'll do the rest of figures ...


You have two light_source properties there.

PostPosted: Thu Aug 16, 2012 12:20
by tonyka
rubenwardy wrote:
You have two light_source properties there.

hauch!!

certain
fix it in post ...

PostPosted: Thu Aug 16, 2012 17:59
by rubenwardy
Here we are https://github.com/rubenwardy/Minetest-Chess-Mod.

If you want me to add you as an admin / transfer ownership, tell me

PostPosted: Thu Aug 16, 2012 20:59
by rubenwardy
This line of the door node looks like the job:

Code: Select all
minetest.env:add_node( pos,  { name = 'doors:door_wood_a_c', param2 = newparam } )


And to call this

Code: Select all
minetest.register_on_placenode( on_door_placed ) --Used to setup chess board
minetest.register_on_punchnode( on_door_punched ) --Used to reset board


Not sure about lua for loops, (i mainly do c++) but this is how i think it would work:

Code: Select all
--In a function called on chess:spawn's placing

local x=0
local z=0
local color=0
for (x=1;x<9;x++) --To make 8 rows (9-1)
  for (z=0;z<8;z++) --To make 8 cols (8-0)
     pos=new position(x, -- , z)
     if color==0
           minetest.env:add_node(pos ,  chess:board_black )
     else
           minetest.env:add_node(pos ,  chess:board_white )
     end if
     color=1-color --Toggles color between 1 and 0.
  next
next

THIS CODE WILL NOT WORK - It's used to illustrate how it would be done

Spawn Block Crafting

What will the recipe be? could make it multistep so it becomes a collectors item

1) Black and white wool to look like a chess board in the craft menu

or

2) 3x3 Mese


Or combine for a long process:

To make spawn block
Code: Select all
chesspiece,  chesspiece, chesspiece

chesspiece, chesspiece, chesspiece

chesspiece, chesspiece, chesspiece


And then furnace it.

To make chess piece

Code: Select all
bwool, wwool, bwool
wwool, mese, wwool
bwool, wwool, bwool


* bwool : Black Wool

* wwool : White Wool

PostPosted: Mon Aug 20, 2012 18:10
by Bas080
rubenwardy wrote:Here we are https://github.com/rubenwardy/Minetest-Chess-Mod.

If you want me to add you as an admin / transfer ownership, tell me


I'm happy to see that you and others are excited about this idea.

Rubenwardy, i don't mind not being the owner. I would however like to push code to the git.

My github name is also bas080. Please add me when you get the chance :)

PostPosted: Mon Aug 20, 2012 20:32
by rubenwardy
Bas080 wrote:
rubenwardy wrote:Here we are https://github.com/rubenwardy/Minetest-Chess-Mod.

If you want me to add you as an admin / transfer ownership, tell me


I'm happy to see that you and others are excited about this idea.

Rubenwardy, i don't mind not being the owner. I would however like to push code to the git.

My github name is also bas080. Please add me when you get the chance :)


A step ahead of you :)

Already added you




I think we should make it a collect able,

So it should have a long make process.

What do you think?

PostPosted: Mon Aug 20, 2012 21:34
by Bas080
rubenwardy wrote:
I think we should make it a collect able,

So it should have a long make process.

What do you think?


I'm sorry... I made my own git... the way i did it makes it easier to test the mod. It works right away. I used the template you setup. The code that has been implemented is checkers board maker. Now the pieces... and later the rules to avoid illegal moves.

I like the co-op idea. Will make separate LUA file for pieces and later for rules and interaction.

PostPosted: Mon Aug 20, 2012 21:58
by rubenwardy
Bas080 wrote:
rubenwardy wrote:
I think we should make it a collect able,

So it should have a long make process.

What do you think?


I'm sorry... I made my own git... the way i did it makes it easier to test the mod. It works right away. I used the template you setup. The code that has been implemented is checkers board maker. Now the pieces... and later the rules to avoid illegal moves.

I like the co-op idea. Will make separate LUA file for pieces and later for rules and interaction.


Ok, you add me and tonyoka then

PostPosted: Wed Aug 22, 2012 09:05
by Bas080
Was thinking, should the chessboard spawn box check if the chessboard fits in the area before it it placed or should it carve out enough space(remove nodes that are in the way of the chessboard spawning).

I'm pro checking if enough place, if not do not spawn chessboard and display chat message "Not enough space to place chessboard and pieces." Then you should mine the box again and try it somewhere else.

PostPosted: Wed Aug 22, 2012 10:04
by rubenwardy
Bas080 wrote:Was thinking, should the chessboard spawn box check if the chessboard fits in the area before it it placed or should it carve out enough space(remove nodes that are in the way of the chessboard spawning).

I'm pro checking if enough place, if not do not spawn chessboard and display chat message "Not enough space to place chessboard and pieces." Then you should mine the box again and try it somewhere else.


That is good.

PostPosted: Wed Aug 22, 2012 12:39
by TheLoLMan
lol good

PostPosted: Wed Aug 22, 2012 14:52
by tonyka
I'm creating the rest of figures, in a few days I put the complete code ...

PostPosted: Sat Aug 25, 2012 13:16
by tonyka
still not very well use github, so I created a fork .. in mine ...
and I have added the rook ...

& my nick in github is "tony-ka"

PostPosted: Sat Aug 25, 2012 13:39
by rubenwardy
tonyka wrote:still not very well use github, so I created a fork .. in mine ...
and I have added the rook ...

& my nick in github is "tony-ka"


Ok, do a pull request :)

PostPosted: Sat Aug 25, 2012 14:49
by Jordach
I am great at playing chess, I'd love to help out.

PostPosted: Sat Aug 25, 2012 15:23
by Bas080
Jordach wrote:I am great at playing chess, I'd love to help out.

Hey Jordach, you are free to implement functions to the chess mod. There is a git and many functions to still be programmed. I am now thinking about how to implement chess piece ownership. This should avoid other players interfering in ongoing matches. Also illegal moves and movement commands are still to be programmed.