Ask Agame Programmer

How do you get started -- and what background does it take (do you have to know a program language?)?

There's a saying, the best way to learn programming is to begin writing programs. On the other hand, maybe that's an oversimplification. But it makes sense, inasmuch as you have to start 'simple'. Or, at least, good results can probably be achieved that way.

JavaScript may be a worthwhile first language. It is extremely easy to experiment with, and you can even write games in it! See http://javascript.internet.com/games/ and http://javascript.internet.com/games/falcon-fighter.html for JavaScript game examples with free source code.

Additionally, check out the current leapfrogsw home page, which has graphical animation and collision detection I believe by AdamHarris. I think you could indeed make games in this language - even though it's "just" JavaScript, meaning there's no access to raw pixels! --BillKelly

Hey Carson, I viewed the source code for your home page, and there wasn't any JScript there. What did you do to it? - Checkmate

A while back I changed the page so that the JScript only shows up if you are lucky enough to get the bubble or the umphee. You may have noticed that it is a .php3 page now so instead of always sending the JScript I was able to send it conditionally - AdamHarris

Oh great! Now I really have to clean that code up! :-) To be honest, a lot of the code was borrowed from one of the sites Bill mentioned above, and then I mucked with it a bit. Oh the shame! --AdamHarris

Ah, so here's where you guys are hanging out! I've been searching all over WIKI for you guys! He..he.. -cw

What is a program laguage and how do you learn it? -nop

Kind of ironic that your initials are "nop". That means something in some programming languages. A programming language is simply a program (much like a word processor) that you use on your computer to write programs. C++ is a very popular programming language and most people on the Mac use a program called "CodeWarrior?" (by a company called MetroWerks?) to write C++ code. C++ is a language (much like French and Italian are languages) that bridges the gap between English (which you know but which is very difficult for the computer to comprehend) and machine language (which the computer knows quite well but is extremely difficult for a human to work with).

Other popular programming languages are Basic, Perl, Java, Assembly Language, Pascal and I'm sure BillKelly can name a few more :-) (I'll give it a go: prolog, lisp, c, c++, objective c, forth, fortran, cobol, html, xml, sql, smalltalk, ada, eiffel, python, rexx, sed, awk, delphi, asp, php, tcl - AdamHarris) (Hmm, well you leave me no alternative but to invoke some more obscure ones: SNOBOL, SPITBOL, APL, BCPL, Haskell, erlang, ALGOL, SML, Scheme, Pizza, Modula, ML, Miranda... not that I've programmed in many of these - maybe experimented with a few. --BillKelly) (And, you forgot some really REALLY obscure ones! Kmensa, Offbeat, Harvest C, VisualBasic, etc etc etc =P Checkout the ones listed here: http://www.latech.edu/~acm/HelloWorld.shtml)

Looks like you forgot "QBasic" -Checkmate

So what does "nop" mean? It's a no-operation instruction. It does nothing, kind of like the placebo capsule in MacBrickout! Hey, maybe CodeWarrior? even inserted a few nop's in the part of the code that handles the placebo capsule! -CarsonWhitsett

I use the initials nop because I share the same initials as my dad and brother, so when we had to write our name in the high score we would all get confused. So I just picked nop because they are right next to each other in the alphabet. SO now we dont high scores to confused. Its kind of stupid but it works. SO now everyone knows me as nop not jln. -nop

Also thanks for that information. -nop


I've done some programming in C++ and I was just wondering how many lines of code MacBrickout is - chimi


That's a good question. I just removed all object code and recompiled the entire project. I don't know how accurate the line counter is in CodeWarrior? but when it was all done, it said 522,785 lines of code. Geez. No wonder my fingers are sore! -CarsonWhitsett It's really a lot smaller than that. CodeWarrior? counts the lines of all of the include files over and over again. I'd guess that a more likely size is one-fourth that amount. - KirkBaker


Whoa... that's a LOT. I've a game that's almost complete (well... kinda) - it's one of those space wars games - and it only has like 15,000 I think. - chimi

Does the PC version of MacBrickout use DirectX? If it does, how do you do windowed mode? I can't seem to figure it out... If you have the answer please email me at akorn04@laptop.mpa.pvt.k12.mn.us. Thanks - chimi

Yes the PC version of MacBrickout does use DirectX. It uses version 3.0, because it is available on all Windows platforms that we care about (95/98/Me/NT4/Win2000.) The PC version will support both fullscreen and windowed modes. If you have fullscreen mode already working in your game, going windowed is not that much different. I made the necessary changes in about an hour. Later I found the following link that has an article all about it: http://www.gamedev.net/reference/programming/features/winmode/default.asp If this link doesn't help you out enough, let us know. - KirkBaker

From what I remember from a book about MFC, to use DirectX in windowed mode, you tell the DirectX API a "rendering frame" to draw it's stuff in. To get the rendering frame, you just call a certain window function that returns the window's drawing space. It's pretty simple. to get full screen mode, just get the screen size and tell DirectX to draw right there. - Checkmate

The link helped a lot! I've got windowed mode up and running... But not perfectly. If it isn't too much of a problem, I would really like to know how you work the game with different numbers of colors or different palletes when you have 256 color mode. Also the clipper doesn't work right (the whole screen turns black...) If it isn't too much of a hassle, you can email me at akorn04@laptop.mpa.pvt.k12.mn.us (which is above, too, lol) Thanks a lot!

Speaking of graphics programming, I have a book called "Graphics Gems" (by Andrew S. Glassner). It's really neat.

How much time a day do you spend on BrickOut?? It seems like such a simple game. (detailed, but simple)-HB My wife says "too much!" :-) Right now, a lot of time is being spent getting the PC version ready for release. When I was coding up the Mac version, it probably averaged out to about 5 hours a day.

