For navigation based game like Simulation or RPG you need a Panning camera so that you can move around to see and so something. Camera is the first interaction point for any Visual simulation and it HAVE to good enough to do so. For Character navigation demo I have made a PanCamera to navigate the area and look around. Here is the demo link:

 http://www.al-mamun.com/Navigation.html

Used WASD for navigation and hold Left button and drag to rotate  around the fixed point.

I have started game development by social simulation and some how I love to simulate character. Simulating character is not a easy thing. There are lot of issue involved with it. George taught some part of it. I wish, I can work with him again!!! I feel him a lot now because I think it’s the best time to work with him. Anyway, let’s see how far I can go with it. The plan have to simple because by myself I can’t do lot of thing but can do part of it. So, plan is:

  1. Character navigation 
  2. Mesh Based path system
  3. Path finding
  4. Interacting character with some prop

1. Character navigation 

    First of all this is a huge term. I will try to do minimal. Like: character can walk in a path under command of a system. It will be like animation control with some control over it. I will try to explain more on time.

2. Mesh Based Path System

    In past I did grid based path system. In that time I develop a grid system which created on run time based on some info. It’s good for dynamic build system like player will create new navigation area for game character. Sim’s is a good example of it. But for fixed area it should be mesh based navigation when I can create a navigation area and put information in the mesh and this invisible mesh will drive the character path. I’m new in that system and I want to develop it.

3. Path Finding

     This will be modified A* system. Let’s see how it’s work.

4. Interacting character with some prop

     This is the most complicated part and critical task. George told me some way to do so, I will try in that way. 

So, it’s a big plan!!!! There are lot of resource issue here. I will use Unity to do this to leave the rendering part on it and also try to reuse their resource for it.

OpenGL vs iPhone CALayer

September 7, 2009

I wanted to talk about OpenGL layer and iPhone native UIKIT performance issue. Let’s talk about it. OpenGL is also CALayer and this is why you can add as sub view in a window. So, why not use multiple UIView instead of OpenGL for 2D game or sprite based game? Ya, we can do so but before doing this start your paper work and find out how many animating layer will be in your scene. All UI element take time from main run loop. In that case your context drawing and logic will be updated in same thread.

From game development point view you will create a NSTimer and will run in some FPS but mind it, it may not call on that duration if iPhone native drawing take too much time. Your equation will fail if you animate 5-8 animating view want consistent 60 FPS or like so. For 1/60.0 ms it may call 1/30.0 or 1/20.0 or multiple of it because iPhone refresh rate locked to 60.0 FPS. 

In the other hand OpenGL is a single UI layer and less time in UI native drawing. So, you have all time to split logic and render. You may use Constant FPS and max game logic or Max FPS and constant game logic. As a game developer you should know that, game run loop is the heart of a game. You have to very careful in the circumstances. Device like iPhone you should create you game loop for Max FPS and constant game logic. It will give much better output.

NSURL

September 7, 2009

Use UTF8 encoding while creating NSRUL from NSString from following function

- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding

Otherwise NSURL will not be valid.

Sometimes we need to take user name. There are lot of way we can do this but I think people will like UIAlerview style most. Here is a code segment that can take user input by Alertview: [Adjust position and other parameter for your case]

UIAlertView *myAlertView = [[UIAlertView alloc

initWithTitle: @”Enter Your Name” 

message:@”Enter Name”

delegate:self

cancelButtonTitle:@”OK”

otherButtonTitles: nil];

myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 40.0, 260.0, 25.0)];

CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 80.0);

[myAlertView setTransform:myTransform];

myTextField.text = @”";

myTextField.delegate = self;

myTextField.textAlignment = UITextAlignmentCenter;

myTextField.backgroundColor = [UIColor whiteColor];

myTextField.clearButtonMode = UITextFieldViewModeWhileEditing;

myTextField.keyboardType = UIKeyboardTypeAlphabet;

myTextField.keyboardAppearance = UIKeyboardAppearanceAlert;

myTextField.autocapitalizationType = UITextAutocapitalizationTypeWords;

myTextField.autocorrectionType = UITextAutocorrectionTypeNo;

[myAlertView addSubview:myTextField];

[myAlertView show];

[myAlertView release];


Final Touch!!!

September 4, 2009

Giving final touch on my 3 iPhone app. Most of them are game. I think people will like it. All of them are based on iPhone native UIKIt. In my opinion there is a marginal  line between UIKIT based game and OpenGL game. Hope will explain it in some day. Mind it, you can do most of 2D game by native API, you don’t need OpenGL access. But some case you have to use it.

iPhone Memory Management

August 31, 2009

May be this is the most hot and cracking part on iPhone development. Most of the dev face lot lot of time this issue. This is not a issue only for iPhone but also true for all other development platform. In my opinion, apple gave us a very nice and easy memory management system. You may not agree with me but I believe it’s true. Let me explain why.

First of all, consider C++. you have to allocate memory by your self and have to free also. So, HW access in your hand and have to maintain lot of factor. I think some programmer love overloading new() and delete() function for better memory management  system, but overloading new() or delete() is not childish thing. You have to have all low level knowledge like HW locking and thread safety issue. Anyway, I’m not here to tell about new() and delete(), I want to talk about apple memory management system. 

This is a ownership basis thing. Like: if you acquire something explicitly then you have to leave it explicitly. So, question is what is explicitly?

  1. When you call alloc function. Like: NSMutableArray* myArray = [[NSMutableArray alloc] init];
  2. When you use retain. Like: NSArray* holdingArray = [[NSArray array] retain];
  3. When you copy something. Like: NSArray* shallowArray = [otherArray copy];

These the case when you have to have call the release. So, it’s simple!!!! One of the most beautiful thing is the you can send message to a nil object. It will not mind but you can’t send message to a freed object. It will mind a lot ;) .

UV in iPhone native

August 20, 2009

You can change the pixel rectangle or part of image  by defining  layer.contentsRect. It’s like UV cut.

 

FB garage Images

August 20, 2009