Tuesday, December 31, 2019

education - What are the fundamentals of game development?




I completely do not understand how a video game can be coded.


I'm a beginner programmer and only have experience writing console applications that do math and what not. I do not understand how these logical processes can make images move on the screen (video games). Obviously if I jumped into a game development book or something like that I would understand but I am currently still getting a grasp of the fundamentals of programming in general. Could anyone give a simple explanation, coding wise, on the jump between making a computer do simple math to making a computer produce amazing graphical programs such as video games? Maybe there are some introductory videos someone can point me to?



Answer



Assuming you're an absolute beginner in programming, and in order to base my example on something you might know, while writing a console application which has a menu where you want the user to choose among the available option, what will you do first?


If you thought about creating your menu, you got a point, but what if after the user pressed a key which is not part of the available option,



  1. will your application exit, or

  2. shall it continue until the user presses the "Exit" key?



My bet would be #2, the application shall continue until the user expressly press the key to exit from the console application.


A game is somehow the like! When do you want the game to exit? When the user chooses to, right? Hence, the action or the game menu has to last until the user wishes to exit. Then, you will have to create a loop that tells the program to continue until this very key to exit has been pressed.


You've just been introduced to the Game Loop. A game is just another program that runs until it is expressly exited by the user.


While in the game loop, when you're playing the game, the moves are images drawn on the screen at specific coordinates. When the user/player presses a directional key such as [Left], then you make your image refresh its coordinates while decrementing its X coordinate so that you give the impression for a motion toward the left direction. You got to get these inputs in order to get what action the player wants his character/ship to do next. Then, the Game Loop continues to loop until you can get another desired action from the player, until the game is exited.


Well, I'm afraid this answer begins to be fairly long enough, so allow me to point you to two other questions that might be of interest to you, I hope.



  1. Where to start writing games, any tutorials or the like?

  2. Moving my sprite in XNA using classes.


This third link is not about how to begin to write games, but about how to make a sprite move on the screen. Since you also asked about how to make the graphics move on screen, I thought this could interest you.



I hope this helps! =)


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...