How do you make a file format? Like the BrickOut? levels have their own format that BrickOut? can read. It might be too hard to explain, but if you could it would be great. Thanks. -HB

Well, in a sense it's all based on knowing how to write data, like numbers and strings, from variables in your program out to a file on disk, and then vice versa: reading data in the file on disk back into variables in your program. The details of exactly how to do this will vary, of course, depending on what programming language you're using. But you'll also have the option to choose to write the data to a file in "text" format, or in "binary" format. "Binary" format files are typically a more compact (smaller) way of representing data, than the equivalent data stored in "text" format. However, "text" format files offer advantages such as typically being more portable between different platforms (kinds of computers and operating systems) and also can be processed with a wider variety of existing tools than "binary" formats. These days, with computers being so fast and disk space being so plentiful, I personally will lean more toward text-based formats, rather than the binary formats I might have preferred several years ago. . . . Does this help in addressing your question? Is there a particular programming language you're working in? -- BillKelly

I am going to learn C++. I started with VB, and then I didn't think it was powerful enough so I decided to learn Java. So far I know the basics. I am still learning it. I couldn't decide. Soooo, I finally decided that C++ was the most powerful language. I'm soon to get a book and I won't change my mind again (hopefully!). -HB

There isn't a "best language" - but there is a "best language for the job." Are you building a traditional binary? If you don't care about speed, then you should go with either something like Visual Basic (very easy, but not very portable) or Java (easy but not as easy, but more portable). If you do care about speed, then how much? A speed demon should be written in C; a slightly less speedy app can be written in C++. If you need a web-based application (i.e. not a traditional binary) you'll need to choose between ASP, Perl, and PHP. PHP is a purpose-built language that can outspeed the other two options and it is open-source, so you can add new commands at will as you need them (by coding them in C/C++ and then recompiling PHP); Perl will be the easiest for old hands to use. Well, I probably should list ASP's pluses here... except there aren't any. This Microsoft POS shouldn't be touched with a ten-meter pole.

