Building a 2D Game Engine from scratch or learn Cocos 2D - cocos2d-iphone

As the title says, next year I´ll be focusing in on game programming on mobile devices. And I am unsure if I should start straight with learning Cocos2D as there are alot of great teaching materials for this engine, and I think it is quite capable. Or should I learn to program my own engine - I have this 400page book by Michael Daley wich teaches you to build a simple 2d engine and game ground up using particle effects, tilemaps and all that...
My question is would there be any great advantages of knowing how an game engine is built from scratch and then move to learning Cocos2D or could i safely just drop this and move straight to learning the Cocos framework? and is it especially hard building a 2D engine, etc.. do I need any specific math skills and such?

Only for iPhone then Cocos2D is best option. To support android too then use cocos2d-x
Cocos2D : Objective C - 2D game engine for iOS
Cocos2D-X : C++ based game engine for iOS / Android

I would say that you need to decide whether your goal is to create a 2d game or to learn how to make a 2d game engine. If your goal is to make a game right away then I would use some ready-made engine. I'm not familiar with Cocos2D so I can't say if it is a good choice, though.

Related

What is a C++ equivalent to JavaFx and AnimationTimer class?

I have a tetris game programmed in JavaFX. I want to translate it into C++ to learn C++. What can I use in C++ to display the graphics and time the game loop, the way I did with JavaFX and the AnimationTimer class?
C++ really doesn't have any in-built compatibility for graphics. You need to learn an API.
Looking at JavaFX it seems to be a 3D rendering library. So this really is determined by how deep you want to go.
If you want to learn the baseline, engine design, etc. you could learn OpenGL directly which would teach you the nitty gritty of how all 3D graphics work and SDL2 http://wiki.libsdl.org/FrontPage for the OS interop. Timing the game loop can be done easily with the std::chrono classes.
If you want something slightly higher level where things like lights and such are already built for you I'd consider working with an existing framework that will give you practical experience towards game development. Most of these use scripting languages like C#, Lua, etc. Unity C# is great for something like this. Unreal Engine 4 has C++ bindings if C++ is the main consideration, but it is a bit heavy for such a small game but most game engines only use C++ for their optimized low level frameworks with scripting engines hooked on to them for ease of development while maintaining near optimal performance.
Ogre is another option for C++ open source engine that has a lot of documentation. http://www.ogre3d.org/ Which could be a happy medium between the 2.
If you don't care about 3D graphics and just want rectangles / images in your game something like QT could work well also, but that is a GUI framework more than it is a game engine which if all you are wanting is something like Tetris is fine.

What limitations will I run into making a game with Allegro / SDL vs. OpenGL / DirectX?

So I have a bunch of experience with C++ and Win32 programming and I am looking to create a 2D game with a couple of friends of mine. I have also dipped my toe into DirectX and OpenGL, but would prefer to use as simple of a library / API as possible when developing this game both for reducing the learning curve and making the development process easier / faster. However, I don't want to limit myself to much with regards to what I can and can't do in my game based on my choice here. What functionality / features would I lose out on by going with something like Allegro or SDL vs jumping straight into OpenGL lets say. I realize you can do other things aside from just graphics with Allegro, etc., but will I be able to build a fully featured game with something like Allegro?
Yes, it is possible to create a good game with libraries like Allegro. There is a few nice games in their depot to prove that. And I remember a few shareware games created using Allegro. It all depends on what kind of game you want to create.
But AFAIK Allegro and SDL are C libraries and if you are familiar with C++, you may try SFML or Cinder which could further simplify the process.
If you are only into creating a game comfortably and don't care about the technology used maybe using a complete engine like Unity3D or Unreal engine, which are free until you make a considerable profit out of the game.
You will miss out the lighting part you generally do in a fragment shader. Other than that, using a pure 2D api can significantly reduce your amount of code, because you do not need to write your own shaders, nor the interface between shader and c++ code which is often even more work and maintenance than the shader itself. Since shader code is mandatory in modern OpenGl my recommendation is SDL2.

Game map for DirectX

