Jump to content

  • Log In with Google      Sign In   
  • Create Account

antiHUMANDesigns

Member Since 23 Jun 2012
Offline Last Active Jun 26 2012 11:06 AM

#4953053 total noob here. Can you recommend a c++ compiler?

Posted by antiHUMANDesigns on 26 June 2012 - 10:22 AM

This is known as an IDE. A compiler just takes the name of a file and makes an exe, it doesnt include an editor. For Windows the best IDEs are Visual Studio (which is made by Microsoft), Code::Blocks, and Eclipse. I don't know about eclipse but I know Visual Studio and Code::Blocks include a compiler with them. Id recommend you download Visual Studio 2010 Express edition to start.
Alternately, there are lots of text editors that you can code in, such as Notepad++ which you can also configure to run a compiler, or even just open a command prompt to run the compiler from


Dev-C++ is at least as good as Code::Blocks, I would say. Definitely better than Eclipse in my opinion. So ye, I recommend Dev-C++ if you, like me, think Visual Studio feels too cumbersome.


#4952904 Textured meshes don't look as they should?

Posted by antiHUMANDesigns on 25 June 2012 - 11:22 PM

I know why! Because when maya repeats textures, it only works in maya. To repeat textures, you should change the actual UV layout. Maya does something internally which is not exported.

That is, assuming you're repeating using the attributes in the window/sidebar to the right. If you repeat the texture in the UV editor, by scaling your UV's up, it'll work, assuming there's nothing else wrong.


#4952342 Few questions - collision detection

Posted by antiHUMANDesigns on 24 June 2012 - 09:34 AM

Thanks for answers, both of you.

winsrp, I'm making 2D game so BoundingBox and BoundingSphere are out of question... I'll use the tutorial you gave me. It will require complete code rewrite then...

Well then, I'll stick to the XNA for now and keep Unity in mind. Few 2D projects first, then I'll move on to 3D... I'll need to learn to use Blender or Maya too >.<


There's a good and free 2D physics library called Box2D (right?). You could check that out.


#4952338 Newbie

Posted by antiHUMANDesigns on 24 June 2012 - 09:26 AM


I agree with that guy. (Only watched the first part).

And I did start with a game-specific language (AMOS, which I dare assume is game-specific), but I was a kid and I didn't have a choice, it was all that was available to me at that time. I think I would've been better off going straight to C or C++. To me, it doesn't feel like knowing a game-specific language actually means you know programming. It feels like you're very much limited, and even worse, oyu may become too comfortable in it to ever progress outside of it, though I'm hoping few people would have such a problem.


Yeah, I watched all the 3 parts before a few days and that's why decided to start learning C++ because I've no clue about what is what and so I decided to take this guy's words by heart.


Try to see if you can find a friend who is also looking to start with game development, and join forces in learning. Discussing and solving rpoblems together on equal terms might be great both for moral and your ability to progress past hard points.


#4952331 Please simplify my code.

Posted by antiHUMANDesigns on 24 June 2012 - 09:10 AM




but C++ does not run on a virtual machine like Java does.


That does not have anything to do with why c++ doesn't have an "Application" class for the main.

riverreal is correct in that c++ is a multi paradigm language, which means you use oop where it helps, and procedural or functional (limited) programming etc where they help.

And I don't think having an "Application" class helps at all, making a class to be instantiated once (except for cases of inheritance) seems like a wasted effort.


