+1 (315) 557-6473 

Simple role-playing games assignment sample

"Learn how to create a role-playing game from our experts. We offer both online tutoring and assignment writing help with game design to enable students to grasp the concepts easily. "

Simple RPG

The Game Begins... Role-playing games enable the users to create their own fantastic game characters based on some characteristics. Each Class has its own characteristics, pros and cons. A fighter is stronger but non-flexible, a wizard uses magic but is vulnerable, a rogue is quick but weak and a ranger is capable of using two weapons simultaneously but lacks other fighting skills.  The Race of each character also affects his characteristics. In order to become stronger, a character must gather experience points and when the experience points reach a limit then the character gains a Level. Part 1 - Character Creation Develop a program that will create a Human Character with the following characteristics:
  • Name
  • Class
  • Race
  • Level
  • Experience Points
  • Body Skill
  • Mind Skill
The steps of this program will be the following:
  1. When the program launches the user will set the Name of the character between Ragnar for Male characters (pressing 1) and Elhonna for Female Characters (pressing 2).
  2. A selections of 4 Classes will be available for the user by pressing a key; 1 - Fighter, 2 - Wizard, 3 - Rogue and 4 - Ranger.
  3. A selection of 4 Races will be also available; 1- Human, 2 - Dwarf, 3 - Elf and 4 - Half-Orc.
The Name, the Class and the Race will be set by the user, the Level equals to 1 and the Experience points equals to 0. The basic Body and Mind skills are by default 10, but they will be modified according to the selection of the class and the race as shown in the following tables.
Class Body Mind
Fighter 3 0
Wizard -1 4
Rogue 2 1
Ranger 2 1
 
Race Body Mind
Human 0 0
Dwarf 2 -2
Elf 1 1
Half-Orc 4 -4
After the completion of these steps a level 1 Character will be created and his/her characteristics will be displayed on screen. Game Character Example Ragnar the Dwarf is Level 1 Fighter. He has 0 Experience Points and his Body Skill is 15 (10 Base + 3 Fighter + 2 Dwarf) and his Mind Skill is 8 (10 Based - 0 Fighter - 2 Dwarf).
Name Ragnar
Class Fighter
Race Dwarf
Level 1
Experience Points 0
Body Skill 15
Mind Skill 8
Part 2 - Combat

Create 5 sequential virtual combats of the character. The combats will be announced to the user with a brief description of the location and the opponent. After each combat the character will be rewarded with an amount of Experience points of your choice (e.g. 200 + 200 + 100 + 400 + 500). When the Experience points reach or overlap 1000 experience points the character gains a Level. The user will be called to assign 2 Skill Points either to Body or Mind. After this assignment all the characteristics of the character will be displayed on the screen. Example Character Output Ragnar the Dwarf is now a Level 2 character (1100 Experience points are greater than 1000) and 2 Skill Points are assigned on Body Skill making Ragnar the Dwarf stronger and faster.

Name Ragnar
Class Fighter
Race Dwarf
Level 2
Experience Points 1100
Body Skill 17
Mind Skill 8
Assignment 2  Use parts of the character creation code from Assignment 1 (or create a new one) and create a basic combat system and a fighting arena.
Class Weapon Attack Damage Armor Hit Points
Fighter Battleaxe 10 10+(1 to 10) 18 15
Wizard Magic Missile Ignores Armor 4+(5 to 10) 10 8
Rogue Dagger 4 3+(1-3) (there is a 30% chance to triple the damage after each successful attack) 15 11
Ranger Two Longswords 6 (7+(1 to 8))*2 17 13
  1. Add four more Characteristic to your character; Attack, Damage and Armor andHit Points based on the table below. Use different Classes in order to create each Character Class.
  1. After the creation of two characters by the user a virtual Combat will start. Use all the available characteristics and the Combat Mechanics in order to develop a realistic Combat System. After each round (see below) display the condition of the Combat to the users and after the completion of the combat display the Name and the Hit Points of the winner.
