What Do You Think?

closed account (GbX36Up4)
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
// Copyright © 2011 GreenPoole Productions
// Created By Alex, and Logan.

#include <iostream>
#include <windows.h>

using namespace std; // ALL OF THE GLOBAL VARIABLES, DO NOT TOUCH!
double surprise1;
string name;
double music;
double kindness;
double John;
double Brad;
double bradknow;
double question1;
double question2;
double JohnHeart;
double dragon;
double dragonoid;
double location;
double pastlocation;
double locationtype;
double copper;
double silver;
double gold;

double woodenshortswordqnty;
double stoneshortswordqnty;
double ironshortswordqnty;
double copperarmorqnty;
double ironarmorqnty;
double chainmailarmorqnty;
double fireringqnty;
double liquidwandqnty;
double firewandqnty;
double woodenshieldqnty;
double coppershieldqnty;
double ironshieldqnty;
double ironclaymoreqnty;




// All of the voids for the rooms
void room0();
void room1();
void room2();
void room3();
void room4();
void room5();
void room6();
void room7();
void room8();
void room9();
void room10();
void room11();
void room12();
void room13();
void room14();
void room15();
void room16();
void room17();
void room18();
void room19();
void room20();
void room21();
void room22();
void room23();
void room24();
void room25();
void room26();
void room27();
void room28();
void room29();
void room30();
void room31();
void room32();
void room33();
void room34();
void room35();
void room36();


void village_entrance();
void village1();
void village2();
void village3();
void village4();
void village5();
void village6();
void village7();
void village8();
void village9();

void D_lair_entrance();

void cave_entrance();
void cave1();
void cave2();
void cave3();
void cave4();
void cave5();
void cave6();
void cave7();
void cave8();
void cave9();
void cave10();
void cave11();
void cave12();
void cave13();
void cave14();
void cave15();
void cave16();
void cave17();
void cave18();
void cave19();
void cave20();
void cave21();
void cave22();
void cave23();

void oasis_entrance1();
void oasis_entrance2();
void oasis1();
void oasis2();
void oasis3();
void oasis4();
void oasis5();
void oasis6();
void oasis7();
void oasis8();
void oasis9();
void oasis10();
void oasis11();
void oasis12();
void oasis13();
void oasis14();
void oasis15();
void oasis16();
void oasis17();
void oasis18();
void oasis19();
void oasis20();
void oasis21();
void oasis22();
void oasis23();
void oasis24();
void oasis25();
void oasis26();
void oasis27();
void oasis28();
void oasis29();
void oasis30();
void oasis31();
void oasis32();
void oasis33();
void oasis34();
void oasis35();
void oasis36();
void oasis37();
void oasis38();
void oasis39();
void oasis40();
void oasis41();
void oasis42();
void oasis43();
void oasis44();
void oasis45();
void oasis46();
void oasis47();
void oasis48();
void oasis49();
void oasis50();
void oasis51();
void oasis52();
void oasis53();
void oasis54();
void oasis55();
void oasis56();
void oasis57();

void I_Entrance();
void ilsand1();
void island2();
void island3();
void island4();
void island5();
void island6();
void island7();
void island8();
void island9();
void island10();
void island11();
void island12();
void island13();
void island14();
void island15();
void island16();
void island17();
void island18();
void island19();
void island20();
void island21();
void island22();
void island23();
void island24();
void island25();
void island26();
void island27();
void island28();
void island29();
void island30();
void island31();
void island32();
void island33();
void island34();
void island35();
void island36();
void island37();
void island38();
void island39();
void island40();
void island41();
void island42();
void island43();
void island44();
void island45();
void island46();
void island47();
void island48();
void island49();
void island50();
void island51();
void island52();
void island53();


void room3t2();
void room3t3();
void roomerror();
void johnconversation();
void teleporter();
void gamestartup();
void bradstorebuy();
void bradstoresell();

// MENUS
void inventory();
void inventoryview();
void fundsview();





