Showing posts with label Game Programming. Show all posts
Showing posts with label Game Programming. Show all posts

C++ Game Programming Tutorial


If you are interested in programming games using C++ and do not know where to begin, this is the article for you! Here I have provided a tutorial to teach the basics of game programming using the Allegro Library in C++. If you not already know, Allegro is a external library for C++ that allows functionalities to code games with graphics and user interface.

Before you begin:
  • You must have some basic knowledge of C++
  • You must have Allegro Game Programming Library installed and working with the C++ compiler of your choice. For information on this refer to: Install Allegro

This tutorial is a comprehensive powerpoint presentation. It comes with a demo game and its code.

In the tutorial:
  • You will learn about the very basics of game programming.
  • In the process of this interactive learning you will also write a very simple game to gain some hands-on experience.
  • You will learn the syntax and the purpose of the common in-built functions provided by the Allegro Game Library.

You can download the tutorial here:

This tutorial was prepared by me for absolute beginners. If you have any doubts or find any errors do let me know. Any comments are appreciated!
Read more >>

Word Game Solver

Word games like text twist, wordShuffle are great for time pass. They are not just intellectually challenging but also fun. All you need to do is figure out all possible words using the letters given within the specified time. It not only requires a strong vocabulary but also a good visual memory. To try out your skill at such a game play one below:



My first encounter with this game was when a friend of mine challenged me for a game on facebook. Since I am not into playing flash games (except maybe during computing lessons in lab) the game was not intriguing but something else was -- the fundamental logic with which the mind works to find the scrambled words. My programming instincts encouraged me to code this logic and what came up as a result was a word game solver.



This piece of software takes in the scrambled letters and gives you all the words that can be formed with them. So if you are too stressed playing such a game then you can have the computer find the words for you. You can download this solver here:


Most people may regard this as cheating. However if you use it for friendly games and in good spirit, it may not be of major ethical concern. Have regards for those who have spent months of practice and loads of mental ability to set high scores.

Read more >>

The First Click

The idea of game programming struck me when I was talking to a friend about doing something during the holidays. I began researching about programming games using C++. I chose C++ because I was very familiar with most (if not all) aspects of this language. During my research I came across this word “Allegro” a number of times. My next step, as any amateur researcher, was to check for “Allegro” on Wikipedia and what came up was:

http//en.wikipedia.org/wiki/Allegro_library

“Allegro is a free and open source software library for video game development.

The functionality of the library includes support for basic 2D graphics, image manipulation, text output, audio output, midi music, input and timers, as well as additional routines for fixed-point and floating-point matrix arithmetic, Unicode strings, file system access, file manipulation, data files, and (limited, software-only) 3D graphics.”

This description was good enough for me to look for some online site that describes how to download and install allegro to work with my Microsoft Visual C++ Express Edition 2005.

Deviating from the topic let me first talk a bit about Microsoft Visual C++ for those who are hearing it for the first time.

“Microsoft Visual C++ (often abbreviated as MSVC) is a commercial integrated development environment (IDE) product engineered by Microsoft for the C, C++, and C++/CLI programming languages. It has tools for developing and debugging C++ code. The idea of express editions, according to Microsoft, is to provide streamlined, easy-to-use and easy-to-learn IDEs for less serious users, such as hobbyists and students.”

In simple terms, it just provides a platform for you to write your codes, compile them and create executables. Other C++ IDE is DEV C++ which is preferred by other programmers. However I will stick to explaining MSVC since I like its interface, formatting and appearance.

Coming back to Allegro,

After a Google search I found these websites dedicated to Allegro Library.

· http//www.talula.demon.co.uk/allegro/readme.html . This might be helpful to understand more about Allegro and download latest versions and tutorials.

· http//wiki.allegro.cc/. This site contains most information you would need with extensive resources and hyperlinks.

· http//www.allegro.cc/ . This is a forum, which will be really helpful for troubleshooting and learning new stuff.

After going through the various sites I finally found this page which was dedicated to configuring allegro with MSVC 2005.

http//wiki.allegro.cc/index.php?title=Visual_C%2B%2B_Express_2005

I followed the links provided to download the compatible version of allegro and followed the instructions to install it. After some initial troubles with the configuration settings I managed to get allegro working however with a slightly different configuration setting than what was listed:

  1. Select Project / Properties....
  2. Under Configuration Properties / C/C++ / General, change Debug Information Format to Program Database for Edit & Continue (/ZI).
  3. Under Configuration Properties / C/C++ / Optimization, change Optimization to Disabled.
  4. Under Configuration Properties / C/C++ / Code Generation, change Runtime Library to Multi-threaded Debug DLL (/MDd).
  5. Under Configuration Properties / Linker / Input, add alleg.lib to Additional Dependencies.
  6. Under Configuration Properties / Linker / Debugging, change Generate Debug Info to Yes (/DEBUG).
  7. Press OK.

I added alleg.lib to the additional dependencies instead of alld.lib

Then it was time to start learning allegro programming.

The first and most useful tutorial that I used was C++ Game programming at http//www.cppgameprogramming.com/

It covered almost everything that I needed. Then to take a look at the advanced allegro features I directly jumped to the Allegro Manual and documentation which is so well-written that I didn’t require any further tutorials. With this I was on my way with game programming.

Read more >>

This is Amulya Khare's blog cum website. You can know more about him by viewing his profile.

Read about his views and ideas on topics that grab his attention.

Also you can view his work and projects.

Included here are some resources and articles that you might find interesting or helpful.