What are the basic types of code used in video game programming (not languages)

Started by
4 comments, last by DemonDar 7 years, 9 months ago

(CAUTION: I am somewhat of a beginner at coding, so I may use some terminology that may not be correct).

Given that some of the more experienced game developers here are telling me to start creating games instead of just conceptualizing them, I have begun to start learning how to code (considering it is the one of the few activities related to game design that I am still inexperienced with) and I'd have to ask, what are the most important basic types of code used to program video games?

I was personally thinking about functions, variables, Booleans, and if/else statements. Thing is I'm unsure if there are any more. That and I'm only partially experienced with JavaScript (though I have heard it is similar to industry-standard languages such as C#).

Aside from knowing what types and patterns of code to use, I would like to know how much advanced code must a person know in order to create a particular game (basically something around the size/scale of Flappy Bird), and how easy it is to transition from JavaScript to C#.

Anybody willing to share an opinion? (if I was too vague, I could explain more about a certain part. just tell me.)

Advertisement
There are probably hundreds of concepts worth knowing for a routine day of game programming. Maybe more.

Don't worry about knowing all of them up front. Just write code, and when you run into something that seems awkward, overly complex, or even impossible, that's the time to ask a specific question about how to solve your problem in code.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Game programming uses everything that all programming uses, so the rest of my response is about all programming.

In most programming languages, there are:

Variables which hold values.

Expressions that combine variables, values, and operators to calculate new values.

Assignment statements (=, ++, --) that assign values to variables.

Control flow statements (if, else, do, while, for, switch, etc) that let you control what happens like a flowchart.

Functions which let you group multiple statements that you want to use from many other places in your program.

Types (things like ints, floats, Booleans, arrays, pointers, references, classes, structs, unions) which define how data is stored in values/variables of that type, and a set of operations that apply to that type. For example an int can be added, multiplied, divided, etc. A bool can be &&'d, ||'d, etc. Strings can be concatenated, uppercased, lowercased, etc.

Some languages have lots of more complicated features, but they usually work by combining the concepts listed above.



Programming is a multi-step translation process:

1. The game ideas in your head.
2. The concepts of the actions that need to be performed and what information you need to store.
3. The generic programming concepts (the ones listed above) that you can use to achieve that.
4. The language-specific code that represents those concepts.


Only step 4 is language specific. Steps 1-3 are the same when you're using Java, Javascript, C#, or any other programming language. Most of the hard stuff you need to learn are the process of getting through steps 1-3. Step 4 is a matter of memorizing what different languages and libraries use to represent each type of programming concept.

This might help:

http://gameprogrammingpatterns.com/contents.html

And as much as I wouldn't mind it to be, I'm not sure C# counts as an industry standard =)

As you'll learn programming, you'll go through all these automatically.

The NIKE slogan has some truth in it :)

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

You will never really stop learning ways of making a game:

some example basics concepts

- arrays are 1 or 0 indexed, but usually you will use 0-indexed arrays (so the first element has index 0 etc..)
- foreach
- fixed time update


more advanced concept

- grid based tile game
- rendering


What I would do is to search for a simple language with a simple tool that allows you to draw images on screen (in example SFML2/ C++), and then try to make a map that shows different terrains types, that would be interesting, satisfying and simple.

This topic is closed to new replies.

Advertisement