Your final project is to make the video game Pokemon. Specifically, you have to write the code for a Pokemon battle between two trainers. We will be using SDL for the Graphical User Interface. The front-end has already been started to keep you from getting bogged-down with SDL details. This is a three person group project. You and your group will present your project on the final day of classes.
A Pokemon battle consists of two trainers who battle their Pokemon
one-on-one. Each trainer may have up to 4 Pokemon. The trainers take
turns using their Pokemon moves or switching their active
Pokemon. Each Pokemon may have up to 4 moves, which the trainer can
select through the FIGHT menu option. The trainer may
also use his or her turn to switch Pokemon through
the PKMN menu option. The first turn is chosen at random.
The RUN menu option simply quits the game, and
the ITEM menu option is not required. It might be fun to
add items to your game to make the gameplay more interesting.
Each Pokemon has, at a minimum, health. You may also add stats like Defense, Attack or Speed. When a Pokemon uses an attack it either does a critical hit, does a normal hit, or misses. Hits reduce the health of the opposing Pokemon. If either Pokemons' health drops to zero that Pokemon faints and the trainer must choose his or her next Pokemon. The battle ends when all of a trainer's Pokemon have fainted.
Pokemon may also have moves like Sleep, Paralyze, or Heal. All of these moves are up to your group. You are required to have at least one special move that does more than just damage.
Aside from those basic requirements the game design is up to your group. Try to come up with interesting damage formulas, like using a base damage times Attack minus the opponent's Defense. Pokemon should have experience and levels, but we can leave that up to you. How each trainer's Pokemon are initially chosen is also up to you. A good idea might be to choose them at random. Things like miss chance, critical hit chance, elemental resistance and elemental weaknesses are all up to you. Remember that you will be presenting your game so implementing the bare minimum requirements could result in exceptionally boring gameplay. The goal is to make a game that is actually-sorta fun to play, not just two trainers using Scratch until one wins.
The game needs to display a main menu during play, as well as a move sub-menu and a PKMN sub-menu. A cursor should indicate which menu option is currently selected. When a player uses a move, information, such as the move and whether it missed or critically hit, must be displayed on the TextBar on the bottom of the screen. Examples are "Charmander used Scratch. It missed!" and "Bulbasaur used Tackle. It's super effective!".
Your game is required to have the following four Pokemon: Charmander, Bulbasaur, Squirtle, and Pikachu. You are encouraged to add Pokemon and abilities if you have time.
The following classes must be written with constructors, destructors, copy constructors, assignment operators, and insertion operators (<<): Trainer, Pokemon, and Move. You will likely need several other classes, but they are not required to have the special functions listed previously.
Each Pokemon class such as Charmander must inherit from the Pokemon base class. Moves like Scratch should inherit from Move.
You will be using SDL for rendering the menu and Pokemon, as well as for input from the players. SDL basics will be demonstrated in class and you are strongly encouraged to use the in-class example as a starting point. You need to display the menu at the bottom of the screen as well as some image for the Pokemon and a bar indicating their health on the playing field.
The four directional keyboard keys (up, down, left, and right) and the enter key are used for input. Pressing a directional key moves the menu cursor. Pressing enter selects the menu item.
SDL may be downloaded from
their website or on most linux
systems with sudo apt-get install libsdl1.2-dev
libsdl-image1.2-dev libsdl-mixer1.2-dev
libsdl-ttf2.0-dev. libsdl1.2-dev is the main SDL package, image
is for loading images, mixer is for sound, and ttf is for fonts. We
will be using the main package, the image extension, and the font
extension.
Once SDL is installed you must #include <SDL/SDL.h>,
#include <SDL/SDL_ttf.h>, and #include
<SDL/SDL_image.h>. SDL is a C library so there are only
static functions and structs.
The code for the logic of the game should be mostly within a class called Game which implements the interface Model.
Separate from the logic of the game, commonly referred to as the model, is the display of the game, known as the view. You must have a class called GUI which implements the interface View
The code that handles user input should be in a separate class called Input which implements Controller.
The classes Game, GUI, and Input should know as little as possible about each other to maximize encapsulation. Encapsulation improves the quality of code by breaking complex systems into simple parts. This significantly increases the readability of code and helps prevent bugs.
Therefore, Game, GUI, and Input may only access each other through the interfaces that they implement.
Your group will be presenting your game on the last day of class. The functionality grade will be determined from your demonstration. Make sure you run through your game enough to know that there won't be any Segmentation Faults during the presentation. Every student in the group must demonstrate what part he or she contributed to the game.
There are 10 points available for extra credit. You may implement any one of the following extra features: sound/music, animations, items, or scrolling text. You may also receive the extra credit if you come up with something else that is challenging.
All group members will receive the same grade. Only one group member should submit the final project code on Blackboard. We will not collect printouts for this assignment. All students are also individually required to submit a partner evaluation on Blackboard as hw8. Please be honest and detailed in your evaluation.
| Functionality | 60 |
| Inheritance | 20 |
| Operator overloads | 20 |
| Model-View-Controller | 20 |
| GUI | 10 |
| Presentation | 10 |
| Extra Credit | 10 |
| TOTAL | 140 + 10 extra |
Memory leaks/errors -5 points (SDL causes memory leaks which can be ignored), compiler warnings -5 points
[an error occurred while processing this directive] Saturday, 13-Dec-2025 20:14:23 EST