Late last year I started working on a new programming project in my spare time - Yahtzee for Mac. While I realize that I'll neve be able to release it due to liscensing issues, I still enjoy working on it in my spare time. If nothing else, it gives me more experience and practice with Cocoa programming on OS X.
I've made pretty good progress so far. A single player can roll five dice, select which ones to keep, and roll again. Once they have the numbers that they like (or have rolled three times), they select which score to use for the roll There isn't an end game as such, but it does pretty well for a single player experience.
My current task is to add multiplayer support. While I wrote the single player part in a week or so, this is talking much longer. Currently, while multiple players can "play," taking turns isn't enforced. That's what I'm starting to work on now.
When a player starts the game as a server, a new window is displayed listing all of the players that have joined the game, and their initial roll (in order to determine who goes first). The problem is displaying the array of player in both this and the main window (defined in sepaeate XIBs) at the same time. While the array displays fine initially, if a player joins the game acres the window is displayed they are not shown in the list. This is because a different NSArrayController is used, so it doesn't have any idea that a player was added to the array.
I'm not sure how to fix this yet, sadly. I can't bind one NSArrayController to another, and I can't use the same one in both windows since they are defined in different XIBs. I could move them into the same XIB, but that just seems wrong. It might work to set the binging in code, which would allow me to use the. same controller in both windows, but I'd rather use Interface Builder for this if I can, sice that is what it is meant to do.
I haven't had much luck using Google or StackOverflow to get an answer, either. Maybe if I plug away at it, something brilliant will come to me.