A good starter game?

Discussion in 'Public Game Developers Forum' started by Avizzv92, Aug 22, 2009.

  1. Avizzv92

    Avizzv92 Well-Known Member

    Jan 3, 2009
    85
    0
    0
    I just got done re-reading an Objective-C book, I feel like a learned a good bit of Objective-C. I now plan on moving onto a iPhone SDK Book...

    I have an idea create my own version of Rodent's Revenge (Windows users should be familiar with this game). From a programing stand point would you think it would be a good style of game for a beginner? And how much knowledge/proficiency in Cocos2d (Free and uses Objective-C) & Objective-C would be needed?

    And would it be possible to get away with not using a Physics engine? The only language I really have a good foundation in is Objective-C, and Chipmunk uses C... The only part I could think of that would have a possible need for a physics engine is collision detection of the blocks, I'm figuring the actual motion of blocks requires none. Depending on the direction being pushed they simply move section to section, and the number of blocks has no effect on how hard it is to push them.

    For those unfamiliar with Rodent's Revenge http://en.wikipedia.org/wiki/Rodent%27s_Revenge

    I realize alot of my questions could be a little vague and answers will vary person to person but any input is appreciated :)
     
  2. smasher

    smasher Active Member

    Aug 6, 2009
    33
    0
    0
    You don't need a physics engine for something for a game like that. Collision detection should be as easy as checking if an array contains a zero or another number.

    Cocos2d looks like a good choice - you'll get better performance than UIViews, but it will be easier to learn than OpenGL.

    You may still have to learn a little C, when you're creating things like arrays of integers. Objective-C is an extension of C, and still falls back on C primitives for some things.
     
  3. Avizzv92

    Avizzv92 Well-Known Member

    Jan 3, 2009
    85
    0
    0
    #3 Avizzv92, Aug 23, 2009
    Last edited: Aug 23, 2009
    I was thinking something like that aswell...

    Layout the game like grid paper, each square represents a place a block is or could possibly go to via pushing blocks around.

    The moving of the mouse character would be easy I would think... basically move one square at a time in any of the 4 possible directions. And have it set up sorta like graph with an (x,y) location. Each time the game starts the mouse would be in the (0,0) location on the graph, say a person hits the right arrow once he would then move to the (0,1) location. Would this be a good way to handle it?

    The thing that has me a little more confused would be how to move the blocks based on the mouse pushing them. Would it be something like when you hit the left arrow if a block is located in your y location - 1 the block should move to it's y location - 1? And if a block is located to the left of that block go through the same check until either no blocks are located to the left or you hit the wall?

    The more I think about it the more it boils down to working with a graphing and checking if a location on the graph is being occupied and by what, then what the thing should do.

    As for the cat (AI) I would need to figure a way to get it to go as close as it can to the mouse by finding gaps in the blocks.

    I planned on taking it one thing at a time

    1. Get the mouse moving in all possible directions.
    2. Add some blocks and get them working the way I want.
    3. Add the cats (AI) and get them working.
    4. Move onto other gameplay modes and working with different types of blocks (movable, unmovable, ect...)

    Also: Would the Obj-C array NSMutableArray not work for my needs? In what way are arrays handled in C different?
     
  4. Amperage

    Amperage Well-Known Member

    #4 Amperage, Aug 23, 2009
    Last edited: Aug 23, 2009
    NSMutableArray would work. I make heavy use of them for object management.

    In the game I'm currently working on I basically have a couple mutablearrays with the elements representing a grid of image views. When a block needs to be animated I simply create a new UIImageView in code and add it to a animation list mutablearray set that duplicates the original block and any other needed information, color, size etc then set the original block.alpha to 0.0 and essentially tag it as inactive so it's not used in collision checks.

    When the new animation list object has reached it's destination I set the UIImageView in the grid array at the new location to match the animationlist object then release the animation object. I've found this method to be the easiest method for looping through any moving object on the screen using something as simple as
    for (int i=0; i < [animationListArray count]; i++) {
    // do collision checks etc here
    }

    For basic collision detection you can use
    CGRectIntersectsRect(object1.frame, object2.frame)

    I'm just getting started out in Obj-C and iPhone development myself so take my advice as such. The above information has worked for me up to this point but it's probably not the most efficient method of doing so.
     

Share This Page