Jump to content
  • Advertisement
Sign in to follow this  

Storing attack information

This topic is 3497 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need a list of RPG spells, which I have composed of effects classes. Damage effects, healing effects, status effects, etc. How should I go about storing the information, info like a lightning spell does X + 75 damage, or that the bio spell does 20 damage and poisons? A database? A textfile? In the code itself? Edit:This is in C++

Share this post

Link to post
Share on other sites
How about an AttackInfo class that stores the attack information and then you push it into a vector.
I think there is no need to store that info to a database/file. Although I don't know what kind of game you are writing, but I think there is no need to store these infos any longer than a single game session.

class AttackInfo {
AttackInfo(std::string msg, Monster *monster, SpellEffect *effect, int dmgAmount);

std::string m_strMsg;
Monster *m_pTargetMonster;
SpellEffect *m_pUsedSpell;
int m_nDmgAmount;


void attackMonster(Monster *pMonster, SpellEffect *pEffect, int dmgAmount) {
//returns std::vector<AttackInfo*>
getAttackInfoList()->push_back(new AttackInfo("Critical hit!", pMonster, pEffect, dmgAmount)));

Something like this?


Share this post

Link to post
Share on other sites
I agree with zeeli. I see no problem with hard coding that information into the game. If you want more than one effect per spell consider using a linked list.

However only hard code the spell information if you intend to leave it alone. If you want a more dynamic approach store it in a file. Just don't forget to encrypt that! Many games do in fact store the spell data separately from the game executable this allows them to update and tweak values more efficiently.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!