top of page

C++ Text Game

Pokemon clone using PDCurses

In our 2nd semester we were put into groups with the task of developing a vertical slive of a game that made use of a database. Having a text based interface was recommended but was not mandatory. Our group came up with the idea of a Pokémon clone with our own theme and we decided to use PDCurses (The windows equivalent of a library called NCurses). We chose this because it was compatible with windows and this was our preferred platform of choice. We were also using Git as our version control software.
Building from my knowledge taken from my previous Python Chat Bot project I definitely put into action some of the things I had taken note of. As this was the first project we worked on that included object oriented principles it became very clear towards the end of the project practices or ways of doing things that would have made life easier and code easier to manage if we knew at the start. An example of this is that it is common practice to define a class and its attributes / methods and then implement them in their own file. This not only improves the look of the code, it also would have been a very structured way to maintain the code that scales with our project really well. I began to do this towards the end of the project but the code for the group that had already been written this definitely could have been improved upon. 
The way the project was developed was a very sporadic way and not much thought given to how our code would work with each other. I can partly attribute this to our lack of experience in both group work and creating games; this only being the second game / program we have made in groups. We were held back due to problems with connecting our database to C++ code and this delayed our progress greatly, not being able to create the code for database integration or to be able to test any of the code relating to the database really crippled how much integration we wrote in. And ultimately was a contributing factor to why the slice was not finished in time. 
During the project, the way in which we gave feedback to the player about the option they were choosing (the player navigated with the arrow keys) most likely generated more code than its complexity should have allowed. Whilst not making it into the final version, being developed after the deadline I managed to create a custom function that would allow the programmer to create a grid based menu (3x7 or 10x2 for example) and have it handle the selection for you. Alleviating much of the tedious work of creating unique code, each time we wanted to generate a different menu. I've included the basic logic behind below.


We request user input, which is then switched depending on which key the user entered. Previously each menu the team wanted would be created individually, meaning more code and more potential bugs. With this, all we had to do was supply it with settings such as height, width, vertical gap or horizontal gap. Even adding further functionality like drawing a box around the menu became as easy as adding another boolean to the function call.    

The end result of the project, even though not finished was a definite learning success. I had received a mark over 70% for my contribution to the project and my knowledge of C++ and Git has definitely grown by a lot.

bottom of page