A very small wasted effort, in such a case. But if a language is meant for OOP, then I think it should be done that way, just like Java (though I don't like Java). In Java, you don' thave the option to stray outside the OOP path, and I don't think C++ benefits from doing so. If you want to write a small program, you can choose to do it in C, and that's a choice. But you can also chose to do it with "proper" C++, which I feel is by going OOP like it was intended.

Don't you agree that C++ without OOP could just be C instead? Most of the improvements in C++ are related to abstraction. If you chose to ignore those, you might as well go with C?

Do note that I'm trying to teach a beginner the difference between C and C++. I dont have any other agenda here. But don't get me wrong, I never meant to claim that you can't write C++ procedurally. I agree that it will compile, but I'm also quite sure that the only reason it will still compile is because C++ never got a chance to get free of C. Stroustrup himself says that C is obsolete, and that he wants C++ to be free of it.


I disagree. As said above, C++ is a multi-paradigm programming language.
I actually mostly use GP (Generic Programming) with TMP (template metaprogramming) over OOP for code reuse and (static) polymorphism and find it much cleaner and more preferable.
Allowing to mix and choose is its strength over C# or Java (they have generics, but they're quite different, resolved at run-time, and rather limited). The whole idea of "pure OOP" where "everything is an object" is simply incompatible with GP or at best uninteresting; see interview with Stepanov, http://www.stlport.o...tepanovUSA.html

Of course that strength really shows when you mix in modern techniques, like GP and TMP, not meaning that you should stay with imperative programming / procedural programming for everything (with C-style code you'd have to deal with C-style errors).
And I find programs written in early style / "C with Classes" /* http://c2.com/cgi/wi...arlyCeePlusPlus */ to be a problem as well.
// IMVHO, OOP and some of its features are overused to the point of abuse -- I think you should learn templates and get used to static polymorphism/CRTP before you even begin to think about using the "virtual" keyword -- if you want to start with C++ the modern C++ way, learn templates, STL, and Boost first, picking GP and TMP as your main paradigms -- object-orientation second; the imperative & procedural stuff should just come to you in the meantime ;-) In the end: pick and choose what's optimal for your project (now you see why you should be aware of *all* the things to pick and choose from).

See:
http://www2.research...bs_faq.html#oop
http://www2.research...aq.html#generic
http://www2.research...l#multiparadigm
Why C++ isn't just an object-oriented programming language


OK, see, from everything I've read, 99% of people have nothing but bad things to say about templates, and I chose not to use them myself. (Though by doing so it also means I'm not good at them either.)
And I'm not exaggerating when I say 99%. I can't recall one single person, besides you, who has said anything good about templates.
I just made personal choice not to use them, but I admit that I no longer remember straigh off-hand why that is.

And don't get me wrong, I write things procedurally at times aswell. I just don't think it'd be a good thing to teach people to do things the easy way. Maybe I'm at fault, I'm not a licensed teacher. And, perhaps due to my aspergers, I do surely over-engineer things, because I want everything to make sense. And mixing procedural and OOP is the same application simply feels right-off stupid to me. I see no defense for it. (OR, more correcly: I see no defense for ME to do that.)


#4952321 Newbie

Posted by antiHUMANDesigns on 24 June 2012 - 08:39 AM

I agree with that guy. (Only watched the first part).

And I did start with a game-specific language (AMOS, which I dare assume is game-specific), but I was a kid and I didn't have a choice, it was all that was available to me at that time. I think I would've been better off going straight to C or C++. To me, it doesn't feel like knowing a game-specific language actually means you know programming. It feels like you're very much limited, and even worse, oyu may become too comfortable in it to ever progress outside of it, though I'm hoping few people would have such a problem.


#4952247 The Arc Tangent Program

Posted by antiHUMANDesigns on 24 June 2012 - 12:31 AM




Your first 2 result are 180 degrees off, see? And you're outputting with +180 in your code. You should check what you're doing there, and you'll figure it out.

EDIT: Oh, and change "3.14" to "3.1416" to get a little more precision, if you want.


Thanks it worked! But Oops! . The formula says " If θ is in quadrants 1 or 4 then θ = tan−1 (y / x).
Else if θ is in quadrant 2 or 3 then θ = tan−1 (y / x) + 180° " The Program seems to work fine now but there seems to be some logic problem. I'm adding 360degrees to the 3rd quadrant?!!


Well, I'm no expert on trigonometry, but I'm thinking that firstly, it depends on whether you supply x,y or y,x, and secondly, yes, you may need to "twist" the value by adding or subtracting 180 degrees, but it really depends on what you're going to use it for. If it's just a practice run for C++, don't mind too much about whether you turned something left or right according to trigonometry (unless you do care, and that's fine too). If you get the answers, but they're 180 or 360 degrees off, consider the task complete and move on, I'd say. Once you're actually using this for something in a 3D game or such, you may want to adjust these things to fit your purpose.


