Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


alnite

Member Since 07 Nov 2002
Offline Last Active Today, 03:57 PM

#4939434 New to Game Programming, Sub: Creating RPG Skills

Posted by alnite on 11 May 2012 - 04:19 PM

Am I correct in thinking that things like status effects etc. wouldn't need to be included in the main ISkill inheritence tree?


You can. It's up to you how to design it. You can create a new class StatusEffect that implements ISkill, and this class will have common attributes for status effects like duration, damage +/-, and so on. Then if there's a special status effect that requires extra code, it can inherit from the main StatusEffect class, and add extra code as necessary.

I'd do it this way, so I can have an array of ISkill in the Actor class, and just iterates through it every frame calling applySkill(this);

You could just call applyEffect(Poison) within applySkill of any specific skill, right?


Yes, that's up to your implementation details.


#4939362 New to Game Programming, Sub: Creating RPG Skills

Posted by alnite on 11 May 2012 - 12:41 PM

I'm not entirely sure that I follow, sorry. It looks like your Fireball sub-class will only be able to execute a single ability, "Fireball". I understand that instead of having individual stats for each Skill, you could just use the specific numbers you need in each of those applySkill methods (which mean yeah, I don't need most of those stats),


Yes, each one of those method will execute a single ability.

but this loops back to the problem I had in the first place - I don't necessarily want to hard code 60 skill classes this way.


If you really want to make it that dynamic, then you need to implement a scripting system powerful enough to cover all types of skills, and that's probably several more months of development time. And TBH, you don't gain that much benefit unless you allow MODs to your game.

Each skill, eventually, is going to have to be unique and hardcoded to a certain extent. It's going to have its own graphics, its own projectiles, and its own behavior (summoning skills that create new units? skils that lasts over time? AoE effect? global effect? skills that spawn more skills? A couple of booleans and ints aren't going to be able to encapsulate all that, so you might as well code them all individually.

If you are smart in organizing your skill libraries, you don't have to code 60 skills separately. See below:

From what I do understand though, your way of creating skills seems to be way more open, which sounds really great. I'm just not sure how you'd be able to keep that openness without making a different class for every single skill.

Again, sorry if I'm missing your point here. I'd appreciate it if you could clarify things for me.


You don't have to, thanks to inheritance.

class FireBasedSkill : public ISkill {
public:
	virtual void applySkill(Actor& actor) {
		// apply fire-based damage to actor
	}
};

class Fireball : public FireBasedSkill {
	virtual void applySkill(Actor& actor) {
		FireBasedSkill::applySkill(actor);
		// apply fireball-specific code here
	}
}

class UberFireball : public Fireball {
	virtual void applySkill(Actor& actor) {
		Fireball::applySkill(actor);
		// more damage!!! burns the target for 100 seconds, etc. etc. etc.
	}
}



#4939172 New to Game Programming, Sub: Creating RPG Skills

Posted by alnite on 10 May 2012 - 06:33 PM

You don't want to have that AssignDamage method. As the number of skills grow, so is the size of that method.

Skill should be an interface, and it defines nothing (no attributes, damage, type, element, etc.). Here's an overview:

class ISkill {
public:
    virtual void applySkill(Actor& actor) = 0;
    virtual std::string getDescription() = 0;
};

class Fireball : public ISkill {
public:
    virtual void applySkill(Actor& actor) {
	    // do fireball damage here to actor
    }
};


By defining Skill as an interface without attributes, first, you are opening your skill libraries virtually limitless. You are not stuck to elemental skills, but also different types of skills, perhaps a specific swords slashes or pickpocket. Second, you won't have a large method body with different switch-case statements for different types of skills, as each skill is responsible in writing its own method to apply the effect to an actor. Third, you can use this interface as active skills (actor to actor), passive skills (actor to self), or status ailments (overtime buffs or debuffs).


#4928581 rename variables in release mode (like C++ #define)

Posted by alnite on 05 April 2012 - 01:57 PM

You need an obfuscator.

