Using the GBDK, it is now possible to write game code using the C language rather than pure Z80 assembly. Therefore, we would like to extend this knowledge and checkout some code samples and homebrew games.
Let's check it out!
Software
Follow all instructions from the previous post: this documents how to setup all the pre-requisite software.
Note: ensure you have downloaded and installed the GBDK devkit and Small Device C Compiler [SDCC].
Examples
As per the previous post, after the GBDK has been downloaded, installed and setup, we should now checkout C:\gbdk\examples\gb to learn more about APIs available in the devkit. Replicate prior Hello World example.
Launch Visual Studio 2015. File | New | Project... | Visual C++ | Win32 | Win32 Project
Name: | Game |
Location: | C:\apa_image |
Create directory for solution | UNCHECKED |
Copy over all original folders and files from the corresponding example. Copy from prior Hello World example the hidden .vscode folder and files. Copy also build.bat and align with source compile.bat file. Add relevant files to Visual Studio 2015. Press Ctrl+1 to build, link and run code similar to the prior Hello World example!
Launch Visual Studio Code. Open example folder. Set breakpoint in main.c. Press F5 to debug step thru code
Here is the complete list:
|
|
Samples
Gaming Monsters YouTube channel has many samples to teach how to develop your own GameBoy games:
Launch Visual Studio 2015. File | New | Project... | Visual C++ | Win32 | Win32 Project
Name: | Game |
Location: | C:\SimpleSprites |
Create directory for solution | UNCHECKED |
Copy over all original folders and files from the corresponding example. Copy from prior Hello World example the hidden .vscode folder and files. Copy also build.bat and align with source's make.bat file. Add relevant files to Visual Studio 2015. Press Ctrl+1 to build, link and run code similar to the prior Hello World example!
Launch Visual Studio Code. Open example folder. Set breakpoint in main.c. Press F5 to debug step thru code
Here is the complete list:
|
|
Homebrew
Larold's Jubilant Junkyard is a website/blog/shop which focuses on creating digital products including game development projects and tutorials. The Nintendo GameBoy development tutorial series is very educational.
Follow Larold's Jubilant Junkyard YouTube video channel for additional GBDK 2020 information and content:
SCREEN resolution | 20 x 18 tiles | 160 x 144 pixels |
BACKGROUND | 32 x 32 tiles | 256 x 256 pixels |
Compiler flags
-Wm-yc | GameBoy Color compatible | NB: lowercase c |
-Wm-yC | GameBoy Color only | NB: uppercase C |
-Wm-ys | Super GameBoy compatible |
GameBoy Color Tile Attributes
Bit 7 | priority flag | 0: tiles below sprites, 1: tiles above sprites |
Bit 6 | vertical flip | 0: tiles normal, 1: flipped vertically |
Bit 5 | horizontal flip | 0: tiles normal, 1: flipped horizontally |
Bit 4 | not used | |
Bit 3 | character bank specification | 0: tiles at bank0, 1: tiles at bank1 |
Bit 2 | see bit 0 | |
Bit 1 | see bit 0 | |
Bit 0 | bits 0-2 | indicate tile color palette assignment |
Launch Visual Studio 2015. File | New | Project... | Visual C++ | Win32 | Win32 Project
Name: | Game |
Location: | C:\AlleywayGameboy |
Create directory for solution | UNCHECKED |
Copy over all original folders and files from the corresponding example. Copy from prior Hello World example the hidden .vscode folder and files. Copy also build.bat and align with source's make.bat file. Add relevant files to Visual Studio 2015. Press Ctrl+1 to build, link and run code similar to the prior Hello World example!
NOTE: ensure that the GBDK header files are included for Intellisense: Right click project | Properties |
Configuration Properties | C/C++ | General | Additional Include Directories | %GBDK_WIN%/include; $(SolutionDir)/headers/gen; $(SolutionDir)/headers/main; %(AdditionalIncludeDirectories).
Here is the complete list:
|
|
Summary
Armed with all this knowledge, we are now in an excellent position to build complete video games for the Nintendo Game Boy and Game Boy Color. In the interim, we see the GameBoy Competition 2023 is here!
No comments:
Post a Comment