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:

symscreen

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.