Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Oct 2008
Offline Last Active May 05 2013 08:33 AM

#4961008 Can I avoid the hassle of these IDE's?

Posted by on 19 July 2012 - 11:04 AM

If it is possible to use a text editor and a compiler to do C++, please I'll read a 10,000 page tutorial over keep on fighting these IDE's. It would seem to me it's possible, just most rely on the IDE to take care of certain things that could likely be done fairly simply in one's code or with an additional library file.

The reason you hate the C++ IDE's is that you haven't read that 10 000 page tutorial that explains how C++ compilation works. You don't yet know why you have to jump so many loops in an IDE, but you have to set up those same things on the command line and it's even harder. You just don't know what you are doing but learning to do it by hand could actually be a great learning experience. You would learn why you have to do the things you do in IDE.

Last time I programmed C++(years ago) I had to pray I would get the right settings and libraries and it would still work on other computers too. C++ is complicated and I didn't have time to learn everything about compiling and linking with C++. I wasn't using an IDE either. It's not the IDE's, it's the language(or it's compilation model).

#4860244 Looking for some "best practices" advice

Posted by on 11 September 2011 - 12:51 AM

To simplify things, try to think OOP as something you do to reduce complexity and duplication. With complexity you can start simply by reducing the number of if and switch clauses. Many times the you reduce code duplication at the same time. Using weapons as example, you might have something like this:

// the code might look like Java, sorry <img src='http://public.gamedev.net/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />

void shootPlayersGun(){
    if(reloadSeconds == 0 && (gun == PISTOL || gun == SHOTGUN || gun == SMG)){
        if(gun == PISTOL){
            reloadSeconds = 0.5;
        } else if(gun == SMG)
            reloadSeconds = 0.1
        } else if(gun == SHOTGUN)
            reloadSeconds = 1;
    } else if(heatPercent < 100 && (gun == BEAMWEAPON || gun == FLAMETHROWER)){
        if(gun == BEAMWEAPON){
        } else if (gun == FLAMETHROWER){

Now if you have a 10 weapons you are going to have really long if and it would become more and more complicated. If you define a weapon interface you can reduce this to:
Now you can put all your weapon code in different weapon classes that implement the weapon interface and you don't have to wonder what code is associated with you beam weapons and so on. You don't have as many if's so your code is less complicated. To create a new weapon you just create a new weapon class and put your code there. At this point you can also start using inheritance, composition and other OOP stuff to start reducing code duplication too. You might not have less lines of code but this less duplication means smaller chances of bugs and when you fix a bug in one place it gets fixed everywhere.

In C++ I guess you could use completely abstract classes to define an interface.

#4845688 To goto or not to goto?

Posted by on 07 August 2011 - 12:33 AM

I guess I am a heretic, but I use goto in other situations that haven't been mentioned here. The most common is something like this:

for (int i=0; i<n; ++i) {
  switch (some_array[i]) {
    case 0:
    case 1:
      if (some_condition())
    	i=n;// DONE!!!

Now you are just avoiding goto for the sake of avoiding goto. You didn't improve readability at all.

#4842764 What Would YOU Like To See In Today's Games?

Posted by on 31 July 2011 - 12:43 AM

Constant storytelling. Don't make me kill dudes for an hour in a random cool place and afterwards vaguely tie it to the story. In both starcraft and freespace 2 the story was told between the missions and during the missions. I hate the feeling that level designers made the level first and afterwards it was made to fit into the story.

#4842530 Norwegian Retailer Pulls Violent Games In Wake Of Attack

Posted by on 30 July 2011 - 08:11 AM

They said they would retaliate with more democracy and freedom... Good job.

#4840725 FPS GAMES SUCK!

Posted by on 26 July 2011 - 12:35 PM

OKAY!!!! I hate to say this but fps games suck. Every fps game I've played from CoD to the Crysis and ...

I'm really happy for you and I'mma let you finish, but rpg's are the worst games of all time. THE WORST GAMES OF ALL TIMES!

#4812558 Can't find "javax.mail.*" in Eclipse, how should I fix this?

Posted by on 18 May 2011 - 09:38 AM

I noticed that in Eclipse IDE, I can't find javax.mail package API class. I probably am missing some other packages that I didn't know where or how it disappeared.

I have obtained the latest Java SE 6 stable release, update 25. Did a reinstall. Yet it didn't fix the problem. So, I'm confused. Thanks in advance.

You need the Java Mail library. You can get it from http://www.oracle.com/technetwork/java/javamail/index-138643.html and you need to add it to your projects build path.

#4780860 Am I thinking right OO way?

Posted by on 02 March 2011 - 12:06 AM

My advice is that go with the solution seems right to you. Later if you run into trouble, don't be afraid to refactor and admit that you are wrong. Everyone does mistakes, some people learn from theirs.

Also, I would do it with composition :) Player and AI have a score to keep and different ways of controlling the paddle. Paddle doesn't care about scores. It's there to bounce balls and chew bubblegum and this game is all out of bubble gum.

#4755971 "Game devs should avoid forums." WHAAAA?

Posted by on 06 January 2011 - 11:19 PM

Well if there is something I disagree with him, it's the title. Never say never, there's always exceptions :)