Part #1: So You Want to Make A Video Game?

By rolliebollocks

Programming can either be a fun and rewarding way to learn new concepts and be creative, or it can be a frustrating experience that ultimately causes you to give up all together. When I first started learning programming, I was in about sixth grade and I would fart around on GW-BASIC making random programs and then showing them to my mom who would then feign pride in her disturbed child. It was great. Nowadays I still utilize programming as a means to learn new forms of math and otherwise augment my skills as a critical thinker. Programming increases your math skills, your problem solving intelligence, and your ability to break things down into discreet pieces (analyze).

So, the following document will contain some general tips on how to learn programming, what to expect as a beginner, what to avoid as a beginner, and how to get some grounding in such a vast sea of information.

Rule #1: Start Paying Attention in Math Class

In order to make a video game, you need to have 3000 years of mathematical tradition. Generations upon generations of men and women have contributed to the evolving body of knowledge that allows us to build every wonderful thing that has made your life better. On an individual level, you will never get to the point where successfully finished learning. You will only have to look up less stuff in order to accomplish your aims.

In math class they expect you to memorize formulas. What we need as programmers is a conceptual understanding of what formulas to use when. We don't have to memorize anything. We have to know what to look for, and when to employ it. We have to know more general stuff, but less specifically.

Rule #2: Create A Code Vault

The best way to learn programming is by example. This is true of every discipline because almost all disciplines are simply too complex to fall into a perfect set of rules that are always the best. Instead, what you have is this technique is best in this situation, that technique is best in the other situation. What you find in an online community like FreeBASIC's is a group of people who enjoy sharing their knowledge and the stuff they make with others, and ask nothing in return for it.

While FreeBASIC isn't the only programming language to have such a community, it's tradition which stems from the hobbyist beginner's language of QBASIC, has endured largely because of the community that arose from hobbyist programming. This was a place where beginners could go and see both professional and non-professional programmers and their techniques as designs for their own projects. They would use the stuff they thought was useful, and dismiss the stuff that wasn't, and in the end it would help them to make smarter decisions about what techniques to use, and methods of employing them.

So, create a code vault from the Tips And Ticks and Projects forum, and try to see what kind of stuff you can get these programs to do. What would you add? What would you take away?

Rule #3: Stay Patient

The other day I spent all of the time I'd set aside to work on my programming project on a single formula. I wanted to reflect a polygon across any line. In order to do this (without looking it up) I sat in my chair and stared at the screen for about one minute.

At the end of that minute. I had an image in my head. That image was this:

(It was a really crappy picture). At any rate, I drew this out because, in fact, it conveys the entire idea of how I wanted to write my reflection algorithm.

You can tell from this drawing:

  1. The reflection algorithm will work by drawing a line from the vertex of the polygon to be reflected to the line over which it will be reflected.
  2. That the line drawn will be perpendicular/at a 90 degree angle to the line.

In order to write an algorithm which does all this, you have to know a bunch of stuff that is only slightly above what you would get in your typical high school trig course, and can (in fact) be accomplished without the vector algebra, but is better because of it, so that's what we use.

So starting from scratch, what do I need?

  1. Coordinates

    I need coordinates for every corner of the polygon. I need coordinates for the line. I need coordinates for the polygon to be produced by our reflection algorithm.

  2. I need to know how to calculate the perpendicular line to any given line.
  3. I need to know how to draw a line from the polygon's corner to the line at a perpendicular.
  4. I need to know how to determine if the lines intersect, and then where they intersect.
  5. Upon knowing where they intersect, you have to calculate the distance between the polygon's corner and the intersection point, and once you double that, you have a reflection.

This, in essence, is an algorithm. An algorithm is basically a recipe for accomplishing some task. Understanding that you will spend all day on a single small piece of a much bigger whole will help you to keep your expectations in perspective.

You will not open up a book on programming and have a ray tracer by the end of the day. If you could even accomplish the relatively small task of reproducing the aforementioned algorithm I would say that this tutorial is beneath your level of expertise. I mention it specifically because it is daunting and because beginner programmers get into this with unrealistic expectations and quickly become frustrated with the modest results. It will take years to learn this stuff and be able to sit down and write algorithms off the top of your head. You must accept that with any discipline, years of training are required to become a master of the trade. And even masters don't stop learning, but continue to increase and expand their skills. Even super-geniuses who know everything there is to know about their area of expertise invent new problems to solve and naturally seek those places where they don't have all the answers!

Rule #4: Make your own Library/Code Vault

Make code that can be used over and over again. Figure that over time you can refine it, and make variations on it for use in specific programs, but I'm finding it very helpful to have a library of objects that I can use to make whatever I please. I can build on top of them and add stuff to them, and they just keep getting better and better. And I don't every have to go back and resolve a problem that I've already solved.

Rule #5: Keep your goals modest

Instead of saying “I want to build a raytracer in n-Dimensions” say something like “I want to reflect a ray off of a line in 2 dimensions.” And later you can say. “Now I want to reflect a ray off a square in three dimensions...”

Knowing where to begin is what being a beginner is all about. I've been a beginner several times, so I have some experience with it. Work on things one step at a time. You want to build a top down space shooter? Great. First figure out how to move a sprite around the screen.

Rule #6: Have fun

If you don't find this stuff fun to work on for its own sake then you are better served by spending your time on something that you will find fun for its own sake. Because only if you are enjoying yourself will you be able to justify the time required to learn how to do it. You will find that at the beginning, things are much more difficult. A lot of core concepts such as Scope and controlling the flow of a program are not easily described. There the sorts of things you get a feel for by experience, and as such, different folks have different strategies, and part of the experience of programming is strategizing for yourself.

Know that if you can make it through the first couple months with a still dedicated interest, you will have learned enough to make your first video game. Good luck.

Powered by CMSimple | CMSimple Legal Notices | (X)html | css | Login | Template-Design: Lars Ellmauer | Template-Modified: Imortisoft ISD