class ConsoleColor {    HANDLE console_handle;    CONSOLE_SCREEN_BUFFER_INFO saved_info;public:    ConsoleColor(WORD foreground, WORD background);    ~ConsoleColor();}; ConsoleColor::ConsoleColor(WORD foreground, WORD background)    : console_handle(GetStdHandle(STD_OUTPUT_HANDLE)){    GetConsoleScreenBufferInfo(console_handle, &saved_info);    SetConsoleTextAttribute(console_handle, foreground | background);} ConsoleColor::~ConsoleColor(){    SetConsoleTextAttribute(console_handle, saved_info.wAttributes);}





     void roomerror(){  // THE ERROR BLOCK, USED IF AN UNKNOWN COMMAND IS ENTERED
       system("cls");
       system("color CF");
       system("color 6F");
       system("color FC");
       system("color AF");
       system("color 6F");
       system("color CF");
       system("color FC");
       system("color CF");
       system("color AF");
       system("color 6F");
       system("color FC");
       system("color CF");
       system("color AF");
       system("color 6F");
       system("color CF");
       system("color FC");
       system("color CF");
       system("color FC");
       system("color AF");
       system("color 6F");
       system("color CF");
       system("color FC");
       system("color CF");
       system("color FC");
       system("color AF");
       system("color 6F");
       system("color CF");
       system("color FC");
       system("color CF");
       system("color FC");
       system("color AF");
       system("color 6F");
       system("color CF");
       system("color 0C");

          cout << endl << "The command was not understood.";
          cout << endl << "When we redirect you back to your room please be sure to type correctly." << endl;
          system("pause");
          if (location == 0){
                       cout << "Redirecting to room0......" << endl;
                      room0();
                      }
          if (location == 1){
                       cout << "Redirecting to room1......" << endl;
                       room1();
                       }
          if (location == 2){
                       cout << "Redirecting to room2......" << endl;
                       room2();
                       }
          if (location == 3){
                       cout << "Redirecting to room3......" << endl;
                       room3();
                       }
          if (location == 50001){
                       cout << "Redirecting to johnconversation......" << endl;
                       johnconversation();
                       }
          if (location == 1200000000){
                       cout << "Redirecting to main......" << endl;
                       }
          if (location == 11111){
                       cout << "Redirecting to Inventory......" << endl;
                       }
          }


       void teleporter(){ // TELEPORTER USED IF SOMEONE ENDS A CONVERSATION, IT TAKES THEM BACK TO THE BEGGING OF THE ROOM

           system("cls");

        if (locationtype == 1){
            locationtype = 0;
          if (pastlocation == 0){
                       room0();
                       }

          if (pastlocation == 1){
                       room1();
                       }

          if (pastlocation == 2){
                       room2();
                       }

          if (pastlocation == 3){
                       room3();
                       }

          if (pastlocation == 30002){
                       room3t2();
                       }



        }


        if (locationtype == 0){


          if (location == 0){
                      room0();
                      }

          if (location == 1){
                       room1();
                       }

          if (location == 2){
                       room2();
                       }

          if (location == 3){
                       room3();
                       }

          if (location == 30002){
                       room3t2();
                       }

          if (location == 50001){
                       johnconversation();
                       }

          if (location == 10001000){
                       bradstorebuy();
                       }
          if (location == 11111){
                       inventory();
                       }
        }

        }  
closed account (GbX36Up4)
Too lazy to copy and past 10 different peices of code. Is there an easier way to post with 2000 lines of code? :P
http://paste.pocoo.org/ should do nicely. BTW it looks like this is a very non-modular system right off the bat.
Looks like you are hard-coding your engine. That´s pretty bad idea, because creating a game this way is much more difficult to maintain. Take advantage out of object-oriented design, that is one of the key features of C++. Also use of arrays would be nice idea. Here´s an example:
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
void room0();
void room1();
void room2();
void room3();
void room4();
void room5();
void room6();
void room7();
void room8();
void room9();
void room10();
void room11();
void room12();
void room13();
void room14();
void room15();
void room16();
void room17();
void room18();
void room19();
void room20();
void room21();
void room22();
void room23();
void room24();
void room25();
void room26();
void room27();
void room28();
void room29();
void room30();
void room31();
void room32();
void room33();
void room34();
void room35();
void room36();


