Java or C++

D6f91e3dd7f5be7268f0fb5928056f73
0
MMO 101 Sep 26, 2009 at 12:39

Hello, I’ve had lots of game programming experence with the blitz and other languages. Now I’m considering to learn C++ or Java; I know that these languages are not for a beginner programmers so thats why I’m glad to took the time with blitz! I have a few questions about these languages and which one to choose from… I know that both languages are very powerful for games. Do any of these languages have directx 10 or 9 support?(I need some directx 10 support becouse blitz only has dx7 support)

39 Replies

Please log in or register to post a reply.

8563f7b73aeb34bb8604f1dd8f546c88
0
Mattias_Gustavsson 101 Sep 26, 2009 at 13:49

It depends a bit on what your goal is. If you want to work in the games industry, you need to know C++, and you need to know DirectX (not OpenGL).

If you’re learning just to make your own little games, then Java is as good a choice as C++. There’s differences of course, but you’ll be able to make games with both. If you’re interested in DirectX 10 support though, I’d say C++ is the better choice, as DirectX is configured for C++ use out-of-the-box, while on Java you probably (?) need some sort of wrapper…

D6f91e3dd7f5be7268f0fb5928056f73
0
MMO 101 Sep 26, 2009 at 15:31

@Mattias Gustavsson

It depends a bit on what your goal is. If you want to work in the games industry, you need to know C++, and you need to know DirectX (not OpenGL). If you’re learning just to make your own little games, then Java is as good a choice as C++. There’s differences of course, but you’ll be able to make games with both. If you’re interested in DirectX 10 support though, I’d say C++ is the better choice, as DirectX is configured for C++ use out-of-the-box, while on Java you probably (?) need some sort of wrapper…

Well I guess i should go with c++ then. Since that c++ supports directx 10 the graphics wont come out fuzzy like in the blitz3d. Also when I start learning c++ do you think I should start with 2d or 3d?(I have experience with both 2d and 3d)

8563f7b73aeb34bb8604f1dd8f546c88
0
Mattias_Gustavsson 101 Sep 26, 2009 at 16:11

@MMO

Since that c++ supports directx 10 the graphics wont come out fuzzy like in the blitz3d

Hmm, I don’t understand what you mean here… if you use 2d-sprites and linear interpolation, things will look just as blurred in DirectX10 as in DirectX7… If you use 3D objects, it will look just as sharp in both DirectX7 as it will in DirectX10.

Perhaps it will be easier for us to advise you if you describe what type of game you’re making, and what the reasons are that you feel that Blitz might be inadequate…

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 27, 2009 at 03:34

If you have experience in 3d, then you can probably just stick with 3d. As far as language, the choice is really if you want to use a scripted language, and there are quite a few, or use c++. The reasons for using a scripted language are that you won’t be hunting down memory errors and you can edit the game and run it rather than re-compiling every time you make changes. You were already using scripting when you were using Blitz3d. It doesn’t take long to learn another scripting language if it’s different. The reason for using later versions of Directx or Opengl is for better shadowing and shaders mostly, and also speed. If you are a hobbyist, it’s going to be a lot faster using one of the engines and probably a scripted language to develop your game. Using c++ with an engine like Ogre or Irrlicht or something isn’t bad either because most of the memory management is taken care of, you just make a few calls. There are a few complete engines written in Java which are pretty nice, but there will be a slight speed hit since it’s not as fast as c++. There are also some engines using c# which eliminates memory management and has a lot of extra libraries. Personally, I would look at engines first and find one that did what you wanted and then think about the language after. When you do learn a language, however, you should study it without the engine first. On the other hand, if you want to get into the game industry, you should probably study c++ and possibly directX like Matt said. You could also look at XNA, I think they call it, after learning c++ or any of the engines that use c++. XNA can also use c# which is a lot like java but it has a very large developer community and it can be used to possibly sell your game. It’s pretty tough to actually write a game in 3d by yourself without an engine or higher library than directX. When you say you have experience in 2d and 3d, hopefully this means you have written complete games with menus, levels, etc. If you haven’t done that, it would probably be better to use 2d.

8563f7b73aeb34bb8604f1dd8f546c88
0
Mattias_Gustavsson 101 Sep 27, 2009 at 06:56

@fireside

you can edit the game and run it rather than re-compiling every time you make changes.