I am making a game in DirectX 9/C++. I do not have a lot of knowledge about directX. I want to make a map for my game similar to GTA 1. I want to know is there a way to make whole map in some other software and then import and render that map in my directX application.
If, not what are alternatives?
DirectX is not a game engine. DirectX is a programming API. Things like maps, game logic, and so on are completely beyond what DirectX does. It's your burden, as a programmer to implement these things.
Honestly, if you have to ask this question, you should not use DirectX directly, if you want results fast. Instead use an existing, available game engine and implement your game using that. In the past years a number of high quality engines have become available for little money or even free. To name a few:
Unity
Unreal Engine or SDK
CryEngine
Source SDK
There are also a few open source worth looking at:
IrrLicht
Ogre
CrystalSpace
You may also want to look at open source games, which engine you can repurpose. Specifically I'm thinking about Cube2 / Sauerbraten and it's successor Tesseract here.
I would really recommend to use an Engine like Unreal Engine 4. You can get it for little money and it does a lot for you. You can spend a lot of time in designing your game, so you dont need to spend that much time which directx and stuff.

C++ Game Programming Resources

Where can i get some advanced game programming resources for c++?
At http://gamedev.stackexchange.com ?
More specifically, this question and lots of others tagged with c++
Start with writing some simple 2D games, e.g. Snake, TicTacToe, etc. Write these using any GUI builder you're already familiar with.
Then try to rewrite these games using a serious graphic engine, e.g. SDL, OpenGL, or DirectX.
Then try to write a more complex 2D games, e.g. side-scroller. Write these games with the graphic engine of your choice.
Then add some simple 3D effect to your 2D game, e.g. parallax scrolling.
Then rewrite this effect with true 3D, use 3D models/sprites, 3D environment, etc, while maintaining a 2D look and feel.
Then add some simple 3D look and feel, e.g. allowing characters to move in the Z-direction (to/from the camera), doing camera rotation, etc.
If you just got out of the command prompt and simple GUI, you'll probably want to start simple.
I'd very much recommend OpenGL as your API of choice. Since you've done some simple GUI programming, you'd know what an API is.
OpenGL has the following advantages (compared to SDL and DirectX previously mentioned):
-Its hardware accelerated (SDL is not as far as I know)
-Its 3D (SDL is 2D)
-Its cross-platform (DirectX is Windows only)
By far the best place to start with OpenGL is the Nehe tutorials.
http://nehe.gamedev.net/
Game programming becomes evident once you become a bit more familiar with the API.
Also, I'd heartily recommend GLUT (OpenGL Utilities Toolkit). It simplifies window creation and user input handling, among other things. Its great for learning OpenGL. It also happens to be cross platform.
Here's freeglut, a free GLUT implementation:
http://freeglut.sourceforge.net/
OpenGL is also a relatively simple and easy API to learn. You'll be going into 3D in no time.
What libraries are you using? You can try GP wiki. It can be a bit hit and miss depending on what you want to use.
By "resources," do you mean tools? Libraries? Tutorials? I have a bunch of useful game developer links in the sidebar of my own site. I also think "Mathematics for Game Developers" was very helpful. It has a second edition as well.

What suggestions for a 3d game engine to support a huge terrain?

There are a lot of 3d game engines around, does anyone with experience with them have advice on which one would likely be able to handle these (arbitrary) requirements?
opengl
mac/pc
1000x1000km terrain
1000 towns varying in size from 10
to 1000 buildings
128 people in any one location
MMO type networking (no solo play)
physics engine including airfoil (ie airplanes)
c++ with optional scripting
You can look at Ogre3D. It supports OpenGL/DirectX, Mac/Linux/Windows, written in C++. But it is not game engine, it is 3D rendering engine. You can integrate other networking/physics engines with Ogre.
I'd like to suggest the Torque Game Engine. Some of the things you're asking for aren't really possible (as others have pointed out), but are problems that have to be tackled in a round about way (like faking the airfoil physics). The Torque engine would be a good starting place for you. There's also a 2D version called Torque Game Builder which might be easier to start with.
www.garagegames.com
A plug for openscenegraph, has all of that plus paeed terrains, level of detail LOD etc - it's used by flightgear flight simulator as well as a lot of commercial and military simulators