I am making a game (obviously) and to make it a remotely good one i need to have an AI. The problem is, where do I begin? I haven't done anything like this, and any help is appreciated. Links, other posts, tutorials, anything will suffice. Also note that I would like to have more than one enemy on the screen at once, so each of them will need an AI. Like I said, any help is appreciated. Thanks!
first: AI don't need/use Cocos2D classes
you need to build AI specific classes that controls your game objects/sprites etc...
second: this link covers some basics of game AI
and this post explains how to make a finite state machine (FSM) in Objective C
a FSM is the most simple technique to build an AI in a game
Finite State Machine is the most common technique used for AI on mobile devices.
You also need to consider how much complex processing target device can handle without hampering user experience.
There's a good book for cocos2d: "Learning Cocos2D: A Hands-On Guide to Building iOS Games with Cocos2D, Box2D, and Chipmunk". You should check that out if it's your first game with cocos2d.
Related
I have a completed Sprite Kit game that is solid on it's own, However I would really like to incorporate real-time multiplayer functionality into it. The only problem is I have not been able to find any tutorials going over how to do so (raywenderlich.com has one but it is with Objective-C and my game is in Swift).
I have read through Apple's documentation, however, it really just covers the logic of what is happening and lists pieces that are used as opposed to actually showing how to implement the code.
I was wondering if someone could help me with how to actually go about implementing the code. From what I can tell through my searches it is a pretty requested topic but there aren't any tutorial on this using swift.
We are looking to create a crossword puzzle game and I'd like to see how we can help our client reduce development time by using an iOS SDK. We are looking for the game interaction (loading words, dragging letters to board, word validation, etc)
Look into Cocoas2D or there is Unity3D to assist you in creating games for iOS.
I believe you are looking for a 'Library' if what I understand is that you want an automated way of creating crossword puzzles. Unfortunately I do not believe there is any that would fit your needs.
If you are like me, create your own paper crossword puzzles and then make them on iOS.
A great book to get on how to make games for iOS would be 'Learning iOS Game Programming" by Michael Daley.
I bet with the resources on that book and good logical planning you will have your game made in no time.
I am working on iPhone racing car game development using cocos3d.In this how can I get detection of boundaries of road in road-map.I have done with load pod file for road-map.I also want to know about how can I implement physics for car accident.Is their any sample code of game from which I get some information or tutorial which I can follow?
If I were you, I use Unity. Check out their Car Tutorial that's what you need.
Good luck
There are very few examples and tutorials available for Cocos3D at the moment. Definitely nothing that fits your bill.
Your project sounds like a lot of pioneering you need to do. Particularly physics will be an issue, because both Box2D and Chipmunk are 2D physics engines. You'll need to find an iOS compatible, open source 3D physics engine. I like ODE, and I've heard good things about Newton too. I don't know if they're compatible with iOS though.
To add collision shapes to your POD files would also be a manual process requiring (self-made) tools or a lot of sweat.
Have looked so long for a library specialized in dealing with iPhone Accelerometer but couldn't find anything.
I have made some few sample apps, but none reaches a level of accuracy as in Labyrinth games for example, so any idea about a library for that? Or maybe an open source app?
Would be better if it's integrated in a Physics library
UPDATE: I didn't mention it, but i don't want to use game engines. Specially now, that their future is still unknown. ObjC libraries or tutorials would be better.
I highly recommend looking at tweejump. It's basically an open source version of games like Doodle Jump. It really helped me learn how to use the accelerometer to control an object on the screen.
Although you said you didn't want any game engines, this is powered by the Cocos2D library. However, Cocos2D is written in Objective-C, so there shouldn't be any issue getting anything powered by Cocos2D passed Apple.
Best of luck!
It seems that it may just be easier for you to use a game engine that works with iPhone if you are looking to make a game. Here are 2 engines that export to iPhone GameSalad or Unity 3D
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Am used to developing business and reference apps. Now I have to do an iPhone game. What tips can you share to help me with:
understanding the scope of the project
defining the deliverables
specifying the game play and other parameters
estimating the development effort
testing the game
A big question, I know. Thanks!
My answer is not following the waterfall methodology response you were looking for because I think you will need to learn the skill of game programming before you can plan, design, implement and test it. Game programming is VERY different to business programming and a whole other field in and of itself.
Due to your lack of experience in programming games there are a few concepts that you will need to learn before you can program a game period, let alone one on the iPhone.
Some of these things will depend on whether you are programming a 3D game or going for the 2D platform style.
OpenGL ES
The first thing you will need to learn is the OpenGL ES programming language. This is basically a 3D API which enables you to do drawing of 3D primitives. You will still need to use this if you are coding a 2D game as it is quick due to using the GPU for acceleration.
There are some good tutorials on the Google that you should begin with.
Vector Math
If you are doing anything 3D, you will need to learn about 3D vector math, vectors are basically used for everything in games, camera look direction, position of characters, speed, collision detection, etc. 2D vectors (x,y) minus the z component are still needed for 2D games programming.
Collision Detection
How do I know when my ball hits the wall? The answer is collision detection. There are many forms of collision detection such as Sphere to Sphere, AABB, OOBB, Convex Hulls, Triangle Mesh, etc.
AI
How do I get the enemy to attack my player character? Artificial intelligence is another large field essential to give NPCs/Enemies the ability to make intelligent decisions. AI can be simple such as if else statements but usually requires Finite State Machines or Fuzzy logic to be effective.
Pathfinding
If you want to move a character from Point A to Point B while avoiding enemies and moving obstacles, you will need to use a pathfinding algorithm. A Star (A*) is one of the most popular.
Scene Graph
If you wish to have 10-20+ enemies on screen at a time, you will need to code a scene graph to manage the dynamic drawing, logic and creation and deletion of resources. If you don't know what polymorphism is you will need to know it as it is essential for your game objects to adhere to and it ties in with the scene graph.
Physics
Position, Speed, Acceleration, Gravity and Rays are all represented using vectors and you may need to brush up on your physics math in order to code any game. Start with Newton's Second law of motion F=MA (Force = Mass * Acceleration). An open source physics engine such as Bullet, ODE, Newton, Tokamak will make things easier, meaning you won't need to write these physics rules yourself.
Objective-C++
This is optional although recommended. If you don't know C++ this is essentially a mixture of C++ and Objective-C. I tend to use C++ for the core game engine and programming because of the speed of C++ and availability of third party libraries in C++.
Sound
If you need sound you can just go ahead and use the simple audio frameworks that Apple provide, however 3D positional audio is going to require something better. I would recommend learning the FMOD SDK for iPhone. As #Stowelly mentioned, FMOD requires a license for commercial distribution but there are others you can look for which are royalty free.
Use a Game Engine
There are game engines available for the iPhone at the moment which will make it much easier for you to get a game going, in your case this will be faster although you will still need to learn the concepts I mentioned above.
Here are some game engines I know of:
Unity3D
This probably the most popular one that I know of. Unity is a PC/Mac game engine that lets you write code on the Mac and compile for Windows/Linux/Mac OS X. I doubt the iPhone building is compatible directly with other platforms, I would imagine you'd be restricted to iPhone if you started a new project. This engine does however have a commercial deployment cost of $199-$399.
Cocos2D
This one is an open source 2D game engine that might be useful for a lot of games. Worth taking a look at. Hosted on Google code.
Here are some others to check out:
Ston3D for iPhone
OOlong Engine
SIO2Engine
iTGB for 2D Games
The main difference between business apps and games, especially on mobile devices, is the importance of performance. An app that puts up a form and waits for user input probably isn't doing anything in the meantime. A game loop, on the other hand is going all the time and probably doing alot. Business programmers are not used to thinking in these terms, but games draw down battery power and, believe it or not, how you implement your game will have a great effect on how quickly that battery is drawn down.
So, one question is, what is this game that you "have to" develop? If it is sudoku, no worries. If it's a real-time 3D space battle, that's another story.
If your business apps were on the iPhone, then you probably used 100% Objective-C. (If you were doing C# or Java apps on desktops, then welcome to managing your own memory.) There are those who will tell you that the runtime type management of Objective-C is too slow for complex games. People certainly make OK games using it with Cocos2D and other engines, but again it depends on the game. There are professional developers who will only work with C++ or even straight C.