Yeah, so that means this program is fine. Phew xD Thanks for your reply..


Well, yeah, as long as it's just an exercise in programming, rather than actually trying to perfect your trig skills. :)


#4952233 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:52 PM

There is one thing that I believe most people don't understand about C++, and it's hard to explain it. The easiest way to understand what C++ attempts to do is it you know the basic of Java. In Java, there is no "int main()" where the program starts, but instead you need to register a class that is the application itself. C++ wants to do this aswell, but because windows is written in C, not C++, it expects to call a function like "int main()" (which is actually WinMain() in windows, if I've understood that correctly).
So, by doing what I did in the code I supplied, I try to emulate this intended behaviour, by bypassing the "int main()" as seamlessly as possible. This allows you application to be a class also.

int main()
{
Application application;
return application.run();
}

...and application::run() will act the same way as "int main()", in the sense that it is the starting point of your program, and it returns the value that is also returned by "int main()" to the operating system.

I think that if Stroustrup had his way, C++ would've needed a "class Application" aswell (like Java does, which is truly OOP), but C++ does not run on a virtual machine like Java does.


#4952232 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:43 PM

Oh, do note that in the text file, I just put everything in there, which is not actually the way it should be.

Things should be split up in header files and source files. That can be a bit tricky to understand in the beginning aswell, because it's mostly a technical aspect for compiling, for example. But don't do like I did and just put it all in the main source file.

the part that says:

class Application {...}

should be in .h files, and included in your main.cpp file.

The parts that have the actual functions, such as..

int application::run()

...should be in source files. But you'll get a hang of that, it's not too complicated.


#4952230 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:32 PM




OK, let me start by saying this, very clearly: This is not C++. This is C. You should learn C++ instead. What book or reference are you using, which claims that this is C++? Throw it out the window, whether literal or virtual, and get a reference of C++ instead.

C++ is an object-oriented programming language. This means that you should look at things as real-world object, created from blueprints called classes (or structs). If you have a game with a slot-machine, then that slot machine is an object, I think you'd agree. (In fact, the game itself is an object, isn't it?) So what you need to do is to write a class called SlotMachine, and create an object from that class. And pulling the lever on a slot machine should be represented as a member function (or a "method", as it's called in some languages) of the SlotMachine class. So when you want to pull the lever, you write slotMachine.pullLever().

You have pretty much crammed everything into the main() function. That is not the C++ way, but the C way.

I'd love to re-write it all in C++ for you, but... well, I think you should do it, frankly. Otherwise you'd not be learning, I think.

EDIT:

Oh, don't get me wrong, I'll help you if you need it, and I'm sure others here will aswell. Just try some on your own, with a decent C++ reference in your back, and if you run into problems, we're here.
Just... start over, and do it in C++.


I think you are confused...
He uses an object of class osteam called "cout" instead of "printf".

Ok, let me say this clearly this is not C. This is C++
You can create a new file, and call it "main.c". Then copy the code above, and compile it... What do you get? A lot of errors!!
C can not use objects, and iostream isn't a C library!


You're going to start being snide? Can we not do that, please?

Ask mr Stroustroup (spelling?) if this is how C++ was designed to look. Yes, he may use one of C++'s objects, but if he still codes his programs as if it was C, then he gains no benefits of C++'s improvements. That is not something I should have to argue about.


You are wrong again...
The OOP is just one of the paradigms. C++ is multi-paradigm.
Look here: http://en.wikipedia....amming_language
So, C++ can be structured like C.
OOP is not the only improvement.

You said the code ISN'T C++ and IS C...
So go and make a main.c file, copy the code, and compile it...


If you want to be picky, OK, you win. Technically, what I said was wrong, because it won't compile as C.

Now, listen to this: and see my point.


#4952229 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:29 PM




OK, let me start by saying this, very clearly: This is not C++. This is C. You should learn C++ instead. What book or reference are you using, which claims that this is C++? Throw it out the window, whether literal or virtual, and get a reference of C++ instead.

C++ is an object-oriented programming language. This means that you should look at things as real-world object, created from blueprints called classes (or structs). If you have a game with a slot-machine, then that slot machine is an object, I think you'd agree. (In fact, the game itself is an object, isn't it?) So what you need to do is to write a class called SlotMachine, and create an object from that class. And pulling the lever on a slot machine should be represented as a member function (or a "method", as it's called in some languages) of the SlotMachine class. So when you want to pull the lever, you write slotMachine.pullLever().

You have pretty much crammed everything into the main() function. That is not the C++ way, but the C way.

I'd love to re-write it all in C++ for you, but... well, I think you should do it, frankly. Otherwise you'd not be learning, I think.

EDIT:

Oh, don't get me wrong, I'll help you if you need it, and I'm sure others here will aswell. Just try some on your own, with a decent C++ reference in your back, and if you run into problems, we're here.
Just... start over, and do it in C++.


Sorry I've no clue what your talking about. Seems its advanced stuff.


I don't know about "advanced", it's what C++ was created for. It's pretty much the whole point of it, as an improvement upon C. If you want to learn C++, you need to start right away. If you want to use C instead, then that's a choice you need to make, but you need to be aware of the difference. I don't know if all these other guys thinks I'm just messing with you or something, but I think that once you look at the code example I attached to my other post, you'll understand that C++ is slightly different from C. Hopefully you other guys would care to listen to me and see the truth in what I'm saying instead of jsut downvoting me as if I was trolling. I, for one, am trying to teach a newbie the proper way to code, and good practices. I don't know what the rest of you are trying to do.


Your code works amazingly well Posted Image Actually I'm learning C++ as my first programming language. So I called your stuff advanced. I'm an altogether beginner programmer. I'm saving your code buddy. When I jump into these topics, I'll understand your code and would be able to admire it much more.


Hey, thanks a bunch, that warms the old heart. :)

