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, 11:20 AM

#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!


#4880221 Are 99%ers poking fingers at a failure of capitalism?

Posted by alnite on 03 November 2011 - 12:27 PM

One of the most central issues concerning the 99% movement isn't necessarily wealth and how much of it someone has, it's that the people with the most wealth have the most access to our democracy and political system. As a consequence of that, the system has been and is continually being rigged in such a way that favors the wealthy by making it even easier to buy influence. A feedback loop has been created here and I don't think even the 99% movement will bring an end to it.


This is IMO is probably one of the biggest cause people are out there. Rich people are funding political campaigns, and in turn, the elected officials (including the President) returns the favor by providing some type of loans or services, just in case of Solyndra and Obama administration. When you heard that, aren't you outraged? How did you burn through $500 millions in two years?

The trickle down economy is not working as the top people are saving themselves before they want to save others. Govt bailed company XYZ, company XYZ executives got bonuses, filed bankruptcy, and washed their hands. People are still not having jobs.

People have no jobs
People are pissed hearing news banks are getting bailed and executives getting bonuses
People get harassed by banks for not being able to pay back their loans/mortgages because they have no job.
People still can't get jobs
People have nothing better to do

What else are they going to do? Occupy movement is a natural reaction to what's been happening in Washington and Wall Street. Government activities have become privatized at the expense of the people.


#4879408 Starting to hate Google...

Posted by alnite on 01 November 2011 - 03:55 PM

I share your sentiment toward a lot of Google products.

My first cry was using gmail. Back in the day it was the most convenient webmail compared to Yahoo and Hotmail, but it was so difficult to use. Gmail for Android is even more so. The user interface is counter intuititive and frustrating. No concept of folders, but just labels, and my inbox shows ALL messages. It hides the Reply All, Forward, and other buttons inside a button that says Reply. So now it's two clicks away before I can forward emails. I was wondering if Google staff actually use Gmail. Some of them must have shared the same frustration? Yahoo mail now feels 10x better than Gmail.

Then there's Android, pretty much what you said there. I mentioned this on another post as well. They keep releasing new products and new features, and they are half-thought out. Ice Cream Sandwich has just gotten released, but how many Android users out there can immediately take advantage of it? Practically none. Why? Because it relies on device manufacturers to ship their devices with the OS, and the devices releasing now are still at 2.3! By the time the device manufacturers are able to release 4.0 Android devices, Google has probably announced an Android 5.

Then there's Google Docs for Android. I swear that product was full of bugs. Here's a company that developed Android and Google Docs, and you might think they would be able to combine both products correctly. Even with that much leverage, they still fail to deliver good products. Again, half-baked. One time it was causing an infinite loop, and didn't get fixed for days. They control Android, Google Docs, Android submission and testing, and yet they are still able to screw it up by launching a product that has an infinite loop at startup.

All their products have that open-source quality. Created by devs, for devs, if it works (even though it involves 10 steps) why bother with anything else?


#4876972 Teaching programming: examples

Posted by alnite on 25 October 2011 - 05:47 PM

The real fun of web programming is when you actually use web services and play around with the data. Showing text fields with buttons and outputting a bunch of <p>'s aren't that particularly interesting or practically useful.

Is it legally possible for you to get data from stock market, facebook, twitters, foursquare checkins? You teach your student how to signup, get the API key, and so on. Then call the external web services to deliver content to your homepage.


#4875249 what is the .net framework?

Posted by alnite on 21 October 2011 - 09:03 PM

but it provides libraries( such as iostream ) that are linked where the user can use them instead of worrying about the internals and can easily display to the screen ? which is pretty much identical to .net's framework of included libraries?


You have to decouple the thoughts of combining Libraries and Languages together. You should see C, C++, Java, C#, and other languages as languages, meaning that they contain semantics of expressing ideas using logic. For example, how do you write a loop, conditional statements, composing objects, expressing objects relationships, and so on. These are independent of the Libraries. Languages by themselves aren't practically useful.

Then, on top of the languages, are the Libraries (e.g. stdio.h, iostream, .NET, java.io). Each library has a purpose, but mostly serves as an interface to the hardware/platform the language is being used on, whether it's the keyboard, screen, web, or network. Some languages have libraries that allow low-level or system access, but some others are designed to work on other types of platforms (e.g. web).

stdio.h is not C, but written for C
iostream is not C++, but written for C++
Similarly, .NET is a framework, not tied to any language, written for multiple languages.


#4871672 I've been "cowboy coding" on the job most of the time. How do I g...

Posted by alnite on 11 October 2011 - 06:33 PM

Look for another job. Find a company that doesn't interview you much about software development process.

TBH, I don't like companies that interview developers about software development process. It's completely irrelevant.


#4870828 So who is still around these days?

Posted by alnite on 09 October 2011 - 09:59 AM

Now if you'll only update the site to the Black theme ... that'll be great :)


This!

This!!

This!!!


#4869573 C++ pointer to struct [edited]

Posted by alnite on 05 October 2011 - 03:58 PM

Though I am for using vectors, you still need to learn about memory allocations and deallocations. C++ has so many pitfalls that you need to be aware of. Improper usage of memory can turn your app inside out and you won't know why, and it's hell of a bitch to track down.


#4867776 Something you never knew about Steve Jobs

Posted by alnite on 30 September 2011 - 05:29 PM

Is this an iJoke?




PARTNERS