tagniam / turn Goto Github PK
View Code? Open in Web Editor NEWHacktkober 'n' Slash (C++ turn-based RPG game)
License: MIT License
Hacktkober 'n' Slash (C++ turn-based RPG game)
License: MIT License
The readme screenshots shouldn't show the Windows titlebars or scrollbars. There's also a weird red bar on the right of the battle screenshot that should also be cropped out.
Currently we don't embed sounds in the game executable: the program expects a sounds
folder in the same directory to play the sound files from. We'd like to change that, so that the sound files are embedded within the executable and would not require an external sounds
folder.
The implementation should work across all platforms. One possible way to do this is to convert the sound files into byte array constants, but let me know of any other (possibly better) approaches!
On the first run, the user has to set the player name. Unfortunately the player name will not include characters after a space in the name. So if you enter John Doe
as the player name, the name will be saved as John
.
GIFs are all the rage nowadays. It would be nice to showcase the game without having to build and run it locally, in the form of two gifs in the README:
Currently these items can only be used in battle. Ideally for extensibility these should be contained in a submenu on the intermission screen, i.e.:
1) Start Battle
2) Store
3) Gamble
4) Use Item
5) Quit
> 4
If the user levels up after a battle, show a message at the intermission screen congratulating the player.
Some of the coding style is inconsistent. Using a linting tool of some kind I'd like the code to follow the Google C++ Style Guide.
We'd like to add a new item type, the molotov, which deals 30-40 damage on the first hit and an additional 5-10 damage for the next 2 turns. Additionally:
In a lot of places, the project uses the C rand() function, even though the project itself is C++11, which has the "new" and fancy <random>
header.
C++11 and up projects should always use <random>
and one of its PRNGs instead of the severely limited C random functions, whose actual randomness is really platform-dependent and will work differently across libc implementations. Also using modulo to calculate a distribution skews the results. See this talk from STL, in which he describes why rand() is bad. (And also how to use the C++11 <random>
header.)
I suggest a small random wrapper function be made that takes a min and max and generates a random number within those. Something like this:
int random_int(int min, int max) {
static std::mt19937 rng(std::random_device{}());
std::uniform_int_distribution<int> dist(min, max);
return dist(rng);
}
And then use this function in all places where randomness is needed.
When a user plays the game for the first time, when they try to quit during intermission, the game goes back to battling.
create unit testing for the project covering various classes .
maybe google mock
Right now the inventory looks like this.
*----------- INVENTORY -----------*
Level 2 0/100 xp
| Arrows: [10]
| Potions: [0]
| Bombs: [3]
| Whetstones: [0]
| Weapon strength: [100%]
| Wealth: [48] coins
*---------------------------------*
3 things need to be implemented:
So it would end up looking like this diagram, labelled:
*----------- INVENTORY -----------*
| Level 2 0/100 xp | <- 3
+---------------------------------+ <- 1
| Arrows: [10] |
| Potions: [0] |
| Bombs: [3] | <- 2
| Whetstones: [0] |
| Weapon strength: [100%] |
| Wealth: [48] coins |
*---------------------------------*
You will have to do some character counting when implementing 2 and 3, since as the values add digits, less spaces will be needed.
To reproduce this bug, start the game and choose 2) How To Play
, then 1) Quit
, then 3) Quit
. The game only quits once you choose 3
twice, when it should quit right away.
I'd like to have a blurb that describes how to play the game in the main menu.
1) Start game
2) How to play
3) Quit
It should be possible to make this game cross-platform. This would require using a different build system (e.g. CMake), as well as replacing uses of the windows API. From a brief view, it appears that it's only used for:
Console input/output could possibly be replaced with ncurses/pdcurses. Alternatively, ncurses could be used on Linux while still having windows API on windows with ifdef's.
The game currently has sound effects for attacking and healing, but no sound plays when the player uses a potion.
We'd like to use a sound effect like this to play when the player uses a potion:
https://freesound.org/people/Jamius/sounds/41529/
Please make sure you credit the original author in Sound.cpp!
In the README there should be a sub-section under How To Play
called Player Classes
. The documentation should follow this table template:
Name | Attack Damage | Risk Attack Damage | Healing Amount |
---|---|---|---|
Player 1 | 10-15 | 20-25 | 10-15 |
Player 2 | 10-15 | 20-25 | 10-15 |
etc.
The Warrior
, Rogue
, Healer
, Debugger
, and Saitama
player classes should be documented.
The attack/risk attack/healing points is documented in each player's corresponding cpp
file.
In Game.cpp there is a how to play blurb that should be copied into README.md
. The ACTIONS
and ITEMS
sections shouldn't be copied since they're already in the readme.
The game currently has sound effects for attacking and healing, but no sound plays when the player uses a bomb.
We'd like to use a sound effect like this to play when the player uses a bomb: https://freesound.org/people/Taira%20Komori/sounds/215595/
Please make sure you credit the original author in Sound.cpp
!
See Gambling.cpp
. Gambling can only occur when the player has at least the same amount of coins as CoinsDeduction
. Check if the player has enough coins after GenerateValues()
method is called. If they don't, return to the intermission menu.
Here is how we currently calculate random damage (from GiantCrab.cpp
):
int GiantCrab::ReturnRiskAttackDamage() {
int selector = Common::RandomInt(0, 5);
switch(selector) {
case 0:
case 1:
case 2:
case 3:
return 0;
break;
case 4:
case 5:
return 20;
break;
default:
return 0;
break;
}
}
This basically means:
We'd like to create a helper method to avoid doing this. This is what I had in mind:
We'd have to create a function with the signature:
template<class T>
T RandomEvent(int denominator, vector<int> numerators, vector<T> outcomes)
where it must be that sum(numerators) == denominator
and numerators.size() == outcomes.size()
. The function takes in generic outcomes, so that even things like functions could be decided randomly.
With this helper function, the GiantCrab function could be rewritten as:
int GiantCrab::ReturnRiskAttackDamage() {
// 4/6 chance of doing 0 damage
// 2/6 chance of doing 20 damage
int denominator = 6;
vector<int> numerators{4, 2};
vector<int> outcomes{0, 20};
return RandomEvent<int>(denominator, numerators, outcomes);
}
This helper function should be placed in the Common
class. If you have another design in mind, or know any existing STL libraries that can do this, let me know - we can probably do better than this ๐
The game currently has sound effects for attacking and healing, but no sound plays when the player uses a whetstone.
We'd like to use a sound effect like this to play when the player uses a whetstone: https://freesound.org/people/GameDevC/sounds/422832/
Please make sure you credit the original author in Sound.cpp
!
The game currently allows the player to buy items from Jeremy's Tool Store
, but the player cannot sell any items from their inventory to the store. We'd like to implement selling functionality in Jeremy's Tool Store
.
The player should be able to sell items at the same price they can be bought, for example since 1 bomb from the store costs 100 coins, the player should be able to sell 1 bomb from their invenyory for 100 coins.
In the README there should be a sub-section under How To Play
called Enemy Types
. The documentation should follow this table template:
Name | Attack Damage | Risk Attack Damage | Healing Amount |
---|---|---|---|
Enemy 1 | 10-15 | 20-25 | 10-15 |
Enemy 2 | 10-15 | 20-25 | 10-15 |
etc.
The Crab
, Giant Crab
, Squid
, Giant Squid
, and Lich
enemy classes should be documented.
The attack/risk attack/healing points is documented in each enemy's corresponding cpp
file.
ye kya
When a player attempts to use an item that is not in their inventory, currently the game doesn't do anything at all.
Instead, there should be a message displayed that the item is not in the player's inventory, then call Sleep(SLEEP_MS)
and redraw the screen.
The game would be a lot more fun with audio. In-game sound effects will be needed when the player AND enemy does the following:
Make sure to credit where you get the sound effects from in the source code and in the readme!
There could be variation in the " encountered!" message at the beginning of a battle to add flavour to the game.
If there's no objections, I'd like to implement this.
The Windows macro checks check for _WINDOWS
to be defined, however, as I checked it is not defined on any compiler I have installed (GCC 9.2; clang 8.0.1; MSVC 19.21.27702.2) that can target Windows. It is not even mentioned on MSDN.
To note, my setup couldn't compile the program as is; it thought I was on something non-windows, and tried to include <termios.h>
.
Momentarily, I can do a pull request, to patch this, if it's alright.
Edit: some sound effects are already implemented, like the sounds for attacking, bow and arrow attacks, and healing. However some sound effects are missing:
The game would be a lot more fun with audio. In-game sound effects will be needed when the player uses the following items:
* Potion
* Whetstone
* Arrow
* Bomb
Make sure to credit where you get the sound effects from in the readme!
The game currently has sound effects for healing, but it should be changed to something shorter.
We'd like to use a sound effect like this to play when the player heals: https://freesound.org/people/KeshaFilm/sounds/471834/
Please make sure you credit the original author in Sound.cpp!
The use of compiler warnings is good practice and they should be enabled for all projects. On GCC and Clang -Wall
, -Wextra
, and -Wpedantic
should be enabled, while /W3
on MSVC.
With this, multiple warnings are generated when compiling:
MSCV:
C4530
: Basically an MSVC-specific warning that one should add /EHsc
to the compile flags. This is a simple CMake script fix.GCC:
-Wmisleading-indentation
: In Player.cpp there are a few else
cases where the following line is indented with a tab. This is not really a misleading indentation problem and is mostly just a false positive on the compiler's part, but that tab should really be a set of spaces since that function is mostly indented with spaces. (Also the whole project's is completely mixed on tabs vs spaces. IMO as a separate issue this should be fixed.)-Wunused-variable
: Player.cpp:539 defines int countLength = 0;
which is not used anywhere and should be deleted.Clang:
-Winconsistent-missing-override
: Descendants of the Enemy
class seem to override virtual member functions such as GetIntro()
and others like ReturnDamage()
which come from Entity
. These functions should be marked override
but they are not. I guess the compiler figures out what you wanted to do, but this is really bad practice. Note that this is triggered even if one passes no arguments to clang while compiling, as in this is a default warning.-Wunused-private-field
: The Game class's _Level
member is not used anywhere and should be deleted. (Also, identifiers starting with an underscore and then an upper case character (like _Level
, or _Player
) are reserved for implementations, and using them is undefined behavior)-Wreorder-ctor
: The member initializer list of SoundMaker class initializes members out of order. This is, iirc, UB, but most certainly nothing fun. Lines 77 and 76 should be swapped.I can make a PR with these fixes if it is going to be considered.
0
should be the default menu option for exiting the current menu.
For example, the main menu has option 3) Exit
, which should be changed to 0) Exit
, and the intermission screen has 5) Exit
which should be changed to 0) Exit
.
This ensures consistency in the game options.
It would be nice to let the player choose their gender when creating the character. Then, the correct pronouns should be used in battles etc. in order to improve immersion.
"He/his" pronoun is currently used in:
This one should be fun!
What use are coins without things to buy? Using their coins, the player should be able to buy the items they need for battle in this store.
The price breakdown for the items should be as follows:
In terms of the code, all the store functionality should be written inside Store.cpp
. The player object is already passed in to the StoreFront()
method as a starting point.
In the gambling menu, the option to pass and go back to the intermission menu is 3).
1) Reveal Die
2) Shake Die
3) Pass
We'd like to change it to 0), to be consistent with the rest of the game's menus:
1) Reveal Die
2) Shake Die
0) Pass
Currently we save player data by writing raw values line-by-line in data.txt
. It looks something like this:
1
Dude
M
11
10
89
35
2
9
18
78
401
We'd like to change the player data parsing code so that it supports reading from and writing to data.txt
in JSON format, which should be changed to look something like this:
{
"player_type": 1,
"name": "Dude",
"gender": "M",
"level": 11,
"experience": 10,
"health": 89,
"arrows": 35,
"bombs": 2,
"potions": 9,
"whetstones": 18,
"weaponstrength": 78,
"coins": 401
}
This way it is much clearer what the player's attributes are by looking at data.txt
.
Feel free to use a JSON parsing library, though preferably it should be lightweight and header-only!
The No Code of Conduct is a good candidate for this repo.
Spice up the game by creating your own enemy types (even if you can't/don't want to program, see below). Feel free to be creative! Here are some examples you could implement:
See #33 for an example of how to do it. You'll have to create a new class that extends the Enemy
class, and change Game::SetEnemy()
to make that class available during the random enemy generation. This is all done well in the example (thanks @RMDern!)
If you don't know how to program something like this, you can still contribute.
Every good RPG has shops with random greeting messages. This RPG is no different.
Jeremy's Tools Store needs random greeting messages to display whenever the player enters the store. Print the greeting right after the shop title.
For example:
Jeremy's Tools Store
"Buy somethin', would ya?"
----ITEM----------------COST------
1) Arrows x 5 200
2) Bomb 100
Make as many greetings as you'd like. Make sure they add a little personality to the game!
The game installation for Linux users can be made a lot simpler by putting all the installation commands into a configure
bash script.
As stated in the CMake docs, it is unwise to use GLOB_RECURSE
to find source files.
And even worse if used as here, without CONFIGURE_DEPENDS
, which should fix the problem of calling make ending up not recompiling some changed files.
I suggest adding at least CONFIGURE_DEPENDS
, but it'd be better to add each file separately and manually when added to the project.
The latter requires some community approval, therefore, I wasn't planning on creating a PR until it is discussed which route to take if one is even taken.
Current, Player::AddToInventory(vector<int> drops)
adds items to the player's inventory by checking drops[0] for the number of arrows to add, drops[1] for bombs, drops[2] for potions, etc.
We'd like to refactor this such that the method takes a vector of std::pair<ITEMTYPE, int>, where the first element in the pair is the type of the item to add and the second element in the pair is the amount to add.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.