This is a series of posts charting the development of simple games in the C language.
This index explains what I cover in each part of Games programming from the ground up with C. Select a post title to see that post. It also includes download links for the starter files for each part of the project. This makes it easier for you to inspect progress at a particular point without having to work through from the beginning.
Volume 1: Command line games
- Introduction
- Setting up a development environment
- Source code for the first program to be converted: BUZZWORD.BAS
- Constructing a simple flowchart
- Introduction to the C language
- Initialising a local Git repository with git init
- Initialising a remote depository on GitHub
- Linking a local repository to a remote repository with git remote
- Pulling files from a remote repository with git pull
- Compiling and running the Hello World program
- Using git status to check the current state of a local repository
- Using git add to stage files in a local repository
- Committing changes with git commit
- Pushing changes to a remote repository with git push
Starter files from end of First steps: first steps
- The printf function
- Using git diff to see the changes in a file
- Using git log to see the commit history
- Using git reset to roll back to an earlier commit
- Escape sequences
- Terminating C statements with a semi-colon
Starter files from end of Your first program: a first program
- What is a variable?
- The C stack
- Variable declarations
- The int and float types
- Format specifiers
- The value of uninitialised variables
- Initialising variables
- Simple operators: addition, +, subtraction, -, multiplication, *, and division, /
- Operator precedence and order of associativity
- Using parentheses in expressions
- The char type
- Introduction to arrays
- Declaring an array of ints
- Initialising an int element in an array
- The numbering of array elements
- Declaring and initialising an array of ints in a single statement
- Declaring and initialising an array of chars
- Referencing individual elements of a char array
- Declaring and initialising a string
- The null character
- String and integer literals
Starter files from the end of Variables: variables
More fun with variables and arrays
- Naming variables
- Declaring an array of strings
- Initialising an array of strings
- Introduction to pointers
- The const keyword
Starter files from the end of More fun with variables and arrays: more fun with variables and arrays
- Introduction to functions
- Introduction to function libraries
- Including function libraries
- rand() and RAND_MAX
- Getting a random number within a particular range
- Rules for variable names
- Using return values from functions
- Function arguments and functions without arguments
- The modulus operator
- What are pseudo-random numbers?
- The srand function
- The time function
- Using the date and time to seed the random number generator
- NULL and null pointers
- Introduction to typecasting
Starter files from the end of Functions and random numbers: functions and random numbers
Command line arguments and decisions
- Using integer literals with srand for testing
- Random number bias
- The parts of a function
- Command line arguments
- Decisions with if and if … else
- Compiler warnings and errors
- The strtol function
- The errno library
- Variable scope
Starter files from the end of Command line arguments and decisions: command line arguments and decisions
More on decisions and functions
- Using comments
- Chaining decisions with if … else if … else …
- <, <=, >, >= operators
- Logical operators: ||, && and !
- Truth tables
- Evaluation of conditions with logical operators
- Regression testing
- Creating a function
- The void keyword
- The exit function
- Difference between return statement in main and return statement in other functions
Starter files from the end of More on decisions and functions: more on decisions and functions
- The while loop
- The increment and decrement operators, ++ & —
- Prefix and postfix modes for increment and decrement operators
- Programming errors leading to infinite loops
- The for loop
- Off by one errors
- Index variables
Starter files from the end of Loops: loops
- The do … while loop
- git checkout
- The scanf function
- The reference operator, &
- Making scanf ignore white space
- The fgets function
- The sizeof() operator
- The sscanf function
- git merge
- resolving merge conflicts
Starter files from the end of User input: user input
- The solution
- Markdown (README files)
- Source code for the program to be converted: ACEYDUCY.BAS
- Getting information about C keywords and library functions
Developing the Acey Ducey project
- Example Acey Ducey program
- Removing parameters from the main function
- Using functions to structure a program
- Passing arguments by value, explicit reference and implicit reference
- Comparing strings with the strcmp and strncmp functions
- Evaluating strings based on their text encoding
- Scanning strings with for loops
- The tolower function
- Creating reusable functions
- Single statement loops and decisions
- Swapping variables
- The sprintf function
- The switch command
- Assigning strings with the strcpy function
- Using the break command with switch
- How the stack works
- Why you shouldn’t return pointers to local variables
- Dangling pointers
- Separating model from interface
- The stdbool library
- The bool type
- True and false values
- The compound assignment operators: +=, -=, *=, /= and %=
Project files for the solution: Acey Ducey
Volume 2: Text-based interface games
- Introduction to Hexapawn
- Matchbox computer explanation
- Source code for the BASIC program to be converted: HEXAPAWN.BAS
Introducing the ncurses library
- UI map
- Introduction to ncurses library
- Linking to libraries when compiling
- The printw function
- stdscr
- The initscr function
- The getch function
- Empty loops
- The endwin function
- The noecho function
- The curs_set function
- The mvprintw function
- Coordinate system in ncurses
- The refresh function
- The newwin function
- The box function
- The mvwaddstr function
- The wrefresh function
- The touchwin function
- The panel library
- The new_panel function
- The top_panel function
- The update_panels function
- The do_update function
Starter files from the end of Introducing the ncurses library: introducing the ncurses library
- Header files
- The cbreak function
- The keypad function
- Implicit declaration errors
- Preprocessor directives
- Including user files vs library files
- The #ifndef directive
- The #endif directive
- The #include directive
- The #define directive
- The make program and makefiles
- The echo command
- Indirection
Starter files from the end of Building the user interface 1: building the user interface 1
- Special characters in ncurses
- The mvwaddch function
- The mvwhline function
- Avoiding magic numbers
- Preprocessor macros
- C structs
- The enum datatype
- Function-like macros
- The dot (.) and arrow (->) operators
Starter files from the end of Building the user interface 2: building the user interface 2
- Handling errors
- Stringizing
- The menu library
- The heap
- The malloc and calloc functions
- Casting void pointers
- Pointer arithmetic
- Using array notation with pointers
- The new_item function
- The new_menu function
- The set_menu_win function
- The set_menu_sub function
- The set_menu_mark function
- The post_menu function
- Memory leaks
- The unpost_menu function
- The free_menu function
- The free_item function
- The menu_driver function
- Function pointers
- Stub functions
Starter files from the end of Building a menu: building a menu
Creating a data structure for the game
- Using colour in ncurses
- The has_colors function
- The start_color function
- The init_pair function
- Linked lists
- Apache Portable Runtime
- The apr_initialize function
- The apr_palloc function
- APR ring macros
Starter files from the end of Creating a data structure: creating a data structure
- Variadic functions
- The ncurses form library
Starter files from the end of Building a form: building a form
Validating and processing player moves
- Validating the player’s move
- Updating the board and display
Starter files from the end of Validating and processing player moves: validating and processing player moves
Next part coming soon…
Be First to Comment