There’s also Edit-and-continue in visual studio: set a breakpoint, make your changes, resume execution. Works a treat most of the time. I don’t think using a scripting language is useful for the lone dev/hobbyist.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Sep 27, 2009 at 10:56

Java kinda has advantages of its own, if you want really neat applets that can play straight out of a web page, wasnt that what java was invented for? Cause c++ cant do what java can do in that respect.

I see your name is “MMO” and maybe in the near to far future youd like to have a networked game for people to connect to :) (i am not concerned, if its just a dream of yours to have, at least you sound like you honestly want to do a bit of work yourself.), im quite sure java has in it the networking stuff you need. But of course c++ has it too.

You could write a mini mmo with both.

Java is technically a little less of a performer than c, but if you cut the game down in a few areas, im pretty sure java can impress.

If you were writing in java, youd be using their 3d library, which is not direct x, but its still quite impressive…

7769a20efe5b89925498160b24b76c05
0
Hertta 101 Sep 27, 2009 at 13:01

It does not matter which language you use. What matters is HOW you use it.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 27, 2009 at 13:22

I don’t think using a scripting language is useful for the lone dev/hobbyist.

There isn’t a big advantage. A lot of engines compile to a dll so it’s very much like a scripted engine except you can go back and recompile the dll with your own changes. Still, it’s easy to make memory errors with c++ and time gets wasted finding the errors which isn’t necessary with a scripted language. C++ has a longer learning curve because of the memory issue and pointers so it takes more time to get started making a game, so I would argue the point. A lone developer needs to worry about art work and game design, so it’s a very large agenda already. It’s going to mostly boil down to personal preference. People who are more technical will choose c++ and generally have a lot more problem doing art work. People who are a little more artistic will generally choose a script language. If you take a look at the more productive engines like Unity, Torque, and many others, you can see that a lot of people are doing better with a scripted engine. It would be interesting to get XNA statistics, but I would be willing to bet that the majority of lone developers and hobbyists are using c#. Memory issues are a pain in the neck and if you aren’t in that type of mind frame, it’s better to avoid the issue by using a memory managed language. Most of the engines are written in c, so the speed difference is minimal for the amount of script used.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Sep 27, 2009 at 13:59

Honestly, I think the whole “memory errors in C++” thing is really over-exaggerated. You rarely need to use pointers in C++ and when you do, for 99% of those cases the STL auto_ptr and Boost’s shared_ptr handle everything for you.

I do agree with the longer learning curve though. It takes a very, very long time before you can start using C++ well.

8563f7b73aeb34bb8604f1dd8f546c88
0
Mattias_Gustavsson 101 Sep 27, 2009 at 14:53

also, the built-in CrtDebug stuff makes it dead easy to stay on top of memory leaks even without smartpointers

B7dcbc0c0f07253f25ff5c25fe38c081
0
SamuraiCrow 101 Sep 28, 2009 at 00:19

@Mattias Gustavsson

It depends a bit on what your goal is. If you want to work in the games industry, you need to know C++, and you need to know DirectX (not OpenGL).

The Mac users on this forum burn with wrath as they look in your general direction. :dry:

8563f7b73aeb34bb8604f1dd8f546c88
0
Mattias_Gustavsson 101 Sep 28, 2009 at 08:55

Well, I’m not knocking Mac, or OpenGL. It’s just that games companies ask for people who know DirectX, so it wouldn’t make sense to tell someone who wants to get into the industry to focus on OpenGL, even though it would work just fine to make games with.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Sep 28, 2009 at 10:09

@Mattias Gustavsson

Well, I’m not knocking Mac, or OpenGL. It’s just that games companies ask for people who know DirectX, so it wouldn’t make sense to tell someone who wants to get into the industry to focus on OpenGL, even though it would work just fine to make games with.

Well, the PS3 and many (most?) mobile devices use OpenGL, so I don’t think it’s all about DirectX anymore.

In any case, it’s not like someone who knows one is going to have a really hard time learning the other. I think employers would be mainly just looking for someone who can make stuff - their API of choice is really a secondary consideration.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Sep 30, 2009 at 02:34

I have been building stuff with my own higher level graphics API so I can support both OpenGL and DirectX. I’m sure I’ll need to update it in the future when newer versions of DirectX come out but at least I’ll have a good starting point.

As for C++ vs Java, I’ve never been enamored with byte code/JIT languages for stuff that needs to run fast, so I tend to stick to C++. Also my personal experience with Java has been sub-optimal but I’ll have to admit I haven’t tried it in a few years.