See, C++ is an inherently "advanced" language, so you've got a lot on your plate. But I don't think it's right to try to dumb it down. I've walked this road myself, and I'd have loved someone to steer me in the right direction and save me some time trying to re-adjust later.

Take my code and improve it! It still lacks some stuff that would make the program more complete. And anything you don't understand about it, don't just skip it, ask and/or learn it instead.


#4952227 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:24 PM



OK, let me start by saying this, very clearly: This is not C++. This is C. You should learn C++ instead. What book or reference are you using, which claims that this is C++? Throw it out the window, whether literal or virtual, and get a reference of C++ instead.

C++ is an object-oriented programming language. This means that you should look at things as real-world object, created from blueprints called classes (or structs). If you have a game with a slot-machine, then that slot machine is an object, I think you'd agree. (In fact, the game itself is an object, isn't it?) So what you need to do is to write a class called SlotMachine, and create an object from that class. And pulling the lever on a slot machine should be represented as a member function (or a "method", as it's called in some languages) of the SlotMachine class. So when you want to pull the lever, you write slotMachine.pullLever().

You have pretty much crammed everything into the main() function. That is not the C++ way, but the C way.

I'd love to re-write it all in C++ for you, but... well, I think you should do it, frankly. Otherwise you'd not be learning, I think.

EDIT:

Oh, don't get me wrong, I'll help you if you need it, and I'm sure others here will aswell. Just try some on your own, with a decent C++ reference in your back, and if you run into problems, we're here.
Just... start over, and do it in C++.


I think you are confused...
He uses an object of class osteam called "cout" instead of "printf".

Ok, let me say this clearly this is not C. This is C++
You can create a new file, and call it "main.c". Then copy the code above, and compile it... What do you get? A lot of errors!!
C can not use objects, and iostream isn't a C library!

Yes I think for something like this objects are just going to seem needlessly complicated really. Any time you're only making one instance of an object you're really just using it for categorization


Ye, that is absolutely true, from the viewpoint of scale. But if a beginner never uses classes, he won't learn the proper ways, and to think in OOP takes experience which you should try to garnish from the start.
I mean, most C++ programmers are still not taking full advantage of C++, but still mixes in C. That goes up to professional level, even. And that's an issue.


#4952225 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:20 PM


OK, got downvoted because I'm trying to help? I dunno what's up with people, but OK, he wanted the code fixed for him, so here's a quick (!) example of how it could look, in C++.


EDIT:

OK, so it can only show 26 lines of code? That seems weird.

Can't get the code tag working, so I jus attached a txt file of it instead.



The people downvoted you because the code above is written in C++...
He wrote a C++ code but without implementing the object oriented programming paradigm style. But is C++
The OOP is only a paradigm not the complete language


I dunno, really... you mean it's C++ because the file is called .cpp, and because he uses std::cout? I would say the lack of OOP is a stronger argument than that, since that was the whole point of C++. The creator himself explains that very clearly. He wanted to merge OOP with the performance of C.


#4952224 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:17 PM


OK, let me start by saying this, very clearly: This is not C++. This is C. You should learn C++ instead. What book or reference are you using, which claims that this is C++? Throw it out the window, whether literal or virtual, and get a reference of C++ instead.

C++ is an object-oriented programming language. This means that you should look at things as real-world object, created from blueprints called classes (or structs). If you have a game with a slot-machine, then that slot machine is an object, I think you'd agree. (In fact, the game itself is an object, isn't it?) So what you need to do is to write a class called SlotMachine, and create an object from that class. And pulling the lever on a slot machine should be represented as a member function (or a "method", as it's called in some languages) of the SlotMachine class. So when you want to pull the lever, you write slotMachine.pullLever().

You have pretty much crammed everything into the main() function. That is not the C++ way, but the C way.

I'd love to re-write it all in C++ for you, but... well, I think you should do it, frankly. Otherwise you'd not be learning, I think.

EDIT:

Oh, don't get me wrong, I'll help you if you need it, and I'm sure others here will aswell. Just try some on your own, with a decent C++ reference in your back, and if you run into problems, we're here.
Just... start over, and do it in C++.


I think you are confused...
He uses an object of class osteam called "cout" instead of "printf".

Ok, let me say this clearly this is not C. This is C++
You can create a new file, and call it "main.c". Then copy the code above, and compile it... What do you get? A lot of errors!!
C can not use objects, and iostream isn't a C library!


You're going to start being snide? Can we not do that, please?

Ask mr Stroustroup (spelling?) if this is how C++ was designed to look. Yes, he may use one of C++'s objects, but if he still codes his programs as if it was C, then he gains no benefits of C++'s improvements. That is not something I should have to argue about.


#4952223 Please simplify my code.

Posted by antiHUMANDesigns on 23 June 2012 - 10:12 PM


OK, let me start by saying this, very clearly: This is not C++. This is C. You should learn C++ instead. What book or reference are you using, which claims that this is C++? Throw it out the window, whether literal or virtual, and get a reference of C++ instead.

C++ is an object-oriented programming language. This means that you should look at things as real-world object, created from blueprints called classes (or structs). If you have a game with a slot-machine, then that slot machine is an object, I think you'd agree. (In fact, the game itself is an object, isn't it?) So what you need to do is to write a class called SlotMachine, and create an object from that class. And pulling the lever on a slot machine should be represented as a member function (or a "method", as it's called in some languages) of the SlotMachine class. So when you want to pull the lever, you write slotMachine.pullLever().

You have pretty much crammed everything into the main() function. That is not the C++ way, but the C way.

I'd love to re-write it all in C++ for you, but... well, I think you should do it, frankly. Otherwise you'd not be learning, I think.

EDIT:

Oh, don't get me wrong, I'll help you if you need it, and I'm sure others here will aswell. Just try some on your own, with a decent C++ reference in your back, and if you run into problems, we're here.
Just... start over, and do it in C++.


Sorry I've no clue what your talking about. Seems its advanced stuff.


I don't know about "advanced", it's what C++ was created for. It's pretty much the whole point of it, as an improvement upon C. If you want to learn C++, you need to start right away. If you want to use C instead, then that's a choice you need to make, but you need to be aware of the difference. I don't know if all these other guys thinks I'm just messing with you or something, but I think that once you look at the code example I attached to my other post, you'll understand that C++ is slightly different from C. Hopefully you other guys would care to listen to me and see the truth in what I'm saying instead of jsut downvoting me as if I was trolling. I, for one, am trying to teach a newbie the proper way to code, and good practices. I don't know what the rest of you are trying to do.




PARTNERS