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

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.

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.

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.

Mac dev - Help getting started with 2d games

I want to make some simple 2d games/clones (for Mac), but I have a few questions:
Should I use Quartz 2d or OpenGL (I don't plan to try 3d anytime soon)
There seems to be a lot of typedef'd things like CGFloat/GLfloat, which should I use?
Should I use Objective-C for the game too (classes) or just C? (I assume I'll use Objective-C and Cocoa for window and views.)
Is it fine to redraw the entire view each time? I don't really understand how the NSView's -drawRect dirtyRect parameter works, how does it know what I want to update?
Are there any good tutorials for this?
Thanks.
Quartz or Core Animation vs. OpenGL really depends what you're trying to do. If you want simple drawing and animation, use Quartz or CA. If you want fast/powerful games, use OpenGL. Eventually I'd suggest learning both.
For the typedef'd things, use whichever is meant for the specific system you're using. For Quartz/CA/CG, use CGFloat. For OpenGL, use GLfloat.
Objective-C vs. C also depends on the speed you want. Objective-C adds a little bit of overhead but will (obviously) let you create much more object-oriented games. I'd suggest using Objective-C if you use Quartz and Core Animation, and either Obj-C or C if using OpenGL. However, if you're doing this on a Mac (e.g. not for iPhone), you probably won't see much difference unless you're doing complex fast drawing.
I'm not entirely sure about drawRect, but this question has some information which may answer that question for you.
For an intro to Quartz, I'd recommend this tutorial, and I've always heard the NeHe tutorials recommended for OpenGL.
If you use SDL with either Cairo or OpenGL, you get virtually the same programming model, but you get cross platform compatibility virtually for free. You should even be able to continue using objective C for the bulk of the game, if you want.
How graphically intensive do you want to get? Cairo will probably be easier to just get going with for 2D.

What environment should I use for 3d programming on Linux?

One thing I always shy away from is 3d graphics programming, so I've decided to take on a project working with 3d graphics for a learning experience. I would like to do this project in Linux.
I want to write a simple 3d CAD type program. Something that will allow the user to manipulate objects in 3d space. What is the best environment for doing this type of development? I'm assuming C++ is the way to go, but what tools? Will I want to use Eclipse? What tools will I want?
OpenGL/SDL, and the IDE is kind-of irrelevant.
My personal IDE preference is gedit/VIM + Command windows. There are tons of IDE's, all of which will allow you to program with OpenGL/SDL and other utility libraries.
I am presuming you are programming in C, but the bindings exist for Python, Perl, PHP or whatever else, so no worries there.
Have a look online for open-source CAD packages, they may offer inspiration!
Another approach might be a C#/Mono implementations ... these apps are gaining ground ... and you might be able to make it a bit portable.
It depends on what exactly you want to learn.
At the heart of the 3d stuff is openGL, there is really no competitor for 3d apps, especially on non-windows platforms.
On top of this you might want a scenegraph (osg, openscengraph, coin) - this handles the list of objects you want to draw, their relationship to each other in space the ability to move one relative to the others, selecting objects etc. It calls opengGL to do the actual rendering.
Then on top of this you need a gui library. Qt, Fltk, wxWigets or one built into the scene library or written directly in openGL. This handles the menus, dialogs frames etc of your app. It provides an openGL canvas to draw into.
Personal choices are openscenegraph and Qt
For the 3D part, I strongly recommend the SDL Library with the OpenGL library
You can get some tutorials here
Qt has a pretty decent OpenGL-based graphics module.
Maybe you should consider using a graphics rendering engine such as OGRE. Coding a CAD program from scratch using OpenGL will take lots of time.
On Linux you have no competition to OpenGL.
It's one of the big players in the 3D field, so it's definitely worth learning.
This site has some excellent guides and code examples (on various languages).
You can use OpenGL with many languages, naturally on C and C++ but also for example with JAVA using LWJGL or other API's.
If you want to program at "a higher level" than opengl, use vtk. It is quite easy to get started and has bindings to many languages.
See www.vtk.org
you may use OpenSceneGraph for rendering.. it is an OpenGL based library..
and you may use OpenCascade.. it is good for 3D modelling...
we are implementing such an IDE at work and we use these things.. using pure OpenGL may be hard for you... anyway you may try...
for interface it is good to use Qt..
and i suggest you to use Eclipse if it is Linux..
(if it was Windows, suggestion would be Visual Studio)
For a C/C++ IDE, you have the following options:
KDevelop - KDE-based
Anjuta - GTK-based
Netbeans
Eclipse
Of course, you could also use a language like C# or Java:
Best OpenGL Wrappers for Mono and .Net
JOGL
There's really no reason why a simple CAD application would have to be written in C++.