Also I’m a bit confused by the entire programming language fear factor that seems to go around these days. At some point in the not so distant past you rarely heard talk of language X being too complex for someone. If you needed to program in X you got a book, took a class etc. Now I sometimes get yelled at for recommending C++ to someone because It’s “too hard” for them. My opinion is if Java, C#, Visual Basic or some scripting language makes sense in a given case use them, but don’t be afraid of C++ or any other language. There is no computer language that should scare anyone.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Sep 30, 2009 at 03:52

I don’t know…APL scares me a lot. ;)

In all seriousness, though: while C++ certainly can be learned by anyone with a modicum of programming experience, I think the general consensus is that C++ is not the best choice for a first language. We usually recommend Python or some such as a first language, because when you’re just getting familiar with how computer languages work and learning to think like a programmer, it’s a lot less confusing and frustrating if you don’t have to worry about memory management, the funny ways C/C++ treat strings and arrays, the idiosyncrasies and gotchas of the standard library and STL, and so on. I think possibly the disapproval of C++ as a first language may be what you are encountering when people say it’s too hard for someone.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 30, 2009 at 19:41

Languages keep moving to simpler models as computers get faster. I can use c++, and I have for a few almost games I’ve done with it, but I don’t particularly like it and I wouldn’t use it unless I felt it was necessary, which it really isn’t for anything I plan to do anymore. It used to be you couldn’t write any kind of serious game except in c++, but that is kind of changing. I think it can sometimes be a hindrance for some people because they insist on using DirectX or Opengl rather than a higher library and they end up basically re-inventing the wheel to write games. You could kind of do that in the old days but now with physics libraries, etc, everyone is dependent on using higher libraries or writing extremely simple games. As far as I’m concerned, if I don’t have to bother with memory management, that’s one less chore I have to do. C++ really has become a low level tool. If someone enjoys that kind of thing, that’s great, but it doesn’t have much to do with game design or graphics design or much of anything, really. If you want to do it professionally, it’s a necessity. If you’re a hobbyist or indy, it isn’t. If you don’t think it’s harder, you probably haven’t used higher languages much. Most of the exploits done for viruses, etc, are done with c or c++ code because it’s easy to screw it up. Most game crashes will be because of an inexperienced c or c++ coder. I think Ogre is a cool engine, but one of the complaints about it is that the games that are written with it crash a lot. I personally doubt that has anything to do with the engine but the c++ coders that used it to write the game. Play some Unity games and you will find them to be solid and written by much less competent coders.

7769a20efe5b89925498160b24b76c05
0
Hertta 101 Sep 30, 2009 at 21:11

Thats it. C or C++ does not hold your hand. It does not care what you try to do with it. For example, it does not stop you from trying to access data which is out of scope. It tries, and it fails. Your fault.

With great power comes the great responsibility.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Sep 30, 2009 at 22:41

@Mattias Gustavsson

Well, I’m not knocking Mac, or OpenGL. It’s just that games companies ask for people who know DirectX, so it wouldn’t make sense to tell someone who wants to get into the industry to focus on OpenGL, even though it would work just fine to make games with.

What serious game company asks it’s applicants for DirectX knowledge? Sure, if you’re interested in a graphics programmer on PC, then DirectX is a plus. But otherwise I don’t think I’ve ever seen that as a requirement.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Sep 30, 2009 at 22:50

@fireside

Most game crashes will be because of an inexperienced c or c++ coder.

I’m sorry, but this is just plain bullshit. Java and .Net allow you to make the exact same mistakes as C++ does. The only difference is that in C++ everything blows up (if you’re lucky), while .Net and Java throw an exception. It’s not that if you’re using a managed language, you can no longer dereference a null pointer, access an array beyond it’s bounds, or leak memory. The programming errors are exactly the same, and the result is exactly the same: a crashing game.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Sep 30, 2009 at 23:04

The only difference is that in C++ everything blows up (if you’re lucky), while .Net and Java throw an exception.

Yeah, but that’s a pretty big difference. In other words, one tells you something is wrong, one lets you believe everything is hunky dory until the lights go out. Those exceptions are errors that have to be fixed before you can resume programming. Leaking memory is generally caused because resources weren’t cleaned up. Since it’s automatic in c# or java, that’s going to happen a lot less. I’m a low quality c++ programmer so I have first hand knowledge in this. It’s fine to push it for people wanting to go into the trade, but for amateurs or indies, it really doesn’t make sense. There’s just too much for one person to do and languages like java or c# are pretty fast so there isn’t going to be much of a difference. These arguments are obviously in error or you wouldn’t see this explosive growth in programmers for managed languages.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Sep 30, 2009 at 23:54

