Showing posts with label Allegro. Show all posts
Showing posts with label Allegro. 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 >>

TicTacToe Xtreme

This is the classical strategy game of Naughts and Crosses or more popularly known as Tic-Tac-Toe. The game comes with a twist that makes it more enjoyable. Before the game starts, a player has to be chosen among the available options to compete with a smart computer A.I. The game begins with a certain balance in each player's account. Each victory wins you a certain amount from the opponent. Strategic planning is required before each round as there may be tradeoffs. Player going first may have an advantage as he gets to make moves at 5 out of nice places. You may chooses to go first or let your opponent go first. However if you decide to take the advantage you will have to give up certain amount. The one with a better overall strategy who wins all the money from his opponent is the ultimate winner. The game is over when one of the player is bankrupt. The screens for the game are below:


The Home Screen


Choose a Player

The Game Screen


You can download this game for free. Just follow the link below:
Download
Read more >>

BalloonStrike


This game is a first person shooter which involves shooting balloons and scoring with limited resouces like time and ammo. The game involves three stages of difficulty: Easy, Medium and Hard. Each level offers you a different objective and requires different skill and strategy. Top score in each level is stored by the game along with your name. The screenshots for the game are below:

The Home Screen


The Game Screen

You can download this game for free. Just follow the link below:

Download





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.