Here's what Google says about it.


#4928577 Best approach to loading and saving game data?

Posted by alnite on 05 April 2012 - 01:35 PM

I've been doing some research on ways to read and write data but don't know which is the best way to go about it.


It depends on the game and what you want to save. There's no one universal saved game format.

As for the writing data how do I go about saving? I went and looked through other game's save files. Why are some not in plain text? I assume they're encrypted or need to be opened with an appropriate editor.


Reasons why games are not in saved in plain text to prevent cheating, and save bytes (binary format generally takes up less space in disks than text). If saved games are human-readable, then it makes it very easy for anyone to modify it. You can, for example, change your character stats all to 100 if you present them right there in plain text format. You can still do it even in binary, but at least it'd deter enough people.

For loading from a file, I could create some values in a text file and have it read to the game but what if I wanted to add descriptions or commentary to the file so I know what values are which and not have it read by the game? I thought about using Regular Expressions to cut out the stuff I don't need when the game is reading but is that doing more than I really need to? I'm just throwing ideas around and hoping to get some feedback.


Ideally, you want to be able to save in both text format and binary format. During development, you save it in text-based format (your own, XML, JSON, whatever), and you can put all the comments you want. When you are ready to release, you switch it to binary, removing all the unnecessary comments.


#4927705 Hi everyone! - said the complete beginner

Posted by alnite on 02 April 2012 - 06:00 PM

Wait.

Have you ever had a job? That's the best way to enter the industry, and get yourself familiar with the workflow, and the best thing is one of your colleagues will be a programmer, and you two might become best friends and start your own project together!

You don't go through this contract stuff if you don't even know what's going on.


#4927701 How to read PNG images without a library?

Posted by alnite on 02 April 2012 - 05:51 PM

You do realize that PNG comes in many different flavors depending on bit depth, transparency, and such? Have you ever ran across an API or library that claims it can read PNG but realized that it can only read some PNGs? If you really want to learn the structure of PNGs, have several sample of PNG images (8bit, 24bit, 32bit), with and without transparency, open up a PNG documentation, and try parse those images mentally using a hex editor.

Maybe you are doing it for yourself, but I can almost guarantee that at the end of it, you'd feel that you'd just wasted your time as the other library did it better than your version.


#4907242 How to learn Visual Studio for C++ game programming?

Posted by alnite on 29 January 2012 - 12:55 AM

You should leave those settings as is. Most of them work right out of the box.

The only thing I ever needed to change the settings is when I'm configuring precompiled headers, and that's probably one of the first things you should learn on Visual Studio. I've seen students getting frustrated over PCH. Somehow it was turned on, and his Hello World app spitting linker error, and he did not understand what the f* was going on.


#4905208 [Game] Buffs increasing damage?

Posted by alnite on 22 January 2012 - 03:05 PM

I'm surprised nobody has answered this yet.

The answer depends on how complex you want it to be. If you have more spells, with variety of affects, then you can create elaborate systems. If you have only a few of them, a few simple tricks will do the job.

Ideally, you need to setup a table with all the modifiers: Name of Spell, Attributes (fire,water,earth,air, etc.), Modifers (what it modifies). For example:


Name		   | Attributes | Damage | Damage %
----------------------------------------------------------------
Flaming Hands  | F		  | 0	  | 100
Lightning Bolt | A		  | 20	 | 0

The format is up to you. You read the table, and put into a class:

class Spell {
  std::string name;
  int attr;
  int dmg;
  float dmgMuliplier;

}

// add flaming hands effect to player. You want to have an array of all spells currently affecting the player.
player->applySpell(&flamingHands);

int Player::getDamage() {
   int dmg = intellect * 2;
   // iterate through each spell, and apply all the effects
   for (int i=0; i<spells.size(); ++i) {
	 // check attributes, fire, water, etc.
	  dmg += dmg * spells[i]->dmgMuliplier;
	  dmg += spells[i]->dmg;
   }
  return dmg;
}



#4900880 Multi Threading