@fireside

Languages keep moving to simpler models as computers get faster. I can use c++, and I have for a few almost games I’ve done with it, but I don’t particularly like it and I wouldn’t use it unless I felt it was necessary, which it really isn’t for anything I plan to do anymore.

Well that may be the case for you however I’m pushing the speed limit as it is. I certainly wouldn’t call myself a C++ fanboy but I end up being one by default. There is really no other solution for me. Most newer languages (at least the ones with any kind of popularity) seem to take the byte-code/Jit approach. I’m not sure why someone doesn’t try to come up with a more modern compiled and optimized language, but so far C++ is it. Coding in something like C# would give my software extremely poor performance and basically make my project untenable. I’m sure that’s why many large corporate projects are still written in C++. There is simply no other viable option.
@fireside

If you want to do it professionally, it’s a necessity. If you’re a hobbyist or indy, it isn’t.

I’m indy and it’s very much a necessity for me. In my view the language choice is driven by the problem being solved not a label given the developer.
@fireside

If you don’t think it’s harder, you probably haven’t used higher languages much.

I’ve been programming in C++ for a lot of years and have a fairly large personal library at my disposal. There is also the standard library available to everyone. However, I do still consider some newer languages easier to program in but not enough so as to offset the performance penalty, loss of flexibility and loss of industry resources.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Oct 01, 2009 at 00:05

@SyntaxError

I’m not sure why someone doesn’t try to come up with a more modern compiled and optimized language, but so far C++ is it.

You may be interested in checking out the D programming language - it’s supposed to be a modernized, garbage-collected C++, but still compiles to native code. Last I checked, the compiler was fairly buggy and the language design was in a lot of flux (at least the 2.0 fork), making it tough to use for serious development, but that was a couple years ago and it’s likely things have improved since then.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Oct 01, 2009 at 00:21

@Reedbeta

You may be interested in checking out the D programming language

I have heard about it and maybe at some point this will be the way to go. As it stands it doesn’t have enough critical mass to make it worth the effort. But your are correct in that it’s something to keep an eye on.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Oct 01, 2009 at 01:08

I’m indy and it’s very much a necessity for me. In my view the language choice is driven by the problem being solved not a label given the developer.

That’s definitely true, but not the case for most indies and amateurs. One person can only do so much art, so large world games, about the only place that could happen, aren’t made that much. Usually it’s more symbolic art where the game play is different enough to set it apart or smaller worlds. I would like to see some speed tests done between c# and c++, really. I think there are certain cases with JIT compilers that they can actually be as fast as c++. Also, like you said you had quite a few years of experience in c++. An indy writing a game usually needs to learn artistic software so doesn’t generally have those extra years.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Oct 01, 2009 at 01:41

@fireside

I would like to see some speed tests done between c# and c++, really. I think there are certain cases with JIT compilers that they can actually be as fast as c++.

You know I’ve done it enough times already but I always get arguments even after I post results. Now I make someone else pick the algorithm. The best I ever get is about 2.5X slower for C# and more often I’ve gotten a lot worse. If I take over memory allocation in C++ (which I almost always do for real projects) C# looks even slower by comparison.

If you want to, write a simple C# program and post it. Make it something that doesn’t use I/O so we are testing raw speed. Something simple: bubble sort, some memory allocation test, whatever you like. I’ll code it in C++. I’m not saying you are wrong about the C# JIT compiler being as fast as C++ but I have yet to find the case where it is. In addition, the times I have tried to write something real in C# it noticeably drags. Maybe it’s my fault. It’s just that I’ve gone through the song and dance so many times now and I’ve never found C# to be all that fast no matter what some people claims are. It has gotten somewhat better over the years though.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Oct 01, 2009 at 02:24

You know I’ve done it enough times already but I always get arguments even after I post results. Now I make someone else pick the algorithm. The best I ever get is about 2.5X slower for C# and more often I’ve gotten a lot worse. If I take over memory allocation in C++ (which I almost always do for real projects) C# looks even slower by comparison.

