How to get started with game programming using VC++,C++,DirectX quickly? - c++

Hi I am working in VC++ and I am quite interested in game programming and I have few queries.
1).What one must know before starting game programming ?
2).Can anybody give me info # resources like tutorial ,links ,etc. which would help me to start as fast as possible ?
3).Also give me info # some good books on game programming ?
Any help would be greatly appreciated.

Before you start programming you must have a good understanding of the language, how to program and how to structure and test your code. Oh, and a huge amount of either patience or free time. On the maths front, Vectors, Matrices and Quaternions are the main things I found I needed.
The other thing that often goes overlooked when I programmer starts writing a game is someone to create the assets. Preferably someone specialized in it.
You mention DirectX, which is not actually a fast way to go as you have to build everything from square one, which means a lot more maths, performance testing and overall handwork. I would suggest at least a rendering engine like Ogre3D. There are plenty of tutorials and a very good community.
There is a good post here on why you should write games not engines.
The main reason you would want to use DirectX is to enhance your understanding of the lower levels, all the things an engine is abstracting for you. While I think this is a good thing to do, I wouldn't want to do it for a major or first project.
The main site I used for help was gamedev.net, although I also found some intresting articles on gamesutra

It takes time and requires a lot of patience. And playable game is more than just working C++ code.
gamedev.net.

First, download Visual C# Express Edition, and then download XNA Game Studio 3.1.
After that, check out the XNA Creators Club - that has lots of help to get you up and running quickly.

Are you 100% dedicated to C++? If not, I would recommend starting with XNA/C# instead. DirectX will force you to spend a lot of time up front learning API calls before you ever get something on the screen. XNA will allow you to start coding your game very quickly while getting immediate feedback while you program.
If you are committed to C++, I would recommend Beginning Game Programming by Jonathan Harbour. He starts with an easy to understand framework that won't take long to pick up. Remember that to use DirectX you will have to learn win32, and low level DirectX code.
For tutorials, try googling "c++ beginning game programming tutorial". Gamedev.net will be another invaluable resource. Go to the "For Beginners" forum and look through the stickies.
As for what you must know, it depends on your aspirations and your choice of tools. As a beginner, you will want to start small and in 2D or text games. To get a Pong game going in XNA, you only need to have basic C# skills and basic collision detection. To get a Pong game going in DirectX, you will need to understand win32 code, and a ton of device calls. To do a console text game, you only need to know basic C++ and maybe some basic gameflow techniques.

If using DirectX is not a fixed requirement, you should consider OpenGL, and use a library like SFML or Allegro to handle all the basic stuff.
http://www.talula.demon.co.uk/allegro/
http://www.sfml-dev.org/

Related

Rudimentary 3D graphics in C++ .NET

I am looking to implement an extremely rudimentary FPS game with extremely rudimentary 3D graphics using C++ .NET and DirectX.
I'm not interested in any third party libraries or anything special like that.
Having never done graphics based programming besides 2D stuff I don't really know where to get started or even how to find the right resources online.
I have a few weeks to build this game so im trying to keep it simple.
Can anyone give me a little guidance on how to get started?
This looks as though it may give you a push in the right direction:
http://zophusx.byethost11.com/tutorial.php?lan=dx9&num=0
I always found that OpenGL was easier to learn though. So unless it's necessary for you to use DirectX, I'd suggest you have a quick look at GL and see what you think.
If you download DirectX SDK you can find plenty of samples there in C++ and C#.
May I recommend "Introduction to Game Programming in DirectX 9" by "Wordware" Publishing. I know you just want something very simple like the rotating cube classic, so do not be put off by the 'game' element. I got 3/4 the way through and wrote a screen saver! DX10 is now available but I stick to 9 - card backward compatibility.
The maths can get silly in 3D, but if you can get the basics, the rest will follow very quickly.
If you haven't done so already the "DirectX SDK" download is also a must - it contains (most important) the help files for the methods, functions etc. and a few not so helpful getting started stuff.
You might want to have a look at SlimDX, even if you're not interested in third-party libraries.
Although I don't have Visual C++ 2008/2010 Express installed, you could add SlimDX as a reference to your project. Be sure you check out the tutorial section, even though it's in C#, but if you know C++/CLI pretty well, you should be able to convert the code to C++/CLI.

