The Game Programming Begins!

Hello,

So, even though this post is not published the week after the last post which it should, I will still write about what we did in week 3.

So in week 3 we basically started with game programming. We wrote the game Pong. I don’t need to explain what Pong is and how it works, but it was awesome to start game programming. Since I am new to programming I did not really understand everything we wrote, but it was cool how just a bunch of lines of code can create visual effects.

So, after we were done with the lecture in week 2 about pointers, arrays, functions and classes we were basically done with the things we need to know to program games. This may sound that it is easy, that just after 2-3 weeks we know everything there is to know to program games. It is partially true, but since it is extremely hard to understand everything in a few weeks (most likely impossible), I really can’t program games just yet.

For example: When a AAA-game is released and it just keeps on crashing or just doesn’t work properly it is in many cases pointers that’s wrong. If we do not take the pointer and point it at nullptr (which means nothing in programming) after we have used it the program/game will most likely crash. And that is because it will point at something random, and use that memory address for something that it is not supposed to and that will make the program crash.

Well, I think that was really what we were doing in week 3!

Here is some pictures:

pong mainPong

 

There is one thing about the bottom picture: Everything is written in the main.cpp. Do not, ever, do this! This main.cpp is about 600 lines of code long with a bunch of different functions and methods. If there was an error it was really hard for me to find it, most likely because of that I am not very experienced in this but also it was just to many lines of code and no structure at all.

In the next post or the post after that I will show you what I mean. And that is when we created the game Arkanoid.

Cya later!

About Alex Henningsson

2014  Programming