That would surprise me. However, if you use XNA, which is mainly written in c++, I think you would still find overall game speed to be very close. Off the wall estimates I have heard are 5% slower, but I’ve never seen a true comparison. It would also depend on type of game, etc. I’m not at all a Microsoft fanboy, but XNA seems like the best and most open platform for indy developers. Once you write a game, you still have to get it out there and that can be very hard. I also have only a little to do with c#. I’ve written a small game in java and a couple in assorted script languages. It’s just what I would probably choose right now if I were to do a 3d game.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Oct 01, 2009 at 03:08

@fireside

That would surprise me. However, if you use XNA, which is mainly written in c++, I think you would still find overall game speed to be very close. Off the wall estimates I have heard are 5% slower, but I’ve never seen a true comparison. It would also depend on type of game, etc. I’m not at all a Microsoft fanboy, but XNA seems like the best and most open platform for indy developers. Once you write a game, you still have to get it out there and that can be very hard.

I suppose it depends on what is in the game you are developing. I’m not familiar with XNA but I seriously doubt it implements even a fraction of what I personally need. So far I have implemented 2D and 3D Perlin and simplex noise and special versions of the 2D noise that work over the surface of a sphere. I have custom meshes that support LOD and hierarchy for collision detection. I also have taken great pains to handle numerical precision properly because my world is so large. I double buffer my geometry so I can do LOD in the background and still keep the frame rate high. Is XNA going to do any of this for me? Will it even allow me to do this? I’m not saying no one should use XNA but if you are trying to write a leading edge game it may or may not be the best option.

Also if XNA is truly a library written in C++ then I should be able to call it in C++ right? Or does MS insist that you use C# with XNA? Can I port an XNA program to apple? Can I port it to Linux?

In any case if you really want to do a somewhat fair comparison of language speeds, do some simple speed tests. Don’t take my word for it, do them yourself. I’ll be happy to be proven wrong. I can make a one line call in Lua to a giant piece C++ code. It may be very fast. But that says nothing on how fast Lua is as a general purpose programming language.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Oct 01, 2009 at 03:16

It sounds like you are doing something too specific to use a game engine, really. I wish you luck with it. XNA can be accessed with c++ and you can download the framework with visual c++ Xpress, I think. The only reason you might want to look at it is for distribution purposes or otherwise find out what Microsoft requires for that type of thing. I only breezed though a quick explanation of the whole thing, but it sounded like a very useful way to possibly market a game. You have to join some deal or other that costs a hundred dollars a year and you can compile for xbox or pc or even zune and market with their network, though that last wouldn’t apply in your case. Linux and Apple, no way.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Oct 01, 2009 at 03:16

@Reedbeta

You may be interested in checking out the D programming language - it’s supposed to be a modernized, garbage-collected C++, but still compiles to native code. Last I checked, the compiler was fairly buggy and the language design was in a lot of flux (at least the 2.0 fork), making it tough to use for serious development, but that was a couple years ago and it’s likely things have improved since then.

I’ve had a quick glance over at D. It looks like they’re on the right track, but it seems to me that they’re just piling up as many features as possible onto the language. It must have something like double the keywords of C++.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Oct 01, 2009 at 22:17

@fireside

Yeah, but that’s a pretty big difference.

No, it’s not.

Those exceptions are errors that have to be fixed before you can resume programming.

You have to trigger them in the first place. Which is just the same as with a non-managed language. The mere difference is in security, but you don’t care about security with games. It just needs to run free of errors. And whether you get crashes or runtime exceptions, both are errors, and both you don’t want in your game.

Most people think that when programming in a managed environment you can’t make errors. This is totally not true.

Leaking memory is generally caused because resources weren’t cleaned up. Since it’s automatic in c# or java, that’s going to happen a lot less.

No it is not. If you hold a pointer to an object somewhere, the garbage collector is not going to clean up your resources. Object lifetime is *still* something that needs to be considered in a managed environment. And the fact that people know there is a garbage collector cleaning up after them makes them think about object lifetime a whole lot less. People tend to think they can’t leak memory in Java or C#. Those people are just wrong ;)

By the way, for the record, I’m not saying that managed languages are not easier. I’m just saying that your arguments are bogus :)

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Oct 01, 2009 at 22:41

By the way, for the record, I’m not saying that managed languages are not easier. I’m just saying that your arguments are bogus

