Onitama and Personal Page Redesign

So I’ve gotten a little bit further with Onitama, though I’ve kinda put it on the backburner for now.  I’m at a point with it where I’ve got to start thinking about the 2-playerness of it.  Basically, I have it so the player can play a card and then move a piece and capture an opponents piece.  I don’t have any gameflow logic at this point to transfer to the next player.  My main issue is figuring out how the server end of it would work as well as rendering to each separate player.  Right now I’m only using a single view to render to player 1.  But of course if you’re playing with a second player, they’re going to see it a bit differently (their pieces will be at the bottom), which requires rotation of the screen, basically.

In the meantime, I’ve been writing little snippets and thought that I’m kind of bored of my wiki page on my personal homepage.  So I’ve decided to do something different.  I thought at first it would be fun to have a gopher server and upload files, but gopher is rare and hard to deal with and I didn’t feel like learning a completely dead technology.  So I figured I’d make a sort of file browser for my site.

Here’s a quick little mockup of it:


Basically the directory on the left.  Click a folder and the file listing in the center, then click the file listing and it will display the contents on the right.

I’ve been lazily working on this project the past couple days.  Learning a little PHP and figuring out bits and pieces of issues.  So many little details that just make it hard to get working right, but I guess that’s programming and learning a new language.  I’ve got it so I can load the current directory and display the directories and files in that directory.

I’m having a heack of a time, however, loading the files and directories of subdirectories.  I’ve checked my .htaccess file, and I can see the subdirectories in the browser on my local machine so I know it’s not an htaccess issue.  I’ve gotten it to work if I don’t test whether something is a file or directory.  However, there’s some weird way PHP’s function that tests whether a filesystem object is a directory or file (supposedly it’s just for files, but I’m having a similar issue, I think, with directories, now that I’m testing it – even though, in theory, I wouldn’t need it, since I’d only be working with single hierarchy, not nested folders).

Supposedly, if a folder doesn’t have executable permission from the entity running the serve, then it won’t register as “is_file”.  If I remove the conditional on whether an entry in the filesystem is a file, then I can load them up.  But this means that directories will also get loaded into the array, and I don’t want/need that.

I found the function to test the permissions, and it appears the folder themselves have the correct executable permissions.  Except the files, being image files, are rw only, which is correct, I shouldn’t have to set an executable flag on every single file in a folder, especially since it’s not an executable file.

So something’s going on and I have to narrow it down.  I’ve got it partially working in that I can show the items in the subdirectories and load them into arrays, but I can’t figure out how to properly filter them.  It seems as though the code/functions I’m using aren’t right, even though they’re the built-in functions and examples based on the documentation (tweaked for my purpose, but very lightly – not in any way that should make it break).

In some ways, it’s really cool.  PHP is a little better than I remember, but there’s all these weird little quirks and bugs, too.  Meh.

Onitama: Board Game Port (Personal Project)

So I recently learned about the board game (originally a PnP game, but now apparently a full fledged published board game) called Onitama.  The rules looked simple enough that I thought maybe I could try my hand at programming it.  I’ve just been feeling a bit deflated by the design process and wanted to do some programming, and so here’s a game that’s already designed with simple components and simple rules that I could try to make.

I’m going to make it a P2P networked game (so one player is the host, and your friend connects).  This is a personal project and don’t plan on releasing to the public (avoiding copyright issues), but I will share my progress here.  If it turns out pretty decent I may approach the publisher and see if they would mind me porting to electronic device (unless they already have a version lined up by then).  Of course, that’s a huge thing, and I would be chuffed if it happened, but for now, just taking it in stride and doing it as my own project and testing w/friends.

Without further ado – here is the current progress on Onitama.  (The below text was posted to my FB, so it duplicates some of the stuff above in first couple paragraphs).

No fancy animations or anything (I should probably get iTween happening so I can have some smooth transitions to positions, but for now it’s about getting the core mechanics working. Honestly, this is more for my own benefit than any release, since it’s a copyrighted board game by someone else, so not sure I want to spend time doing fancy animations, unless I could use this as a demo to convince them to let me make a full fledged port 😉 LOL. Of course I don’t have money to survive on in the mean time and when I have a job won’t have the mental energy to code as productively as I should. But I could probably get decent artists and shit if that ever came to pass.
Anyways, what you see here is the card list on the right hand side of the screen (not the play area). Hitting play sorts the cards and deals 5 cards, 2 to each player and one spare card on the side. The rest of the cards aren’t used so they aren’t displayed.
When mousing over a card, it enlarges it a little so you know you’re mousing over it. Only the cards in your hand are resizable since they’re the ones you’re working with. When you click on it, it pushes it to the left hand side as your “active” card.
Then if you click the other card in your hand, the current card gets put back in your hand and the new card is selected…
Eventually the patterns on the card will indicate where you can move your pawn to. (and some cards are special and only allow certain types of pawn to move… one card even lets you move your opponents Onmyo (think “King”)). I have the patterns all coded up as vector positions on the cards (though it’s a little more complex than I’d like due to the edge cases of the special pawn moves, but that’s the game!)… Anyways, it will be that once the current card is selected and you highlight a pawn, the possible moves will be highlighted/colored on the board itself. And then you can click an available spot to move your pawn there.
Once you’ve made your move, your current card then is “played” and becomes the “spare” card for your opponent, and you grab the “spare” card to the right of the board. Gameplay continues by playing/passing cards until either your Onmyo gets in opponent’s Onmyo position or you capture your opponents Onmyo with one of your pieces (or vice versa, of course ;))
I haven’t even begun to think about the logic of networking and how to display and deal with actual game state between two players in a turn based game like that. Well it’s a little lie. I’ve thought slightly about it, but don’t want to get ahead of myself. My main goal is getting it working for one side and having two players each with the same abilities, then just worry about having the server render the board to the players appropriately (the players always see themselves as the bottom of the board with their opponent at the top). So basically just rotating the board (and pieces). Hmm… I do see that I should have 2 spare piles (I only have the one set up. I should attach the spare piles to the players. Right now it’s a separate thing. Should do that before moving on, as it will fuck shit up in the future if I proceed before fixing that.

Five Year Plan: A Collectivist Deck Building Game – Co-opetitive Design Conundrums

A while back I had an idea for a deck building game that’s co-opetitive in nature.  The initial idea was a shared deck for all players, with a “communist” theme of shared resources, and goals for a five year plan.  The goals would be based upon players roles as commissars (Commie-Tsars ;)) and each player would be required to produce a certain amoung of a given type of good.  If all succeeded, then the game would continue til the end.

