![]() Since we're using C, I've stashed the game state in one large struct and two small structs. This is what we update every game loop iteration using our procedures above. The final piece to our design puzzle is the game state. Ultimately, we build towards the final result which looks like the diagram below: The first development video includes us setting up the fixed 30 FPS game loop with empty functions for checking input, updating game, and rendering. Most of our development time is spent building features and plugging them in to our game loop. Reads keyboard state and sets update flagsĬhecks if a level square is empty and passable Our procedures are:Īdds points to score and checks for extra lives earned All procedures are composed from the above functions and various flow control options in C (loops, conditions, etc). We define 30 procedures that make up the heart of our game. Pushes a texture to the renderer (similar to blitting surfaces) Reads a bitmap file and returns a surfaceĬonverts an input RGB value to the desired formatĬlears the back buffer with the current color Records the current time stamp for the app Sets up our output devices (the screen) during initialization Here are the 7 functions you need to know or learn to understand this project:Ĭreates an SDL_Texture from an SDL_Surface. I'll break down the game loop as it developed over the course of the project. Below, we'll review the namespace of the project, which includes C standard library functions, SDL functions, and game state variables. The code comes in at around 1000 lines in which we define 30 procedures. I've skipped many best-practices for scalability and maintainable design in order to keep this accssible for beginners. The goal is a reasonably complete (and winnable) version of Dangerous Dave with the minimum amount of design. Then we need to add level wrapping so Dave can fall through the floor. We’ll allow Dave to climb trees and stars. We need to add a few more things to make the game winnable. ![]() We’ll bring those in to our implementation. The original Dangerous Dave has a status bar and several banners. We’ll implement a game tick clock and use it to offset tile drawing. Let’s make the game more visually complete by adding animations. We’ll get the monsters in to the world and get them moving and shooting. We’ll start by finishing levels, then adding features like screen scrolling, weapons, and the jetpack.īeyond level two, each level will challenge Dave with monsters. We’ll add Dave to the world and give him basic movement abilities: Left, right, jumping, and picking up items.ĭave needs more features to get him through the game. Then we set up a fixed time step at 30 frames per second before test drawing the world in the renderer. We’ll import the assets we’ve already extracted and build a simple game loop: Checking input, updating game state, and rendering output. Again, many thanks to levellass and Malvineous at. We’ll built a utility to extract these data in to separate data files. ![]() The original binary contains the level information that we’ll need. Thanks to levellass and Malvineous at for reverse engineering the original binary. We’ll create a utility to pull out the tiles in to bitmaps. We need to pull out the tileset from the original Dangerous Dave Binary. Brief discussion about tools and development strategy. Part 1: Playthrough & PlanĪ playthrough of the original Dangerous Dave, pointing out gameplay and features. Click on the title to go to the project page. Total run time of the videos is just under two hours.Ĭlick on the picture to go to the video. We fit around 1,000 lines in to a single file. No function pointers, memory allocators, or custom data structures with opaque operations. The ten-part video series recreates the game using C and SDL with a few interesting limitations: I’ve kept a static design using basic features of the C language. My tribute to these good times is this tutorial for beginner programmers. ![]() Waaaay back in the dark ages of junior high school, I lost many hours to this classic 2D platformer from John Romero.
0 Comments
Leave a Reply. |