Writing Xenimus
I get a lot of emails where people ask me how I wrote Xenimus and what it takes to write a game. So here is a detailed answer to that question.
Computer Languages
First you need to select a computer language. All computer languages can be classified into 2 groups. True compiled languages and interpreted languages. A true compiled language is one that takes the code you type and converts it directly to the actual assembler code that will do what you asked it. Interpreted languages have an interpreter program that looks at the code you type and figures out what you want it do do and then makes a call to a prewritten function that does it.
True compiled languages: C, C++, Pascal (I'm sure there are others but these are the most popular)
Interpreted languages: Visual Basic, Powerbuilder, Microsoft Access, FoxPro (basicly all languages but C and pascal are interpreted)
There are very few true compiled languages in the world because they are hard to create. So most new computer languages are interpreted with the interpreter written in C++.
Now I know there are some people out there who know Visual Basic saying "I can compile my Visual Basic programs." Certainly you can compile a VB program but it does not actually compile to assembler. What it does is pre-translate the code you type so that interpretation step is skipped during program execution. That gives it a bit more speed. There are 2 methods used for compiling with an interpreted language but I wont get into how those work now.
Interpreted languages require a ton of DLL files and other support files to be distributed with the EXE in order for it to run. This can be a major problem and its very expensive to buy the rights to distribute those support files and just think of the huge download size a program would be.
So at this point I hope I don't have to tell you what language choices you have. Obviously you want speed for a game so your going to use C or C++.
Pascal is a good language that I use sometimes for other things. There is a computer language called Delphi that is really just Visual Pascal. It is what I would consider to be the best windows development tool in the world today. Delphi is a true compiled language but has more bounds checking and error handling built into it so its not as fast as C. It also has a nice visual design development environment like Visual Basic. So in short, Delphi is very close to the speed of C++ and is almost as easy as VB to program.
So the main Xenimus.exe is written in C++ and the SETMODE.EXE for selecting the graphics mode is written in Delphi.
DirectX / OpenGL
Now lets talk about DirectX and OpenGL.
OpenGL is a graphics function library only, it has no functions for sound, keyboard input, mouse input, or game paddle input.
DirectX has everything, it does the graphics, sound, all forms of input including steering wheels and force feedback.
Some games have chosen to use OpenGL for their graphics but still ended up using DirectX for sound and other things. I can understand why people might do that simply because in the early days of DirectX it was total crap. Even today I think OpenGL is a lot easier to use than DirectX will ever be. OpenGL is a very simple straight forward tool. Setting it up and getting the functions to work is about 10 times easier than DirectX. And that's no exaggeration, it is actually about 10 times easier to deal with.
When DirectX first came out it was a complete joke, there was no way in hell you could use it to write a game. Now with the latest versions of DirectX out there it is a far better tool and can actually be used to write some good software and most game companies are using it now.
I cant begin to describe to you the HELL I went through trying to figure out how DirectX worked back when it first came out. There was not a single good book out there on DirectX and I own them ALL. I'm not kidding here, I actually bought every book I could on DirectX and they were all total crap. Only within the last 2 years have some good books been coming out on DirectX.
So here are the books on DirectX that I like:
Tricks of the 3d Game Programming Gurus --
Andre LaMothe
Andre actually wrote another book, I have not read it yet but it seems like its
going to be really good.
Tricks of the Windows Game Programming
Gurus -- Andre LaMothe (covers 2D DirectX programming)
Andre is a good programmer, his programming style is almost exactly the same as
mine and I understood everything he wrote with no problem.
The Xen of Direct3D Game Programming --
Peter Walsh, endorsed by Andre LaMothe (Covers the 3D stuff of course)
Peter is a very smart guy I'm sure, but you would not want to use his code in a
game. He does some goofy things that are just not good for games. If you study
his code you will see where he creates and destroys objects during the rendering
of each frame. This is nuts, you cant have that kind of code in a game. I was
able to boost the speed of his samples a fair amount by changing some things
around. For the most part though, this is one of the best books out there.
Advanced 3-D Game Programming Using
DirectX 7.0 -- Adrian Perez, Dan Royer
This book is OK, I keep it around for a second opinion on things, but I don't
like the coding style and some of the samples didn't seem to work that well. Its
a decent book though.
These are the best 4 books I now of.
Conclusion
Let me finish this off by saying that you WILL NOT find an easy way out to writing games. No game creator program will ever do what you really want so don't even waste your time with those. Those are like get rich quick ads on TV, they don't actually work.
If you want to write games, you will have to fully read and understand at least the 3 books I have talked about above, and you will have to write several small games to help learn how it all works before you can even attempt a larger game.
I hope this helps,
EJ