The cooperative aspect would be based on that need for everyone to succeed.  If anyone failed, then the game was over.  I’m not sure if I like that aspect.  I definitely don’t want a player-elimination scheme..  Perhaps a player would lose points/reward for not succeeding.

Anyways, the rewards would be for players who went above and beyond their production.  There would be tiers of success so if you were able to go beyond the minimum, you would get greater glory/recognition.  The Commissar of the Five Year Award (a la Worker of the Year).

I have a lot of concepts mulling around based upon a 4 fold division of labor (Agriculture, Industrial, Military, Intellectual/Arts).  I also have a vision of leveling up “workers” from one to another kind based upon an educational process/schooling (by paying “intellectual” cards to “teach” them).

There are stacks like the kind you can purchase cards from, like in other deck builders.   You can obtain some of these stacks of cards by conquering them by paying military cost to acquire it and bring it into your commie empire.  Each stack would represent a region of the country won over by your revolution.

Another way to obtain certain stacks would be investing (via intellectual resources) in a Tech Tree which would unlock more stacks of higher level tech.

But all these things can be done via a competitive type game.  There’s no sharing of resources much in what I just mentioned, and my biggest concern is contemplating just what it means to have shared resources in a game like this.

There are two ways I can currently see to implement this:

  1.  A shared deck.  The issue here is that if everyone shares a single deck, all players choices become diluted in the larger scheme, and it makes it harder to really build what you want.
  2. A shared hand.  I like this concept in theory.  The idea here is that you have 2-5 players.  During a round, each player has a personal hand of cards, and they place a number of cards (depending on number of players) face up in front of them, and reinforces the by adding cards as necessary to make a 5-card hand.


5 Players = 1 card per player played face up.

4 Players = 1 card per player played face up.  Draw 1 card off the top of the communal deck.

3 Players = 1 card per player played face up.  Draw 2 cards off the top of the communal deck

2 Players = 2 cards per player played face up.  Draw 1 card off the top of the communal deck.

The shared hand scheme here utilizes the concept of a shared deck to reinforce a player’s hand.  I suppose it could be reinforced from a given players hand, based upon who the “current” player is.  That gives a slight advantage to the player whose turn it is (assuming <5 players, natch) and gives a feeling of control.

In terms of resources, one of the things I’m thinking of is a personal “deck” of resources separate from the collective.  Part of that is a player being able to requisition a card from their hand to their personal deck.  It is this personal deck that a player “scores” when it comes time to determine the year’s end success or failure.

The reason I like this aspect is that it allows for a way to manage the collective deck and not be at the whims of other players, while building ones personal resources to be used (I’m not sure, how, exactly this personal deck would be used, except, perhaps as a way to “buff” your hand by adding cards to choose from if you don’t like your current hand, perhaps.)  The interesting aspect comes in the competition for taking a resource as a personal  thing, while denying other players access to this.  The idea there then is that while it benefits you in one way, it might hurt you, by denying resources other players are needing in order to purchase cards from the stacks, perhaps.  That might be good to hinder your opponents because your goal is to exceed your quota while minimizing theirs.  But you don’t want to minimize their production too much, lest you all fail.  Further, if you minimize their production, you’re also minimizing your production, because at some point you might need a resource they are creating for their goal.  A “tragedy of the commons” sort of effect if everyone goes stealing cards for their personal stash.

So I have some ideas that I think might be interesting, but I feel like they are lacking… something.  I’m worried that this balance between personal/collective is going to be hard to pull off.
I plan on having some effect cards like “purge” to allow players to consciously trim the deck or something like “famine” that would be a more random deck trimming effect.

Perhaps instead of a collective deck, or even a collective hand, there is a collective pool that players can play their cards towards to succeed.  So basically it would all be individual decks like Dominion, but to succeed at the goals of your role, you have to give up/contribute some of these resources to the Central Committee in the center of the table.  The question there, of course, is how that would play out.  Are these resources unavailable?  Would they have a reduced effect (that is, say, they’re only 50% value of their stated value when used from the center vs personal pile)…  I dunno.

So this is my biggest vexation, right now.