Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro. to Game Programming Want to program a game?

Similar presentations


Presentation on theme: "Intro. to Game Programming Want to program a game?"— Presentation transcript:

1 Intro. to Game Programming Want to program a game?

2 Very Important Points Classroom etiquette Lab etiquette Problems with – Teacher – Course content – Evaluation – Programming for labs – Personal

3 Basics Game Consoles and mobile devices Hardware, Software and Firmware 1’s and 0’s Assembly Language HLL (High Level Language)

4 Game Consoles and Mobile All game machines share their internals with regular computer architecture All game machines have – Input – Output – Processing

5 Hardware, Software & Firmware Hardware refers to a PHYSICAL DEVICE Software refers to INFORMATION that commands a device Firmware refers to EMBEDDED Software – fixed INSIDE a device

6 Processing Game consoles have microprocessors that understand and perform operations based on a PATTERN of 1’s and 0’s

7 1’s and 0’s Can be COMMANDS (or INSTRUCTIONS) to a device Can be DATA for use by a device Determination of interpretation depends on the CONTEXT of the 1s and 0s

8 Machine Code Jumping to the address 1024: [ op | target address ] 2 1024 decimal 000010 00000 00000 00000 10000 000000 binary

9 Assembly Code MOV r0, #0C ;load base address of string into r0 LOAD: MOV r1,(r0) ;load contents into r1 CALL PRINT ; call a print routine to print the character in r1 INC r0 ;point to next character JMP LOAD ;load next character ALMOST ENGLISH

10 High Level Language Early HLL – Fortran – Cobol Basic Pascal C (from B) Jumping to the address 1024: C++ Java

11 Why C++? Industry Standard 70% of Game Developers use this language on a DAILY basis Object-oriented Practical outside of game development in industry

12 How do we make a program? Compile Link Load

13 COMPILE Command Line cc -c file.c GUI (Graphical User Interface) Go to menu option… Build and select Compile

14 COMPILE (More) Compiling takes English-like language and creates instructions that the computer can follow. Calls to other code will be links and need to be resolved in order to build REAL executable 1’s and 0’s

15 LINK and LOAD Command Line ln file1.o file2.o GUI (Graphical User Interface) Go to menu option… Build and select BUILD

16 LINK and LOAD (More) All calls to other code are resolved into actual locations where the code is now residing. Programmers use libraries that contain many commonly requested functions. These are resolved in the LINK and LOAD process as well The LOAD process refers to the first part of executing (or running) the program on a computer.

17 Hello World in C++ #include using namespace std; int main() { cout << “Hello World" << endl; return 0; }

18 Hello World in C++ #include Preprocessor command – starts with ‘#’ Processed BEFORE actual compile Effect of including an entire file inside your file

19 Hello World in C++ using namespace std; Declares where to assume you are “using” functions “std” means STANDARD and allows a command like “cout” to be understood

20 Hello World in C++ int main() { } A function called “main” which returns an “int” value “main” MUST be in all C++ programs “{“ “}” delimit the function (indicate what is inside the function)

21 Hello World in C++ cout << “Hello World" << endl; “cout” is an object that is connected to our terminal screen by default “Hello World” is sent to the object for display on the screen “endl” is a “manipulator” that adds a CR LF (Carriage Return and Line Feed)

22 Compiling Hello World in C++ Save the contents of the program into a file called “hello.cpp” Run the following command c++ -o hello hello.cpp The PROGRAM is created… linking and loading is ALSO performed (by default)

23 Running the Hello World Program In a Unix/MacOS/Linux environment./hello In Windows… the program MUST be named with “.exe” on the end hello.exe


Download ppt "Intro. to Game Programming Want to program a game?"

Similar presentations


Ads by Google