Programing Games

Well school is here again, and I’m already bored out of my mind.

Thinking back to the days of High School in my C++ Class, I remember one of the advanced kids making his own version of a WarCraft type game, and another student making (if memory serves me right) a final fantasy game.
Now these were definatley not as refined as the actual releases of the games, but were still pretty cool, because you could customize them.

I’ve seen a few Create your own RPG Sites out there, I beleive the best one I found had some long anagram looking name, but even those were too confining for me. (especially to make a WarCraft type game)

My question is, assuming I decide to make this my new hobby, what would be the best programming language to execute it in, and is there any freeware out there with which i can do it?

You can start with Visual Basic, but most of the major releases are written in C or C++. Start there, then learn DirectX for graphics. DevC++ is a good, free, starter compiler, but if you’re going to get serious, you’ll probably have to pick up Visual C++ at some point. This assumes you want to work on Windows.

If it’s Linux you want, someone’ll probably be along shortly.

Check out PyGame, a game kit for Python.

I would personally argue that Python is a nicer language than C++ for most things. There is no question that Python is the more compact language, resulting less typing and letting one view a larger part of the program at any given time. Python is also a higher-level language than C++, with all the benefits that this implies. The more precise expression of intent is a clear benefit. For example, compare:


def pickup(newItem):
  totalWeight = 0
  for item in player.inventory:
    totalWeight += item.weight
  if totalWeight + newItem.weight > 100:
    print "Item is too heavy to pick up"

with this:


void pickup(Item* newItem)
{
  double totalWeight = 0;
  for (ItemList::iterator i = player->items.begin();
    i != player->items.end(); i++)
  {
    Item* item = *i;
    totalWeight += item->weight;
  }
  if (totalWeight + newItem->weight > 100)
  {
    print("Item is too heavy to pick up");
  }
}

I know which one is easier to read and easier to maintain. In game development, being able to play freely with game rules is important, so you want something where you can be nimble and experiment with different designs. Game logic should be light and easily modified, and if you don’t have to compile hundreds of thousands of lines of code to tweak a setting, that’s a huge benefit.

These are some of the most important reasons why games today tend to express their game logic in scripts. The latest incarnation of Ultima Online, for example, uses a server back end written in Python, with the more processing-intensive stuff written in C or C++; the client, as far as I know, is pure C or C++.

Python interfaces very well with C and C++. There are ready-made bindings for game-related C/C++ toolkits such as OpenGL, DirectX, SDL (*), OGRE (the open-source 3D engine) etc.

(*) SDL is a portable, multi-platform multimedia library. I recommend it over straight DirectX. On Windows it uses DirectX internally anyway.

I’m gonna disagree and say that C is the best choice for a large part of game programming, because you need fast code. The extra overhead associated with object-oriented stuff can slow you down a bit–probably not much, but every little bit matters, particularly in graphics-intensive bits.

And there’s a C compiler for pretty much any OS you like, so that’s not an issue.

ultrafilter, I would have agreed with you 5 or 10 years ago when superfast graphical inner loops were paramount in game development. I wrote my first amateur games with assembly routines for speed on a 386. Nowadays most of the real processing is done on the graphics card and so using a device layer like DirectX in a necessary for the kind of smooth, 2D and 3D graphics everyone expects.

Right now the most difficult task is to organize your programming in such a way as to make complex character AI and environmental interaction possible. For these tasks an object oriented language such as C++, Java or Python is much better suited. It’s much easier to design a BALL the calls a member function BOUNCE to hit a surface and then throw it into a maze, than it is to write an iterative C function in your game loop that checks all the BALLs against all nearby surfaces, especially if you want at some point to add a SPRING.

I disagree with both of you. If you’re making FakesCraft, neither 3d accel, nor CPU speed are going to enter into the picture. In fact, it you’re asking here, advanced AI isn’t gonna either.

I do agree with the 2nd bit of Mirage’s post though. Ease of programming should be the first concern. I might recommend Python, but I’m just learning it so I probably shouldn’t just yet. :slight_smile:

I have seen many examples of ‘hard-core’ C enthusiasts that will swear by the benefits lost in using C++. On close examination of their code, it is quite obvious that many of the principles they addopted are managed by the C++ compiler, hence not giving any benefit (vtables etc - if you don’t use it, you don’t pay for it). I have also seen examples of VB code running faster than C++!!! Some C++ programmers build such complexities into their code that construction/destruction is almost an un-thought of concept.
The trick is to understand your tools, understand your problem, then apply some decission making to solve it. This will most defenitely take you in directions that yeild no results… But theres only one-and-a-half ways to learn: experiment and read.
If you decide you would would like to go in this direction then my advice to you would be to do every other thing you ever wanted to do first, and then start programming. Of course I am just kidding here but to accomplish the the expertise that you seem to be after, you need to either own a company or have the patience of a spider, and the passion of a ummm… fruit!?!
Write viruses instead!