Combat Mechanics A combat is a series of rounds. During each round one of the Characters attacks first (this is to be determined randomly) and after this attack the other opponent attacks as well. When both characters complete their attack actions, we have a new round. The Character attacks with the Attack (except the Wizard which always hits) and adds a random number from 1 to 20 (e.g 10 Base + 5 Random = 15). If the Total Attack score equals or overlaps the Armor of the opponent then the hit is successful and an amount of damage (see the equation) is inflicted to the opponent. If the Hit Points of the opponent are equal or drop below 0 then the opponent drops. Guidelines Use separate programming Classes in order to create the different character classes. Use Functions and Variables in order to represent the characteristics and the actions of the characters.

 main.cpp

#include

#include // Needed for the true randomization

#include

#include

#include

#include

using namespace std;

stringpName = “Placeholder”;

stringpClass = “Placeholder”;

stringpRace = “Placeholder”;

intpLevel = 1;

intpExperience = 0;

intpBody = 10;

intpMind = 10;

int main()

{

srand(time(NULL));

int input;

cout<< “Ragnar[1] or Elhonna[2]” <

cin>> input;

if (input == 1)

{

pName = “Ragnar”;

}

else if (input == 2)

{

pName = “Elhonna”;

}

int input1;

cout<< “Fighter[1] or Wizard[2] or Rogue[3] or Ranger[4]” <

cin>> input1;

if (input1 == 1)

{

pClass = “Fighter”;

}

else if (input1 == 2)

{

pClass = “Wizard”;

}

else if (input1 == 3)

{

pClass = “Rogue”;

}

else if (input1 == 4)

{

pClass = “Ranger”;

}

int input2;

cout<< “Human[1] or Dward[2] or Elf[3] or Half-Orc[4]\n”;

cin>> input2;

if (input2 == 1)

{

pRace = “Human”;

}

else if (input2 == 2)

{

pRace = “Dwarf”;

}

else if (input2 == 3)

{

pRace = “Elf”;

}

else if (input2 == 4)

{

pRace = “Half-Orc”;

}

if ((pClass == “Fighter”) && (pRace == “Human”))

{

pBody += 3;

pMind += 0;

}

else if ((pClass == “Fighter”) && (pRace == “Dwarf”))

{

pBody += 5;

pMind += -2;

}

else if ((pClass == “Fighter”) && (pRace == “Elf”))

{

pBody += 4;

pMind += 1;

}

else if ((pClass == “Fighter”) && (pRace == “Half_Orc”))

{

pBody += 7;

pMind += -4;

}

if ((pClass == “Wizard”) && (pRace == “Human”))

{

pBody += -1;

pMind += 4;

}

else if ((pClass == “Wizard”) && (pRace == “Dwarf”))

{

pBody += 1;

pMind += 2;

}

else if ((pClass == “Wizard”) && (pRace == “Elf”))

{

pBody += 0;

pMind += 5;

}

else if ((pClass == “Wizard”) && (pRace == “Half_Orc”))

{

pBody += 3;

pMind += 0;

}

if ((pClass == “Rogue”) && (pRace == “Human”))

{

pBody += 2;

pMind += 1;

}

else if ((pClass == “Rogue”) && (pRace == “Dwarf”))

{

pBody += 4;

pMind += -1;

}

else if ((pClass == “Rogue”) && (pRace == “Elf”))

{

pBody += 3;

pMind += 2;

}

else if ((pClass == “Rogue”) && (pRace == “Half_Orc”))

{

pBody += 6;

pMind += -3;

}

if ((pClass == “Ranger”) && (pRace == “Human”))

{

pBody += 2;

pMind += 1;

}

else if ((pClass == “Ranger”) && (pRace == “Dwarf”))

{

pBody += 4;

pMind += -1;

}

else if ((pClass == “Ranger”) && (pRace == “Elf”))

{

pBody += 3;

pMind += 2;

}

else if ((pClass == “Ranger”) && (pRace == “Half_Orc”))

{

pBody += 6;

pMind += -3;

}

cout<

//Combat//

for (int i = 0; i < 5; i++)

{

intexpGain = (rand() % 4 + 1) * 100;

cout<< “In combat…” <

pExperience += expGain;

}

if (pExperience> 1000)

{

pLevel = pLevel + 1;

int input3;

cout<< “Assign Skill Point. Assign to Body[1] or Mind[2]\n”;

cin>> input3;

for (int i = 0; i < 2; i++)

{

if (input3 == 1)

pBody += 1;

else if (input3 == 2)

pMind += 1;

}

pExperience -= 1000;

}

cout<

system(“pause”);

Solution

 Character.cpp

 #include

#include “Character.h”

Character::Character()

{

pName = “Placeholder”;

pClass = “Placeholder”;

pRace = “Placeholder”;

pLevel = 1;

pExperience = 0;

pBody = 10;

pMind = 10;

pWeapon = “Placeholder”;

pAttack = 0;

pArmor = 0;

pHitPoints = 0;

pLastAttackSuccessful = false;

}

void Character::Create()

{

Input_Name_Class_Race();

CalcBodyAndMind();

Calc_Attack_Damage_Armor_HitPoints();

}

void Character::Attack(Character& opponent)

{

int attack = pAttack + rand() % 20 + 1;

if (pAttack != -1)

{

cout<

}

else

{

cout<

}

cout<

cout<< ” Hit Points (‘” <

cout<< ” Armor (‘” <

if (attack >= opponent.pArmor || pAttack == -1)

{

int damage = Damage();

cout<< “—-Damage: ” << damage <

opponent.pHitPoints -= damage;

if (opponent.pHitPoints> 0)

{

cout<

}

else

{

cout<

}

pLastAttackSuccessful = true;

}

else

{

pLastAttackSuccessful = false;

cout<< “—-Attack failed—” <

}

}

void Character::OutputInfo()

{

cout<

cout<< “Weapon: ” <

}

bool Character::IsDropped()

{

returnpHitPoints<= 0;

}

string Character::DisplayName()

{

stringdisplayName(pName);

displayName += ” (‘”;

displayName += pClass;

displayName += “‘)”;

returndisplayName;

}

void Character::Input_Name_Class_Race()

{

int input;

cout<< “Ragnar[1] or Elhonna[2]” <

cin>> input;

if (input == 1)

{

pName = “Ragnar”;

}

else if (input == 2)

{

pName = “Elhonna”;

}

int input1;

cout<< “Fighter[1] or Wizard[2] or Rogue[3] or Ranger[4]” <

cin>> input1;

if (input1 == 1)

{

pClass = “Fighter”;

}

else if (input1 == 2)

{

pClass = “Wizard”;

}

else if (input1 == 3)

{

pClass = “Rogue”;

}

else if (input1 == 4)

{

pClass = “Ranger”;

}

int input2;

cout<< “Human[1] or Dward[2] or Elf[3] or Half-Orc[4]\n”;

cin>> input2;

if (input2 == 1)

{

pRace = “Human”;

}

else if (input2 == 2)

{

pRace = “Dwarf”;

}

else if (input2 == 3)

{

pRace = “Elf”;

}

else if (input2 == 4)

{

pRace = “Half-Orc”;

}

}

void Character::CalcBodyAndMind()

{

if ((pClass == “Fighter”) && (pRace == “Human”))

{

pBody += 3;

pMind += 0;

}

else if ((pClass == “Fighter”) && (pRace == “Dwarf”))

{

pBody += 5;

pMind += -2;

}

else if ((pClass == “Fighter”) && (pRace == “Elf”))

{

pBody += 4;

pMind += 1;

}

else if ((pClass == “Fighter”) && (pRace == “Half_Orc”))

{

pBody += 7;

pMind += -4;

}

if ((pClass == “Wizard”) && (pRace == “Human”))

{

pBody += -1;

pMind += 4;

}

else if ((pClass == “Wizard”) && (pRace == “Dwarf”))

{

pBody += 1;

pMind += 2;

}

else if ((pClass == “Wizard”) && (pRace == “Elf”))

{

pBody += 0;

pMind += 5;

}

else if ((pClass == “Wizard”) && (pRace == “Half_Orc”))

{

pBody += 3;

pMind += 0;

}

if ((pClass == “Rogue”) && (pRace == “Human”))

{

pBody += 2;

pMind += 1;

}

else if ((pClass == “Rogue”) && (pRace == “Dwarf”))

{

pBody += 4;

pMind += -1;

}

else if ((pClass == “Rogue”) && (pRace == “Elf”))

{

pBody += 3;

pMind += 2;

}

else if ((pClass == “Rogue”) && (pRace == “Half_Orc”))

{

pBody += 6;

pMind += -3;

}

if ((pClass == “Ranger”) && (pRace == “Human”))

{

pBody += 2;

pMind += 1;

}

else if ((pClass == “Ranger”) && (pRace == “Dwarf”))

{

pBody += 4;

pMind += -1;

}

else if ((pClass == “Ranger”) && (pRace == “Elf”))

{

pBody += 3;

pMind += 2;

}

else if ((pClass == “Ranger”) && (pRace == “Half_Orc”))

{

pBody += 6;

pMind += -3;

}

}

void Character::Calc_Attack_Damage_Armor_HitPoints()

{

if (pClass == “Fighter”)

{

pAttack = 10;

pArmor = 18;

pHitPoints = 15;

pWeapon = “Battleaxe”;

}

if (pClass == “Wizard”)

{

pAttack = -1;

pArmor = 10;

pHitPoints = 8;

pWeapon = “Magic Missile”;

}

if (pClass == “Rogue”)

{

pAttack = 4;

pArmor = 15;

pHitPoints = 11;

pWeapon = “Dagger”;

}

if (pClass == “Ranger”)

{

pAttack = 6;

pArmor = 17;

pHitPoints = 13;

pWeapon = “Two Longswords”;

}

}

int Character::Damage()

{

int damage = 0;

if (pClass == “Fighter”)

{

damage = 10 + rand() % 10 + 1;

}

if (pClass == “Wizard”)

{

damage = 4 + rand() % 5 + 1;

}

if (pClass == “Rogue”)

{

damage = 3 + rand() % 3 + 1;

if (pLastAttackSuccessful)

{

if (rand() % 3 == 0)

{

damage *= 3; // triple damage

}

}

}

if (pClass == “Ranger”)

{

damage =2 * (7 + rand() % 8 + 1);

}

return damage;

Character.h

 #pragma once

#include

using namespace std;

class Character

{

public:

Character();

void Create();

void Attack(Character& opponent);

stringDisplayName();

voidOutputInfo();

boolIsDropped();

private:

voidInput_Name_Class_Race();

voidCalcBodyAndMind();

voidCalc_Attack_Damage_Armor_HitPoints();

int Damage();

private:

stringpName;

stringpClass;

stringpRace;

intpLevel;

intpExperience;

intpBody;

intpMind;

stringpWeapon;

intpAttack;

intpArmor;

intpHitPoints;

boolpLastAttackSuccessful;

}; 

main.cpp 

#include

#include // Needed for the true randomization

#include

#include

#include

#include

#include “Character.h”

using namespace std;

void Combat(Character& character1, Character& character2)

{

cout<

cout<< “—- Game started —-” <

cout<< “———————-” <

intgameRound = 1;

while (!character1.IsDropped() && !character2.IsDropped())

{

cout<< “Round#” <

if (rand() % 2 == 0)

{

character1.Attack(character2);

if (!character2.IsDropped())

{

character2.Attack(character1);

}

}

else

{

character2.Attack(character1);

if (!character1.IsDropped())

{

character1.Attack(character2);

}

}

gameRound++;

}

cout<

cout<< “—- Game over —-” <

cout<< “——————-” <

if (character1.IsDropped())

{

cout<< “The winner is “<< character2.DisplayName();

}

else

{

cout<< “The winner is ” << character1.DisplayName() <

}

}

int main()

{

srand(time(NULL));

Character character1, character2;

character1.Create();

character2.Create();

character1.OutputInfo();

character2.OutputInfo();

Combat(character1, character2);

system(“pause”);

}