sexta-feira, 4 de janeiro de 2013

Game Making : The Basics



Well, if you are here one thing is certain, you want to create a game. Well, this is a heads up on what it takes to create a game. The concepts that I am going to talk on this post are generic, and don't relate to any specific type (3D,2D) or even Genre (FPS,RTS,etc). 

So first thing first, what is a game? 

Well, a game is a program,a piece of software, So the first step to create a game is to learn how to program. Any language is suitable to program games, there are other more accepted in the market, C++,plain old C, java, etc. There is no correct language, but most AAA games (think Mass Effect, Age of Empire and all the other games released by big companies) are mostly made in C++, so if you are thinking in going in a professional way this may be a good choice to pick.In the end is mostly down to your personal preference.

There are also Engines that ease this process, Unity, RPG Maker, Game Maker, and a bunch of others, but those are out of scope of what I am trying to teach.
These engines do most of the ground work for you, but I feel that to use these engines without knowing the basics is really not worth it. Also, there will be a time that to create your vision of that amazing world, the engine you picked won't suffice without some extra coding, either via scripting, or changing to another engine altogether.

I am talking with experience here, I learned how to program via scripting for RPG Maker XP, and soon realized the limitations of the engine. It was after this that I decided to move toward learning how a game worked behind the  pretty GUI (Graphic User Interface) that these engines have for us to use.

One last word, don't feel like I am saying that rolling your own game is better than using a self established engine, that is not what I am trying to transmit. Using a engine, simplifies and makes it faster to develop your game most of the times, but you still need to learn how it works to take the best out of it. Keep that in mind.

How do games work?

Games are program like I said, but they are very specific programs with a set of rules. For you to understand the next section is advised that you do know some concepts about programming (Loops,Ifs and other basic information).

All the games have something that is called the "Game Loop". This is what makes the game run, and by the name you can see that it is something that loops, by this it means its constantly repeats the same set of actions over and over again.

What I am going to explain next, is a very crude  way of describing the game loop in pseudo code:

while(GameIsRunning)
{
   ReadPlayerInput(;) //Keyboard,Mouse,Joystick
   Update(); //Update the game world (Physics,Animation,Etc)
   Render(); //Draw Everything to the screen
}

What it does is easy, while our game is running (aka not closed, on background) it should call those functions.
That's the skeleton of a game right there, its as simple as that, the complicated parts comes after this, what should each function do? And more importantly how to do it?

Well those question will come further on the chain of these series of short tutorials, so keep posting back and comment if you have any doubts, need better explanation or have any suggestion.

Sem comentários:

Enviar um comentário