[Preview] ConnectSome. My next project.

Discussion in 'iOS Development' started by SkylarEC, Nov 5, 2009.

  1. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Since I'm still sick, I decided to take a little time off everything yesterday to rest my brain. I took a couple of hours and whipped up a basic interface for a game that I really like, Keith Pomakis' n-In-A-Row! game. Play it here: http://www.pomakis.com/c4/online/c4.cgi


    Since his Connect 4 algorithm is open source, I decided to take it and build a front end around it. I came up with this:

    Please Register or Log in to view images


    It doesn't look like much, until you watch the video. The colors are always changing, the alert tables are properly masked, and things are great. I am actually drawing a lot of things myself. Right now, the only things I have left to do is write some math that draws the game board and make the app connect to Pomakis' c4 algorithm.

    So far, it's going very smoothly. Exactly how you'd expect a mindless project to be. Why should you care? Well, I'll likely wind up making this an open source project. : )


    Link to video: http://www.skylarcantu.com/videos/CSPreview/CSPreview1.mov

    : )
  2. Collateral

    Collateral Active Member

    Joined:
    Sep 23, 2007
    Messages:
    1,974
    Likes Received:
    6
    Device:
    iPhone 3GS (Black)
  3. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    Nice job, didn't expect the background to be manually drawn too.
    Is there a reason the TableViewCells Labels background colour is white?
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Update: http://www.skylarcantu.com/videos/CSPreview/CSPreview3.mov

    This allows you to select from a list of created players. Of course, there are two independent columns, one for each player. The "Go back" behavior will, of course be moved from the actual table cell and placed on a separate go back button. That way more than one person can select their user! I'll create this just before the "Add New Player" button.

    The project is progressing nicely. A lot of attention to detail here. For example, if you notice the two player tables. They are made the same way the tables in Weather are (which is Simulated by Spotlight). That is, they don't look as if they are being cut off by the top of the UITableView.

    I'm not actually drawing those cells, I'm letting UIKit do it to default table cells. Without subclassing, I can't turn those labels white. That said, I did subclass the cells to make the labels clear, but it turns out they are much easier to read with the slight background behind them.




    EDIT: I am still undecided on release methods. I will most likely AppStore this, but I may very well stick this on Cydia too.
  5. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    This is the reason i was expecting

    Please Register or Log in to view images

    . Maybe subclass the cells and fill them solid, like the whole cell. It looks a little off with random white squares.
  6. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Another update, I spent a little time and fixed up the player name input menu. It was a subclass of a custom view, but I decided to scrap that all together and just make a custom view for it all. I know that I am killing code reusability by doing that, but I don't really care in this instance. Regardless, the code will be released when this is finished, so you can feel free to abstract it out.

    Video: http://www.skylarcantu.com/videos/CSPreview/CSPreview5.mov

    Please Register or Log in to view images



    Wait a minute, why aren't the chosen player names sticking? This is because I am lazy. I created a method in my CSSettings controller that shoots back an array of fake names. -fakeHumanNames, naturally. The mechanism to save and load human names is done. I literally only need to make the button return the two chosen names so I can add those to the human name array. I haven't done that yet because I haven't added in the "Add a name" method yet (just the button).

    I'll do all this later today, then I'll take a break and polish up PocketTouch for its bug update, now that I have been testing it for a few days. At some point next week, I'll get back to work on adding in the actual game view, which is the only thing this app is missing.

    Remember that the game engine has already been coded. I want to make an Objective-C wrapper for it. Which is completely unnecessary, but it should be easy enough to do, so why not?

    I suppose I'd be done by now if I actually worked eight hours a day on this : )


    EDIT: I realize the offset on the table titles is inverse. I'll fix that. Or not. It depends on whether or not I remember. Or care.
  7. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Clearly I have more work to do in this area, but time was short today. I set up the masking and got all the math worked out for drawing the game board itself.

    Standard size, 7 columns x 6 rows

    Please Register or Log in to view images


    Largest size, 9 columns x 8 rows

    Please Register or Log in to view images


    Smallest size, 5 columns x 4 rows

    Please Register or Log in to view images




    Of course, since the number of columns are completely selectable, you can have anywhere from four to eight rows while having anywhere from five to nine columns. The choice is yours!

    It's as if it's magic, but really, it's just math.
  8. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    Although you seem to love that background, I don't think it suits behind the board.
  9. Collateral

    Collateral Active Member

    Joined:
    Sep 23, 2007
    Messages:
    1,974
    Likes Received:
    6
    Device:
    iPhone 3GS (Black)
    Interesting. I cant wait to see the math you did for that. Tbh, i would have no idea how to do that. But i guess that's why you went to college. haha.
  10. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    The drawing algorithm, it's just 32 lines : )

    Also no. I went to college for exactly two semesters. They weren't in a row.

    I concur. I have a lot of tidying/prettying up to do. Unfortunately, I didn't have time for that today. I just barely had enough time to make the math and mask.

    To be honest, the view controller you're seeing has nothing but this in it
    [OBJC] self.view.backgroundColor = [UIColor clearColor];
    _gameBoard = [[CSGameBoard alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.width) autoCreateGrid:YES];
    [self.view addSubview:_gameBoard];
    _gameBoard.center = self.view.center;[/OBJC]

Share This Page