Write it in a high level language first and only go down to C if you REALLY need the performance increase. Most of the time, it comes down to how you code rather than what you code in.

Have a look at Blitz Basic.

Very simple to learn, very fast and flexible. (NB - that does
not mean it’s a "mickey mouse"™ point & click
game creator, it’s a fully fledged programming language
primarily developed with games in mind. )

Check out the demos…

The best for what? To make it easy on yourself? To write a quick tetris clone? To write kick-ass high framerate immersive 3-d FPS type games? To be cross-platform?

Etc etc etc. First decide what you’re doing, then look at the relative merits of the tools available and pick the best for the job.

To my way of thinking, C++ with OpenGL and SDL is your best bet - all quite standardized and available on multiple platforms.

See the following:
http://www.bloodshed.net for a great freeware C++ IDE and compiler
http://www.libsdl.org for the Simple DirectMedia Layer library
http://www.opengl.org for more info on OpenGL

And there are a ton of game-development related websites:
http://www.gamedev.net

http://www.eastcoastgames.com
http://www.flipcode.com

As well as great general programming sites that focus on C and C++:
http://www.cplusplus.com
http://www.cprogramming.com

You will need lots of time and patience. If you start off trying to write the next Warcraft or Half-Life, you will never write anything. Go to it, and good luck.

I’m looking for a tool that is as user friendly as I can get without suffering too great a loss in versitility. I’m not looking for some easy 3 minute plug and chug create a game. I enjoyed programing in high school, and while having long forgot most of what I’ve learned using C++, I have been using watered down versions of programs like Dr. Scheme and even writing little crap programs on my TI-83, which was user friendly but way too limited to even attempt any large sized project.

I’m not trying to come up with the next best seller, all I want is something that I can use when I feel creative or feel like solving problems, or more importantly when I feel like spending then next 5 hours doing something other than studying.

As for what specifically I was looking to make, I was leaning more towards a Final Fantasy Clone minus the fantastic cinema sequences. I’m not a super talented Graphics person, I don’t need and won’t use any of that excellent 3-D stuff. My original goal was something on par with FF3 for the SNES. No fancy animation, no advanced AI, and I want it built from scratch.

Damn board ate my post.

RPG Toolkit

Neverwinter Nights (Comes with sweet addon creator)

Both will give you a foundation to create the game you want, each have a custom ‘language’ and each have lots of flexibility. Plus there are tons of tutorials.

Think of it this way. Using these tools will probably save you a few months of getting your game foundation working. Can come in handy if you only program a few hours a week.

i said it before, and i’ll say it again …
Blitz

C or C++ is the way to do it, until someone gives me a good reason for C programs being faster to run than C++ i’ll continue to believe that there is no runtime speed difference. Compilation time of course is slower for C++ because the lexical analyser has more work to do.

The real question is what environment and code libraries to use: OpenGL, SDL, DirectX, etc…

If you don’t know any of these APIs then I would definitely recommend OpenGL as the quality and availability of documentation dumps on whats available for DirectX. You can get the Official Guide online now at urls like http://fly.srk.fer.hr/~unreal/theredbook/. The functions (Mockrosoft would never use something as simple as a function) are also logically named and well thought out making OpenGL easy to learn and also capable of very advanced stuff (eg Quake 2+3).

There is also GLUT which simplifies your window management a great deal, using this on Linux is a Godsend, coding is so much simpler leaving you free to get to the good stuff. Haven’t tried it for Windows though you can download it at http://www.xmission.com/~nate/glut.html.

Good luck!

IMHO, OpenGL is much easier to use than DirectX, and looks an awful lot nicer :slight_smile: It also allows you to write platform neutral code, whereas DirectX is limited to Windows.

Professional compilers like MSVC offer more features than DevCPP and are pretty cheap now. Although it depends on your budget.

The best site is www.gamedev.net, which has a massive message board, of which I’m a member. Check it out, as well as the articles they host, if you’re interested in game dev.

There’s no speed difference at all, or the difference is so miniscule that it isn’t worth considering. The effifciency gain with C++ far outweighs any speed advatage.

Where C comes into its own in game development is on embedded devices where C++ compilers aren’t available, although Java is making inroad into it’s market.