If I might offer a thought about languages. Maybe a couple thoughts. :) There is no most powerful language. At least, no one has invented it yet. So it's kindof nice in a way. You get to decide which language to use based on whichever is best suited to the problem you're trying to solve. (Unless, of course, you work at a company that only allows you to use This language or That language. Which often seems to happen, unfortunately. :) . . . Anyway, the cool part is, you'll benefit from learning as many languages as possible; and the really cool part is, you really don't have to worry about choosing "the" right language to learn. Because they do get easier and easier, the more you learn, I think.

In case it helps to provide a few specifics, my personal strongest languages--that is, the ones I'm most fluent in--are C, C++, Forth, Java, and Perl, in no particular order. I am actively learning Smalltalk right now, too: I love Smalltalk actually, I wish I had learned it ages ago!! But anyway, the point was going to be that given any of these six languages I mentioned, I can think of tasks where I'd unequivocally want to choose one of these languages above all the others to implement that specific task. For example: small embedded systems, or debugging a piece of hardware: Forth; Linux kernel programming: C; High-performance / cutting edge game programming: C++; Web-based applets: Java; Text-processing and miscellaneous scripting: Perl; anything else I can possibly get away with: Smalltalk! :-) So I'd say, start with whichever language you enjoy the most. Write a few programs in it, just simple ones or whatever interests you the most. Try other languages, write some more programs. If you try a lot of languages before you get to Smalltalk, you'll appreciate it a lot more. ;-) What kinds of programming are you most interested in at the moment? -- BillKelly



''Re: text vs. binary..."

So, go with text meaning Base64 all my data? :-) - AdamHarris

Ah, what a tangled Web we weave. Pay no attention to the MIME behind the curtain...



Check out this page for "Hello World" in a bunch of languages: http://www.latech.edu/~acm/HelloWorld.shtml

- or -

Here are programs to print "Hello World" in various languages:

C or C++

 int main ()
 {
     printf("Hello World\n");
     return 1;
 }


Perl

  perl -e 'print "Hello World\n"'


Forth

  : hi ." Hello World" CR ;
  [see also: http://members.cts.com/crash/b/billk/pforth/ for Forth written in Perl]


Smalltalk

  Transcript show: 'Hello World'; cr.


Visual Basic

  Private Sub Form_Load()
     Label1.Text = "Hello World"
  End Sub


[I think this is right - correct me if it's wrong] [Looks good - billk] [Actually, I think "Label1.Text" needs to be "Label1.Caption" - Checkmate]

Label1.Caption = "Hello World" I don't relly know VB, but I like to mess around with it. -HB

Java

 Class Helloworld
 {
     public static void main (string [] args)
     {
          system.out.println ("hello world")
     }
 }

TashaParsons Oh, the horrors of first year comp sci, THE HORRORS!!!


Can all levels for MacBrickout be used on WinBrickout (including the MazeBall level set)?

WinBrickout will come with the three default level sets that come with MacBrickout. Since the file format of the level sets has changed, the MazeBall level set would need to be updated to the new format before it would work on WinBrickout.

Will Winbrickout users ever get to use the level editor. If that comes out, I'm going to register!-Mike


I was wondering about the anti-aliasing and rotation effects used in MacBrickout. Can somebody help me? The latest version of MacBrickout (4.2) uses OpenGL for all of its image drawing which results in getting rotation effects and antialiasing practically for free!

Hey Dudes, Where can an amature programmer get a C++ compiler for Mac OS 8.6 if he doesn't have $600 for Code Warrior or any money for that matter? --Scottamus

Check this out: Apple released Macintosh Programmer's Workshop for free download, which you can get at http://developer.apple.com/tools/mpw-tools/ I'm an IBM PC developer-person, and I'm wondering where you can get a Macintosh compiler that runs under Windows. - Checkmate

So... You pretty much let anybody edit this page as much as they want? I guess it's obscure enough that nobody does anything, but still...

Yes, that's the idea behind Wiki - the honor system. And yes there are those who abuse it and ruin it for everyone but most people are great.


EditText of this page (last edited Jun 09 2008)
FindPage by searching or browsing

This page is mentioned on the following pages: FrontPage