Isn´t this waste of code and time? I´d suggest to do it like this:

1
2
3
4
struct Room{
    // Room´s variables
};
Room rooms[36];


See? Think levels as objects (things that exist) & also keep in mind, this isn´t even the smartest solution. An example:
1
2
3
4
struct Level{
    bool is_room; // If this isn´t true, then this is room entrance.
    Level(void) : is_room(true){} // Initialize variables of this struct(ure).
};


I haven´t orientated myself with these pieces of code that further, but this kind of game engine design can be quite inflexible & hard to maintain.

Please learn more about generic, modular & object-oriented programming. That´s my main recommendation. You remind me about my early, flawed game engines that were quite badly designed. Learn more & you will figure out more benefits C++ has to offer. It makes your programming easier on the long run, trust me.
Last edited on
closed account (GbX36Up4)
http://paste.pocoo.org/show/452598/ Notes- The empty voids WILL be filled when we get to that point (Haven't worked in weeks and with school coming up even less time) - The Intro questions will be rremoved (too embarresing of a story to tell xD - Even though this version may not be completed, when I master C++ I will remake it (If it hasnt been made now)
closed account (zb0S216C)
General Coding and Naming Conventions:
Straight away, I noticed uninitialized objects. It's imperative that you initialize any object prior to its use. Your naming convention proves difficult to read. The identifiers aren't distinctive enough to determine their use.

Flexibility and Maintainability:
This design is far from flexible. in fact, this code is stiff as a plank. Games should be easily maintainable, especially when they grow. your code is neither flexible or maintainable.

White-Space:
There's so much of it. Since there's so much, you sometimes lose track of the line you're currently reading, just like the ConsoleColor class. The excessive use of white-space could prove problematic in the long run.

Documentation:
Your game lacks suitable documentation, which will make the code less understandable when editing it further on down the road. Documentation is vital, especially if you're working in a team. Your games
documentation level is below minimum. We don't don't even know the game's title.

Platform Compatibility:
Since you've managed to incorporate system( ) into your design, you've binded this game to the Windows operating system. Your game is not cross-platform.

Project Management:
Your project doesn't have this. Shockingly, you've crammed everything into a single source module. The lack of project management skills has cost you maintainability, especially when combined with the lack of documentation.

Overall:
I'm sorry to inform you, Logart, but this design is poor. You've defeated the purpose of OOP. In doing so, you've wasted time, space, and forfeited maintainability. The documentation levels are insufficient, the traces of documentation you did provide are less than acceptable, your ability to create cross-platform games is being called into question (personally speaking), your naming conventions are ineffective and uninformative, and you've created a game that behaves in an undefined manner when your global variables are used.

Final Rating: 3/10

Additional Foot Note: The game fails to compile in Visual C++ Express 2010 with many errors.

Wazzak
Last edited on
closed account (GbX36Up4)
I understand completely, but FYI I don't understand classes yet, and I haven't got the best idea as to what Object Oriented Programmining is about. Thanks for the review! :P
I really like the graphics. And all the text.
closed account (GbX36Up4)
Thanks, but there aren't any grapchics.
Just to add on, modular, OOP, re-usable features etc posted so often in this forum is not C++ programming language specific. The same concept is applicable in other OOP like say Java for instance.

The only main difference lies in their syntax and usage but the concept is same. E.g in Java we can have interface ABC {...} syntax but we do not have that in C++ but we can simulate that easily also.
E.g in Java we can have interface ABC {...} syntax but we do not have that in C++ but we can simulate that easily also.


Like using abstract classes?
Topic archived. No new replies allowed.