Posted by alnite on 09 January 2012 - 12:50 AM

I'm just learning multithreading, could someone please explain why i get different outputs each time I run this? I understand that the three Free objects in the main method are running on separate threads at the same time, which is why the hello worlds show up first in the console. However, why do sometimes they all show up before the outputs from the Free class and sometimes one will be first and the others after it prints Hello 0, etc. Why is it different every time? i know it probably doesnt make much difference but could someone just clear it up for me?


No, they are not running at the same time. There's no guarantee threads are executing at the same time, or any time at all. Thread scheduling is done by the OS and you can't control that. The system might decide to run thread #3 first, then abruptly suspend it, and run thread #1 and #2 till they are done, then continue to #3.


#4894263 How to know if my PC is being monitored?

Posted by alnite on 15 December 2011 - 01:40 PM

Did you attach a monitor to your PC? I assume so. So, yes, your PC is monitored!


#4893196 I spent high school in front of my computer

Posted by alnite on 12 December 2011 - 12:18 PM

My high school had half programming and half hanging out. Though I didn't hang out with the 'popular' kids, but I never wanted to hang out with them anyway. I had my share of ditching classes, partying, gf, and all that.

My anti-social didn't begin to kick in until freshman college when I try to catch up with programming, though I reversed that during junior and senior year.


My biggest regret I didn't do in high school? Not finding anybody else passionate about game programming.. :/


#4889176 School? I would not call it that way.

Posted by alnite on 30 November 2011 - 01:49 PM

Can anyone confirm this? I doubt it will absolutely, unquestionably, have to be for 40+ years or for 60 hrs/week.

Yes. Welcome to the future, where it's all sunshine and rainbows mundane work. It may not be 60 hrs/week, but that hours is typical for programmers, especially in game industry. Let it not deter your, however. A CEO of a startup might pull off longer work hour.

Once you step outside of that comforting high-school, you better know what you want to do in life because that's what you are going to do for the rest of your life. So..this is your time to slack off and play. Who cares if your teacher can't teach programming.


#4888020 Worth a buck

Posted by alnite on 26 November 2011 - 09:00 PM

Not a bad idea.

Voters would need to pay $1 to vote for the best game, and developers get to make some profits.

I'd suggest to keep a percentage to keep the website running (say 30%-70%). You might also want to keep hosting all previous winners and have choice for people to purchase them at a buck.


#4885918 Silicon Valley article on Racism and Meritocracy

Posted by alnite on 20 November 2011 - 11:47 AM

I can't fully read that article. The author is going around and round talking about other mildly-relevant things. Why is it talking about sexism while the article is titled "Racism"?

I am sick of people talking about race. I am sick of people injecting race especially in their studies. Can't find African-American CEOs? Why are they even looking for an African-American CEO in the first place? What point are they trying to establish there? Do they realize that by conducting such studies, any findings of that study will only strengthen the stereotypes whether that's against black or white??

Example:
There are fewer women in CS? True.
From this finding, people then postulate a whole lot of crazy things such as: women are stupid, women like shopping more, men hate women, men don't like women in their field, and whatever bullcrap they started to create. Then they started blaming men! The fact is: CS men love women in their field because it's sausage fest there! I can't describe how excited men were whenever there is a woman applying for a programmer position. "Holy shit, she's cute and smart!"

Same thing here. Can't find black CEOs? There must be something wrong! Blame white people. Wow, wait! Last time I came back from the Silicon Valley, I observed there are a lot of Indians and Asians making big bucks from startups! Did that article even mention Indians or Asians? No it didn't! Maybe it's the Indians and Asians are racist?? Let's do more studies if that's true. STOP!

Who gives a shit about people race. There are a whole lot of things to consider to fully explain the lack of one particular race in one particular field. Maybe due to their cultural habits, they never even heard of it? Or even if they've heard of it, they don't live in Silicon Valley such that moving there is a considerably costly for them? Maybe they prefer to excel in other activities?? People have choices and preferences!




PARTNERS