Mass change of ownership of pieces. Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Designing Games for Zillions » Mass change of ownership of pieces. « Previous Next »

Author Message
Michael Asher (Mike)
Posted on Saturday, June 26, 2004 - 3:00 pm:   

Hi -

Please can anybody help, I'm trying to create a 4 sided chess varient, where if the king is captured then all the pieces from the losing side are then controlled by the capturing player. e.g Red takes Blue King then red can now move Blues remaining pieces. Any ideas if this can be done?
L. Lynn Smith (Interrupt27)
Posted on Monday, June 28, 2004 - 5:49 am:   

If all the pieces are neutral, and players are only allowed to move specific portions of these neutral pieces. The initial determination of which portion of these piece, and what pieces determine the end-condition, could be noted by the presence of an off-board token for each player.

When a player performs a specific capture, the captured player's token is transferred to that player's influence. And also is transferred any end-conditions. The player who loses influence over the pieces on the field might be given a passing move(simply the change-type of an non-participating piece, which could be an only move set by move-priorities or the absence of the off-board token).
Michael Asher (Mike)
Posted on Monday, June 28, 2004 - 3:59 pm:   

Thanks for your comments, but a couple of questions, how can you create nutreal pieces that can be used as normal pieces within a game? Also I like the idea of an off board token, but what code could allow the complete transfer of all pieces from the player who loses the token to the one who gains it?
L. Lynn Smith (Interrupt27)
Posted on Tuesday, June 29, 2004 - 5:44 am:   

By coding the turn-order, you can assign each player the ability to move specific pieces. For example: (First ?neutral)(Second ?neutral)

In this case these pieces would be based upon each player ability to control. So it might be:(First ?neutral neutral1)(Second ?neutral neutral2)

To get into greater detail, you have four players so just make four slots outside the playing field for each player which will denote what "color" they control. Then code each piece color separately, such as Red_Pawn for a red Pawn and Blue_Pawn for a blue Pawn. And within each of these piece declaration, there would be specific move-type sections for each player. Now at a player's turn, each of these pieces will look for the presence of the appropraite token in that player's slots.

Thus neutral1 moves would look for the appropriate tokens in the First player's slots and neutral2 moves would look for the appropriate tokens in the Second player's slots. This is accomplished by sending the postiions for each of these slots with the move command under that move-type(such as neutral1 for the First player and neutral2 for the Second player).

Within each move command, flags will be set to denote the player's pieces that they command,(example: Red_flag, Blue_flag, etc.) These flags would be used to determine friends and enemies.
This is done by looking at the slots for the appropriate pieces controlled by the player, which will simply be the positions sent by the move command.

When the appropriate piece is captured, the token located in other slots is removed(change-type null) and the appropriate slot of the player's is noted (change-type XX). This can be handled by a simple sub-routine called by each move when it encounters an occupied cell.

The win-codition could be the simple presense of all the necessary tokens in that player's slots(off-board positions).
Michael Asher (Mike)
Posted on Wednesday, June 30, 2004 - 2:35 pm:   

Thanks - It sounds complex but i'll give it a go.
L. Lynn Smith (Interrupt27)
Posted on Thursday, July 01, 2004 - 7:16 am:   

If you need assistance, just drop me an e-mail.
Arie Rudich (Arier)
Posted on Thursday, July 01, 2004 - 10:42 pm:   

An alternative solution can be to scan the board, and change the owner of each of the relevant pieces.

A scan is easy by creating a new (direction next) in your (grid) that goes along the rows (or columns).

Then add (links) from each row (column) end to the beginning of the next, and optionally a dummy position that links to the first square.

(define scan-setup
(dummy scan-start)
(links next
(scan-start a1)
; link each row end position to the start of the next row
(k1 a2) (k2 a3) (k3 a4) (k4 a5) (k5 a6)
)
)

Now you can use it to scan -

scan-start
(while(on-board? next)
next
; check if need change
; do your change
)

For the check of current ownership of a piece you may use an (attribute) set in each piece.

If the above scan is made in the move by the capturing player, you can simply use change-owner.
If on the other hand, you use a ?Helper player for this chore, the ownership change may be a bit more complicated (flip...) and using the new (create) may be better.

** Notes for ZOG:
1. For multi player games, ownership checks (friend?) (enemy?) (neutral?) are not enough :-(
2. it would be nice to have an optional "new owner" parameter for (change-owner), similar to the new (create). Currently (flip) has to be used, and in a very awkward way :-(

This alternative has the advantage, over the "neutral ownership" approach, of allowing ZOG to display different images (colors) for pieces according to the player who owns them.

Hope that helps.
Enjoy!
L. Lynn Smith (Interrupt27)
Posted on Saturday, July 03, 2004 - 6:58 am:   

The neutral solution allows for different colors for sections of the pieces. Each piece will have to be defined separately. Such as the blue Pawn would have its own declaration and the red Pawn its own, etc.

The problem with the scan board function is that it takes up processing time, loads the implementation down with extra steps, and may cause a time-lag between each players' move. And with some fields and number of pieces, this may exceed the limits of the Zillions code.

I think, after careful consideration, that you will find the neutral approach a viable and efficient method of quickly changing ownership of mass amounts of forces. It may just be a chore to code and not within the ability of some coders.

And there are ways to enforce the checking rule with this form. A small subroutine when it encouters a specific piece can also capture a owner-specific token in a dummy position which determines the 'check' condition. This condition can be predicated upon specific conditions on the field, such as when the game reaches the point of being played between two opponents.

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: