advice and ideas would be appreciated

I am reasonably new to c++ and am currently using visual studio.
I have got a school project for year 11, to make a console 'RPG game', and my plan is to implement a name system that remember your name even after you have left the console, maybe through a text file that the console reads and places the 'name' were it is asked to go.
I am using 'cout' to display my text and 'if' and 'do' to display my text and options. Any advice for an RPG game in any way like combat systems, stats and etc would be greatly appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;



struct stats
{
	int stat1;
	int stat2;
	int stat3;
	int stat4;
	int stat5;
} stats;




struct player
{
string name;
int level;
int health;
int armour;
int agility;
int strength;
} player1;




void prologue()
{
	cout << "\n";
	cout << "----------------------------------------------------\n";
	cout << "---------------------Awakening----------------------\n";
	cout << "----------------------------------------------------\n";
	cout << "\n";
	cout << "familiar voice: An ancient hero..lost in battle....\n";
	cout << "familiar voice: Freed the wrold from an evil too great....\n";
	cout << "familiar voice: Yet after so many years...your ancient slumber\n";
	cout << "familiar voice: Has ended...the return of an ancient evil..\n";
	cout << "\n";
	cout << "\n";
	cout << "you here a whisper...a name...your name?\n";
	cout << "\n";
}








void player_name()
{
       string playername;
       cout<<"whats your name?: ";
       getline(cin,playername);
       cout<<playername;
	   cout<<"\n",
       system("pause"),
	   cout<<"\n";
	   system("cls");
}


						
void display()
{
		cout << "player1.level  :" << stats.stat1 << endl;
		cout << "player1.health  :" << stats.stat2 << endl;
		cout << "player1.armour  :"  << stats.stat3 << endl;
		cout << "player1.agility  :"	<< stats.stat5 << endl;
		cout << "player1.strength  :" << stats.stat4 << endl;
		cout << "\n" << endl;
		cout << "\n" << endl;
}







int main()
{
	{
	prologue();

	player_name();

	display();
	}



		int area_choice1, direction;


		int playerHP =25;
		int armour =0;
		int GhoulHP = 5;
		int PosHP =12;
		int undeadHP =6;

		string attchoice, attchoice2;

		int bridge_wheel = false;
		int bridge_down = false;

		int gauntlets = false;
		int boots = false;
		int chest_plate = false;
		int chain_mail = false;
		int helmet = false;


			    
		{
			cout << "*Your eyes open you see that your in some sort of box. A coffin.\n" 
			     << "Your hand starts burning. You look down in your coffin and see a burning light\n\n" 
			     << "A symbol burning into your hand. Some sort of rune*\n\n\n";

			do {

				cout << "Wait..i recognise this..ughh..my muscles ache...\n"
				     << "It feels like ive been ripped apart and put back together..\n\n"
					 << "atleast i remember my name....i think its ";
				cout << player_name;

				cout << "hmm, theres tracks on the dust all over the floor. Someones been here recently.\n"
					 << "Well, theres no time to worry about that right now, the questions is,\n\n"

					 << "how do i get out of here? well it looks like im in some sort of hallway.\n"
					 << "at the end it looks like a torch is down there on the wall...\n"
					 << "*you tumble back and fourth walking down the walls of  your tomb, learning to walk yet again*\n"
					 << "at the end of your hallway, under the light of the torch, you notice crate with some unlit torches\n"
					 << "you pick one up and lit it on the fire of the torch above torch.\n";
				system("pause");
						cout << "*In the hallway, you have 2 paths, but which way should i go?*\n"
							 << "left has this foul smell, while the right has this constant drip noise echoing.\n\n"
							 << "which way do you choose? left(1) or right(2) or (3) to check to go back after getting a torch and check your tomb\n";

				cin >> area_choice1;
				
			switch (area_choice1){


					case 1:
						system("cls");
						cout 	<< "(LEFT)"
								<< "going down the path the foul odour gets stronger and stronger until you get to a large room full of empty coffins\n"
								<< "but these coffins weren't always empty? it seems like theyve been knocked out from the crypt walls and smashed open...\n"
								<< "you walk coser to the closest coffin where the foul smell is strongest..inside lays the eaten remains of some armoured soldier..\n"
								<< "but he wasnt the first one in hear..its too fresh a kill? maybe this was the one who left the tracks? *as you back away you hear this loud screech*\n"
								<< "you look towards where the noise came from and see two glowing blue eyes...and your recognise these eyes...ghouls!";
							cout << "GhoulHP: " << GhoulHP << "		playerHP: " << playerHP << "\n\n";
							cout << "type 'att' to defend yourself!";

								cin >> attchoice;

									if (attchoice == "att")
									{
										cout << "you punch the ghoul and deal: -5HP\n";
												GhoulHP -=5;
										cout << "\n" << "GhoulHp: " <<GhoulHP;
										cout << "\n";
										system("pause");



											cout << "as you look around the room after defeating the Ghoul you notice a cicular objet..a wheel"
											     << "maybe itll be useful later\n\n";
											cout << "*you pick up the object*\n";
												bridge_wheel = true;
											cout << "press (1) to go back to hall, press (2) to stay in room and check around for anything";
											system("pause");




											cin >> direction;

										if(direction = 1)
											{
												break;
											}
										if(direction = 2)
										{
											cout << "you check around and notice a metal object\n *you go towards the metal object and realize what it is*\n"
											     << "it's a gauntlet...but not any gauntlet..it was mine...i remember it...\n"
												 << "its stll got the burn mark from my last battle...it has blades along the side of it..arm-blades\n";
											 gauntlets = true;
											 armour =+10;
										}
									}
						break;

					case 2:
						system("cls");
						cout 	<< "(RIGHT)"
						     	<< "going down the right path you notice it leads to a giant circular room, in front of you\n"
								<< "a pool of water and it looks like a draw bridge on the other side. *you notice a pillar with and axil coming out\n"
								<< "looks like its missing a wheel..maybe for the bridge?";
						cout << bridge_wheel;
								if(bridge_wheel = false)
									{
										cout << "I'll have to find the wheel for the bridge";
									break;
									}
								if(bridge_wheel = true)
										{
											cout << "you place the wheel onto the axil and turn it, the bridge comes down.";
											bridge_down = true;
												if(bridge_down = true)
											{
												cout << "the bridge is now down do you wish to proceed?"
													 << "press (1) to leave, press (2) to stay and and look around at your tomb.";
													
													cin >> direction;

													if(direction = 1)
														{
															cout << "";
														}
													if(direction = 2)
														{
															cout << "";
														}
											}
										}
						break;


						case 3:
							system("cls");
							display();
						cout << "(TOMB)"
							 << "you search your tomb and notice chain...its your old chain mail"
							 << "you put it on and you feel how light it is...it ways almost nothing"
							 << "but can tell by how well its made it has to be strong.. a word slips from your mouth..mythril..";
						armour =+20;
						cout << stats.stat3;
					break;
					
					}


			   }while (area_choice1 !=5);
		}

			cout 	<< " "
					<< " "
					<< " ";

		    cin >> attchoice;

system ("pause");
return 0;
}


here is my code
Last edited on
There's quite a few console RPG's out there. Most old but fun. For pure design ideas I think you should post this on reddit/r/gamedesign i think it's called. You could also take inspiration from Dungeons and Dragons as it's a pen and paper rpg.
But if you want to know some ideas on how to implement those things, I once made a console RPG and I had a while(true) loop, and after the input which would signify the end of the user's turn, comes the enemy who does randomized moves, then it comes to the player input again and so on until you win the combat. It was actually a series of whiles in other whiles.
If you really want to make a more complicated thing you should use Classes or at least Structures and make your game easier to implement.
It may be because of the website, but your code looks formatted horribly bad ^^, I find it hard to understand things from it, but whatever works for you.
Hope this helps anyhow
thank you for your comment daverave1212, it its formatted quite badly i know hahaha. Like i said i'm new to it and i cant seem to find any tutorials or examples of how i can implement classes or structures. If you could give an example of how i could implement your idea or a link to a forum or etc of a tutorial would be greatly appreciated
Yes, you can use fstream to save user information (name, game process, and stats) to a text file.

I suggest that you move your prompts and user choices into external files as well. One of the benefits of doing so is that you could use loops to scroll through the data. Another is that you could run spell-check on the text portion without worrying about accidentally changing code.

If you do go with external files for prompts and other text, you might find OOP easier for managing that kind of data. (and possibly look into <vector> since dynamic memory will be very helpful).

Battle systems can be kind of complex or very complex. Start as simple as you can. Get it working and then add complexity if needed.
Sudo-code BS:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
while(userHealth > 0 && enemyHealth > 0)
{
    user chooses type of attack or possibly healing potion
    user attacks/drinks potion
    tell the user what happened

    if(enemyHealth > 0)
    {
        enemy attacks
        tell the user what happened
    }
    else
    {
        display user-won message
        give user money/experience points
    }

    if(userHealth <= 0)
    {
        display user-lost message
        end of game? y/n
    }
}
Check if user has enough exp to "level up"
Something like that. Later you can give the enemy different types of attacks and use <cstdlib> rand() and srand() to add a bit of unknown-outcome to the battle. http://www.cplusplus.com/reference/cstdlib/
Last edited on
thank you very much newbieg! the first fight scene at the start is meant to be the same and an insta kill as it is the the start, and ill implement this sort of after the start! thank you again for your input! ill add this as soon as possible!
Topic archived. No new replies allowed.