Exemplary 2D game engine

Is anyone here able to point me to a simple and well designed C++ 2D open source game engine? The genre is less important, I wish to learn by example. I wouldn't want anything particularly complex as I'm interested in learning general concepts, rather than getting into the nitty-gritty of the engine implementation.
If I were you I'd look into ClanLib - it is open source, cross platform, and the source packages contain 50 or so easy-to-follow examples, from simple image rendering, to a fully working server-client dice wars implementation.
And if you're eager to get started it's easy to set up with Visual Express, so you can play with in in no time.
Also: here are some others if you want to give them a try.
Personally I learned a lot, looking through the source code of Frogatto, even the source code can be viewed only here.
It is of course a more complex game, but there is much to learn regarding software/game architecture and design.
Have a look at SuperTux, it's a nice little platformer game inspired by Mario, written in C++.
There is a builtin level editor, too.

If I wanted to make a Pac-Man Game?

I am immediately placing this as a community wiki thing. I don't want to ask for help in programming yet or have even a specific question about programming, but rather the process and the resources needed to make such a game.
To put it simply: My college friend and I decided to give ourselves a really big challenge to further our skills in programming. In six months time we want to show ourselves a Pac-Man game. Pac-Man will be AI-controlled like the Ghosts and whichever Pac-Man lives the longest after a set of tries wins.
This isn't like anything we've done so far. The goal here, for me, isn't to create a perfect game, but to try and complete it, learn a whole bunch in the process. Even if I don't finish in the time, which is a good possibility, I would want to have at least tried this.
So my question is this: How should I start preparing myself? I already have started vector math, matrices, all that fun stuff. My desired platform would be DirectX 9.0c; is that advisable? Keep in mind that this is not a preference just for this project, but I wish to have some kind of future in graphics development, so I want to pick a platform that is future-safe.
As for the game development in general, what should I take into consideration? I have never done a real game before, so any and all advise to development of mid-scale projects( if this would be a mid-scale project ) is greatly appreciated.
My main concerns are the pit-falls and demotivators.
Sorry if the question is so vague. If it doesn't belong here, then I will remove it. Otherwise, any and all advise regarding making larger projects is greatly appreciated.
Given you've not tried this sort of thing before here's a few things I'd recommend.
Start with something other than DirectX (and presumably C++)
DirectX and C++ expose you to a lot of low-level stuff you can learn later. Keep things simple and perhaps try XNA and C# which is close enough you can port it later but will let you skip a lot of things like memory management and pointers for now.
Start with 2D instead of 3D
The original Pacman is 2D so you won't be needed vector math for now.
So where does that leave you?
Well, a few things to think about are the game loop, keeping things in sync, updating the screen and responding to user input.
These are great principles and will let you get something up and running a lot sooner. Do not underestimate how important it is to keep seeing progress - this is hard if you set the technical bar too high initially.
I'd go down this route (ordered to keep things fun and interesting)
Get a screen displaying - this is highly visual
Get a Pacman responding to user input
Get Pacman constrained to within the walls
Get a ghost responding to secondary user input - you can chase each other
Figure out some collision detection
Get the dots and power pills rendering so you can score and eat ghost
Render some more ghosts and figure out AI
Work out the code for finding when the level is complete
Make the map change and state reset when on a new level
Once you've got this working and running you can then decide if you want to play with better AI, 3D math or switch over to C++.
I had to write a pacman game in Java for an OO class. I found it to be very straightforward, possibly with the exception of figuring out the best way to map walls. After a bit of research, I came across this: http://javaboutique.internet.com/PacMan/source.html which uses bit-shifting to determine walls. It looks like complexity overkill, but I found it to be pretty elegant after I played around with the math a little. Other than that, pacman is a very array-friendly concept, so use an array for the board, some basic sprites, tinker with the speed and refresh, keep track of game data, and toss it in a loop.
As for the AI with the ghosts, there are articles written about them. Each ghost has a specific "strategy". Or you could roll your own..you could program them to be as easy as always heading towards pacman (or his general location/quadrant), or as complex (shortest-path) as you'd like.
Play pacman! This is the first task for your project!
I'd look at the original arcade cabinet assembly code for Pacman and the description of what it does. It's a real eye opener :)
Personally, here's what I would do:
study open source games to see what they do
buy a book about game programming (actually, I have a book about game programming already, but you probably want something more recent than that)
pick a toolset/game development library (Sourceforge, Google Code)
work through the tutorials that come with that library, possibly change to a different library if the API is too weird
come up with a requirements document
draw up a first pass design ("plan to throw one away"), try to have somebody review it
decide on a test plan
write up a schedule, not because I want to stay on schedule but because I want to break things down into easily-defined tasks
write the smallest complete game I could (eg., a Pac Man sprite that I can control inside a window: no maze, ghosts, score, lives, ability to die, etc.)
add features to that game until I've implemented the whole thing
Sounds like a good idea for a learning project! The 2 general things I recommend for your approach are
work in iterations
read a bunch about C++ and DirectX along the way
Start small -- write some code that does nothing more than draw Pac-Man on the screen. Then build on that by implementing movement across the screen. Then build the map boundaries and the inability to travel through them. And continue in this fashion, prioritizing the next task you need to complete, and then doing whatever it takes to complete it. Try not to make the tasks too big.
In order to figure out how to complete the tasks, you'll need to read. Books, web sites and existing code are all very helpful in figuring out how to do what you want. It's worth looking at several different ways to complete the same task, because some ways are better than other, or might better fit your project.
Good stuff! I am glad that Pacman motivates and inspires you.
Things to get started.
1) Decide on the development environment.
a) Are you building a standalone game or a networked game.
b) Which language are you targetting at to improve?
2) How well versed with AI?
3) How well versed with the programming algorithms techniques - like A * (A star) path finding, Dijkstra algorith, collision detection, hit testing or even recursive programming?
4) Are any of you talented in graphical design?
Good luck.
P/S FYI, if I were to write a Pacman game, I would do it in C# and Silverlight 4.0 (I can write C++ comfortably but my priority is to jump on the Silverlight bandwagon).

