Learn it!
Learn programming!
Programming can be the most exciting, fascinating and versatile hobby you ever had. It is a unique combination of art and science where you can really make your dreams come true. Your abilities grow as you learn, and after a while you will be able to program everything you can imagine!
Is it difficult?
Yes it is, but you will discover that the process of learning itself can be a very satisfying thing to do. You will need quite some time (up to a few years) to become a good programmer who is able to concentrate on the work and not mainly on the code, but it's worth it, I guarantee! For more about this, read my FAQ page.
Which language?
C++ is the most popular language today and with a reason. It is extremely powerful and ready for very big projects (but for small ones too). That's why most of the professionals use it and you can participate from that advantage: there are great compilers, class libraries, books and web resources available for it. The syntax is concise and logical, the generated code compact and efficient.
For beginners, Java is also a clever way to learn modern OOP (object oriented programming). It is very similar to C++, but avoids some of its pitfalls. You can easily migrate to C++ after a while.
Which compiler?
Microsoft Visual C++ is the most popular compiler. An alternative would be Borland C++ Builder.It's easier to use and enables you to make great Windows programs, with all the bells and whistles. Both compilers are available from about $100 on (Standard version). There are free compilers around, but they are not recommended for beginners.
For Java there are free compilers and tools available which can give you a quick start.
Try my tutorial Java by Example with all the tools you need for free download plus lots of simple embedded applets!

Example programs with Sourcecode

These programs are all made with Borland C++ Builder 1.0 and are supposed to help you mastering the first steps to your own games and programs and to give you some inspiration for your first own projects. The downloadable archive files contain all the sourcecode, project files and bitmaps, as well as the *.exe-files of the programs. You may freely use the sourcecode to learn from it and use it for your own programs. Most of the programs on this page depend on the SuperTimer component for high precision timing. This component is free and can be easily implemented. If you program in Microsoft Visual C++, you find lots of sourcecode on the page My Programs. Check also my Java tutorial with lots of examples. If you need help with any of these programs or have some related questions, feel free to contact me after you have read the FAQ. Have fun and success!

Simple Animation Lines and Circles, an example for double buffered graphics drawing for flicker free animation.

lineanim.zip
(134 kB)

The same demo program, but written with Visual C++ and MFC:

lineanim_mfc.zip
(75 kB)

Bitmap Animation Example program for drawing bitmaps with transparency, using image lists. The vehicles move across the window with different speeds. The program also features a menu and an "Info about" box.

bitmanim.zip
(301 kB)

The same program, translated to Visual C++ and MFC:

bitmanim_mfc.zip
(303 kB)

Clock This little Clock program shows analog and digital time and calendar functions. Country specific weekday and month names in the registry are considered. The time format can be changed to 12 h / 24 h format and there is an optional chime sound every quarter of an hour. Settings are saved in an ini-file.

clock.zip
(323 kB)

Slot Machine A simple Slot Machine with nice, smooth reel scrolling and sound effect. The reels also get slower before they stop, giving a natural appearance. Two equal fruits make a $1 win, three equals $50, if no NULL is among them.

slots.zip
(279 kB)

Chancy Words An interesting little program for creating words at random. You can use one of three algorithms (V=vowel - C=consonant) or let the program decide. On every button click a word is added on top of the list. If the list contains more than 100 words, a word on the bottom is deleted for every new one.

ch_words.zip
(152 kB)

Shoot the Alien Shoot the Alien - a funny little example to demonstrate game timing and graphics handling. Featuring sound effects, intro screen and evaluation. Move the gun with cursor LEFT and RIGHT buttons, shoot with SPACEBAR.

aliens.zip
(237 kB)

Little Monsters Little Monsters - this example demonstrates some more complex techniques used in video games: objects and classes, sprite animation, collision detection and a lot more, though I tried to keep it as simple as possible. Click at the monsters to let them disappear, if you can!

monsters.zip
(146 kB)

Simple Breakout Simple Breakout - an even more advanced example of a simple video game. Uses several classes and pointers, but no bitmaps this time. The game has all the basic features you would expect (ball is reflected with different angels from the paddle, for instance), but a real game ready for publishing, would need a bit more (like different kinds of blocks, that vanish only after more than one ball hit and several levels with different block configurations, bonus objects, animations when ball hits a block etc.). Notice that there are always lots of different (and probably better) ways to solve a programming task than those I have used.

breakout.zip
(362 kB)

Lotto Simulator
lottosim.zip
(191 kB)
Lotto Simulator - test your chances! This program can make up to 1000,000,000 draws of your favorite numbers, single or timer controlled. It displays 4, 5, and 6 right numbers and the relative frequency they occur with. There are some pretty tough problems for beginners in this program:
  • guarantee that different numbers are set by user
  • no number is drawn twice
  • numbers are sorted ascendant
  • the right numbers are highlighted

Worm Game Worm Game - one of the all time classics. Use the cursors to steer the worm. The worm's meaning in life is to eat all the yellow dots (food) and to grow. When he touches the borders or himself, he dies.
There are several possibilities to do the game logic, I used a separate "Worm class" and a dynamically growing array of structures to keep track of the worm length. Also it has to be made sure that the yellow dots are not placed on top of the worm. Every five eaten dots, the level and speed is increased. Game stats are displayed in status bar panes. With sound and nice "dying animation sequence". This example is rather advanced and you can use the things shown here for a lot of similar games.

wormgame.zip
(251 kB)

Rotation Rotation - this demo shows you how to rotate geometric figures around an axis. The functions which accomplish this can be used for any kind of polygon. To make this program even more interesting, I added some options to play with. When you check "Draw trails", the background isn't repainted.

rotation.zip
(140 kB)

Sinus Sinus - demo program to visualize a sinus function. You can change the parameters Frequency and Amplitude. Nothing exciting, but little demo programs like this are always useful as a reference (you can never have enough of them).

sinus.zip
(135 kB)
To be continued...

Recommended Software and Literature
Click on the pictures to read more about the titles and to order online at Amazon.com

MS Visual C++ 6.0     Visual C++ is by far the most powerful and feature-rich integrated development environment (IDE) out there. It has extremely strong integration with the Microsoft help/documentation system, called MSDN Library. The compiler is also extremely fast. Nearly all world-class software is built using the Microsoft Visual C++ development system.
Practical Visual C++ 6     To get started with Visual C++ you need a book like this. This one picks out the key features you really need to know to start getting a handle on Visual C++, and covers them clearly and thoroughly.
C++ Primer Plus     To learn the C++ language this is an excellent book in any way, I strongly recommend it. 1000+ pages for just $35 and lots of examples. C++ Primer Plus are classics, having sold over 100,000 copies!
If you have chosen Microsoft Visual C++, you need at least one good book that covers the class library and framework MFC and Windows programming in general. The one on the left by Jeff Prosise is a "must have", but the other two are also worth their money, they helped me a lot.
Programming Windows with MFC The MFC Answer Book Visual C++ MFC Programming by Example

There are not many good books to guide the newbie into game programming. You might try the first one here, which is excellent, but the other two on Java game programming are also recommended. I started with Java, wich is very similar to C++, but easier and you can use the things you learnt in that language very well in C++ too.
Windows Game Programming for DUMMIES Java Game Programming for DUMMIES Black Art of Java Game Programming

C++ für Kids
   
For German readers there is a cheap possibility to get access to Borland C++ Builder 1.0 (maybe someone knows about a similar opportunity for English readers?). It's on the cover CD of this book (full licensed German version), which otherwise is very poorly written. But for DM 40 ($20) the compiler is a bargain. All the programs on this page are built with it.



www.programming.de
watson@programming.de