Interesting article. I think though, that managed languages have a lot more safeguards built into the system and they do stop errors that wouldn’t be found when using c++. Also, since there isn’t any delete for resources in java or c#, obviously this is being done automatically. It might not work once in a while, but mainly it’s pretty reliable. I’ve never seen an out of memory error with java and I’ve been on java sites and never seen it mentioned. People program these things relatively freely. It doesn’t mean you can’t make mistakes, but my own personal experience is that there are a lot less with a managed language and you find them sooner. I’ve programmed in both and I have a lot more crashes in c++ and they’re a lot more fatal. Sometimes bringing down the whole OS. Security is also important in games. A lot of it is the language itself. Like having a size property for an array, etc. Those things make better programmers. You can run around it all you want but managed languages are more stable and more secure unless you’re an uber c++ programmer.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Oct 02, 2009 at 05:08

I personally have much more memory management issues in C# compared to C++ simply because of the lack of RAII. I have to manually code in the equivalent of C++’s automatic destructor calls because GC finalizing is nondeterministic. IDisposable is not an adequate replacement.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Oct 02, 2009 at 06:41

Dont ever be afraid to say something you think is true.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Oct 02, 2009 at 12:07

I personally have much more memory management issues in C# compared to C++ simply because of the lack of RAII. I have to manually code in the equivalent of C++’s automatic destructor calls because GC finalizing is nondeterministic. IDisposable is not an adequate replacement.

Why would you use it that way? Why not just use c++? It’s like saying it’s a lot more work because you have to force it into behaving like c++. The only thing I’ve noticed with java and I read something in a c# comment that there is a forced frame rate with XNA when using c# of 60 fps. That allows a little pause for the GC I think. If you run it at highest frame rate there is a stutter when the GC works. I don’t know of any java developers that are doing something like that and I’ve played quite a few java games. I don’t think C#/XNA developers are doing that either. I really can’t say because I’m just looking at it now. If I have to do that, I won’t bother with it.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Oct 02, 2009 at 14:04

Why would you use it that way? Why not just use c++? It’s like saying it’s a lot more work because you have to force it into behaving like c++.

I’m not forcing it behave like C++, I’m forcing it behave in the way I need it to, and I just happens to be the case that C++ can handle that situation whilst C# cannot (easily).

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Oct 02, 2009 at 14:41

@fireside

Interesting article. I think though, that managed languages have a lot more safeguards built into the system and they do stop errors that wouldn’t be found when using c++.

Only when you’re using the raw low-level features of C++. The point is, you don’t have to use pointers or native arrays. If you just stick to classes like std::vector and std::tr1::shared_ptr, and never point to interiors of objects (as it is not possible in C# or Java either), it’s actually not much different from a managed language. Also, you can use raw pointers and corresponding arithmetic in C# and crash the application as well.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Oct 03, 2009 at 00:40

Only when you’re using the raw low-level features of C++. The point is, you don’t have to use pointers or native arrays. If you just stick to classes like std::vector and std::tr1::shared_ptr, and never point to interiors of objects (as it is not possible in C# or Java either), it’s actually not much different from a managed language. Also, you can use raw pointers and corresponding arithmetic in C# and crash the application as well.

I somewhat agree with you. One thing I never tried in c++ was shared ptr, which I’ll take a look at if c# doesn’t quite cut it. Whatever does the job the easiest is what I want. I also don’t really like the c++ language as much because I think it has a lot of inconsistencies. It didn’t start out as an OO language and it’s held onto a lot of old ways. What I care about is getting a game finished. If c# can do what I want I’ll use it because it seems better organized to me and more OO. If speed becomes a factor, I’ll use c++. I’ve just barely looked at a 2d game with XNA, but it looks pretty nice. I’ll take it one step at a time. Language is just a means to an end as far as I’m concerned.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Oct 03, 2009 at 04:42

I can agree with the language inconsistencies. Despite how much I love the language, C++ is a bit of a kludge. Too many conflicting ideas. D was a good idea, but too much bloat imo.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Oct 03, 2009 at 16:20

@fireside

Whatever does the job the easiest is what I want.

I totally agree on that one.

It didn’t start out as an OO language and it’s held onto a lot of old ways.

Well, it’s not trying to be an OO language in the first place. It’s a hybrid language, made out of procedural, OO and metaprogramming paradigms, and you can choose whatever fits your needs best. But yes, it’s a bit outdated. C++0x will fix a lot of issues (such as a threading library, a better memory model for multithreaded applications, lambda’s and closures, etc.). However, I still miss native reflection.