Linking a GUI toolkit to C++ input

This is my first time asking here but I've been a reader for ages! A fantastic place to learn!
I was asked to design a simple board game as a programming project this semester (using C++) and to implement GUI for a bonus mark. I was rather lost reading through tens of possible GUI toolkits and not knowing which one to use. I'm rather a beginner and this is my first big project!
My requirements for GUI are very very basic. All I want is to allow the user to pick from between two options at the start of the game. Those options determine which character the user will pick in the game to play with. This is the only input I want from the user. The console program would receive this input, interpret it and do all the logic of the game in the console window.
Currently, the console window displays a numbered list of options for the user who then picks a number and based off that character input, the console knows what to do through some if-statements.
Up till now, I've been told that GTK+ is a good option and I've been advised to check out wxWidgets and QT4. I'm confused on which one to use since I want something fast to learn and simple to implement because the purpose I want it for is also simple. I was also rather reluctant to start learning a GUI toolkit from its basics then realizing it might not have my simple requirement.
Thank you in advance fellas and sorry for the rather long post!
If you want something pretty basic as far as a GUI goes, it might be worth looking into some sample applications from any of the named projects. See what you can find in a sample application that is most similar to what you have, and try to get that working. Then once you have it working, and tweaked to your liking, maybe play around with things a bit more then for a further/better understanding.
My previous experience is with WxWidgets and Qt. My advice would be to check out Qt because of the great documentation for the project as well as the QAssistant.
Good Luck, GUIs can be really fun to incrementally learn!

Recommendations for C++ open source game engines on IPhone

I decided that I want to make a game for the iphone I was thinking of using oolong or sio2 any recommendations?
Both have the problem of lack of tutorials, is it possible to somehow use a normal C++ game tutorial and integreate the engines rather than the one used in the tutorials? So if the C++ tutorial talks of creating an engine I can skip it and use sio2 or oolong?
Thanks
You're making a game, not a game engine. The short answer is, yes, you can just use those engines to make the game.
The long answer is that you should probably go through the tutorials doing it the way that they do it just to get a feeling for C++/OpenGL/whatever. Then, using the knowledge that you have gained, make your own game using oolong or SIO. Trust me, you are not going to want to use the code you wrote when you were learning C++ to make an actual game, unless you can read something and immediately master it.
Look into Unity. Not C++ for the scripting, but it's a very popular engine.
How about cocos2d? It's BSD license, has docs and tutorials, and I've seen many people use it to create a game in a day.