www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Beginning with D

reply Prestidigitator <littlephoenix7 yahoo.com> writes:
Is D as good at game programming as C++? Also, would it be better to use 1.0 or
2.0?
Feb 25 2009
next sibling parent reply Daniel Keep <daniel.keep.lists gmail.com> writes:
Prestidigitator wrote:
 Is D as good at game programming as C++? Also, would it be better to use 1.0
or 2.0?

D is a good language, and there are people writing games with it; just look at Deadlock [1] or Mayhem Intergalactic [2] (the latter of which is on sale right now!). As for the D 1.0/2.0 thing, use 1.0. 2.0 isn't stable yet, and could change radically at any moment. Plus, there's very little library support for 2.0. Anyway, just me AU$0.02. -- Daniel [1] http://deadlock.team0xf.com/ [2] http://www.inventivedingo.com/mayhemig
Feb 25 2009
parent "Nick Sabalausky" <a a.a> writes:
"Daniel Keep" <daniel.keep.lists gmail.com> wrote in message 
news:go520b$1o5f$1 digitalmars.com...
 Prestidigitator wrote:
 Is D as good at game programming as C++? Also, would it be better to use 
 1.0 or 2.0?

D is a good language, and there are people writing games with it; just look at Deadlock [1] or Mayhem Intergalactic [2] (the latter of which is on sale right now!).

Also, Torus Trooper, Tumiki Fighters and probably a few of the other games by Kenta Cho/ABA Games were written in an early version of D (with Tumiki Fighters being the original version of Blast Works). http://www.asahi-net.or.jp/~cs8k-cyu/index_e.html A large part of my programming background has centered on games, and I'd say that, for the most part, D is vastly better than C/C++ for games (In fact, that's what originally drew me to D in the first place). The one drawback though is that D support for consoles and other embedded systems is practically non-existent right now (but hopefully LDC will change that). Also, the vast majority of game middle-ware is still C/C++, so D bindings would have to be created to use them. That could be either easy or difficult depending on the actual lib. Also, be wary of people on places like gamedev.net that try to immediately dismiss D. I've read a lot of their stuff and most of the time they demonstrate very clearly that they don't actually know anything about D, and they'll often get their facts about D comepletely wrong, or outdated, etc. Games have been C/C++ for a very long time, and have stayed that way (for very good reason) even while most software has switched to other newer/trendier languages, so it's very difficult for most of them to accept the idea that there might actually be something better.
Feb 25 2009
prev sibling parent reply Rainer Deyke <rainerd eldwood.com> writes:
Prestidigitator wrote:
 Is D as good at game programming as C++? Also, would it be better to
 use 1.0 or 2.0?

My opinion: D 1.0 is, on the whole, worse than C++. D 2.0 is shaping up to be, on the whole, better than C++. However, D 2.0 is unstable to the point of being unusable at the moment. Stick to C++ for now, but come back in a year or two when D 2.0 has had time to stabilize. -- Rainer Deyke - rainerd eldwood.com
Feb 25 2009
next sibling parent reply Bill Baxter <wbaxter gmail.com> writes:
On Thu, Feb 26, 2009 at 2:25 PM, Rainer Deyke <rainerd eldwood.com> wrote:
 Prestidigitator wrote:
 Is D as good at game programming as C++? Also, would it be better to
 use 1.0 or 2.0?

My opinion: D 1.0 is, on the whole, worse than C++. =A0D 2.0 is shaping u=

 =A0to be, on the whole, better than C++. =A0However, D 2.0 is unstable to
 the point of being unusable at the moment. =A0Stick to C++ for now, but
 come back in a year or two when D 2.0 has had time to stabilize.

It really depends entirely on what you value in the language you use. So just stating that D is worse or better than C++ without your reasons for having reached that conclusion is really next to useless information. If a strong toolchain is important to you, D loses to C++. If the ability to use some large existing C++ framework is important to you, D loses to C++. If having a language that's enjoyable to use with good performance is important to you, then D wins over C++. And so on... There are many categories in which D is behind C++, but as far as the core language goes, I would choose to use D1.0 over C++ any day. --bb
Feb 25 2009
parent reply Rainer Deyke <rainerd eldwood.com> writes:
Bill Baxter wrote:
 There are many categories in which D is behind C++, but as far as the
 core language goes, I would choose to use D1.0 over C++ any day.

I would not. To this C++ programmer, using D 1.0 feels like stepping back from C++ to C in terms of resource management. I never considered any factors other than the core language in the first place. -- Rainer Deyke - rainerd eldwood.com
Feb 25 2009
parent reply grauzone <none example.net> writes:
Rainer Deyke wrote:
 Bill Baxter wrote:
 There are many categories in which D is behind C++, but as far as the
 core language goes, I would choose to use D1.0 over C++ any day.

I would not. To this C++ programmer, using D 1.0 feels like stepping back from C++ to C in terms of resource management.

Going back from D to C++ also feels like stepping back, because C++ doesn't natively support garbage collection. While I admit that reference counting is better for "heavy" resources (like file handles), for small memory objects tracing garbage collection is actually more efficient and less problematic. For example, reference counting can't deal with cycles of garbage. And what's so great about wrapping every pointer into a smartpointer? What do C++ programmers think about the D2.0 support for stuff like reference counting? (See http://www.digitalmars.com/d/2.0/struct.html#StructPostblit)
 I never considered any factors other than the core language in the first
 place.

Feb 26 2009
parent Rainer Deyke <rainerd eldwood.com> writes:
grauzone wrote:
 Going back from D to C++ also feels like stepping back, because C++
 doesn't natively support garbage collection. While I admit that
 reference counting is better for "heavy" resources (like file handles),
 for small memory objects tracing garbage collection is actually more
 efficient and less problematic. For example, reference counting can't
 deal with cycles of garbage.

Between cycle-breaking and support for "heavy" resources, I'd take the latter over the former any day. IME heavy resources are very common, and cycles are relatively rare. This is especially true for game programming. I have many options for handling cycles in C++. I have no reasonable options for handling heavy resource in D1.
 And what's so great about wrapping every pointer into a smartpointer?

Consistent syntax? Having a choice of smart pointers? Honestly, I can't see a way to avoid smart pointers even in D2. A language like Python may not need them, but then Python has reference counting and destructors that actually work in addition to garbage collection. And weak references. -- Rainer Deyke - rainerd eldwood.com
Feb 26 2009
prev sibling next sibling parent Bill Baxter <wbaxter gmail.com> writes:
On Thu, Feb 26, 2009 at 3:17 PM, Rainer Deyke <rainerd eldwood.com> wrote:
 Bill Baxter wrote:
 There are many categories in which D is behind C++, but as far as the
 core language goes, I would choose to use D1.0 over C++ any day.

I would not. =A0To this C++ programmer, using D 1.0 feels like stepping back from C++ to C in terms of resource management.

Ok. Now that's actually useful information. Resource management. That's fair. It is difficult to do things like ref-counted pointers in D1. If I weren't satisfied using the built-in garbage collection for just about everything, I would probably find D a lot less attractive. --bb
Feb 25 2009
prev sibling next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Rainer Deyke:
 My opinion: D 1.0 is, on the whole, worse than C++.

There are many things in D1 better than C++, in particular you need less time learn the language and less time to write programs that work correctly. Bye, bearophile
Feb 26 2009
parent reply Lutger <lutger.blijdestijn gmail.com> writes:
Tim M wrote:

 On Fri, 27 Feb 2009 01:42:17 +1300, bearophile <bearophileHUGS lycos.com>  
 wrote:
 
 Rainer Deyke:
 My opinion: D 1.0 is, on the whole, worse than C++.

There are many things in D1 better than C++, in particular you need less time learn the language and less time to write programs that work correctly. Bye, bearophile

I think the key here is "on the whole" and in opinion. I'm not really interested in D vs C++ one sided arguments but apart from the constness in D2 what other features does C++ have over D?

The most prominent feature is value semantics for classes and better support for RAII style resource management compared to D1. Furthermore C++ allows you much more flexibility when it comes to operator overloading, but if that is a good thing is up for debate. And finally in C++ we have the preprocessor of course... Other than that, I can't think of anything in the language itself. If you could argue that STL is part of the C++ language, than that counts too. I don't see MI as a feature of C++ above D1, because everything you can reasonably do with MI can be done in D1 with interfaces and mixins.
Feb 26 2009
parent reply Jason House <jason.james.house gmail.com> writes:
Lutger Wrote:

 Tim M wrote:
 
 On Fri, 27 Feb 2009 01:42:17 +1300, bearophile <bearophileHUGS lycos.com>  
 wrote:
 
 Rainer Deyke:
 My opinion: D 1.0 is, on the whole, worse than C++.

There are many things in D1 better than C++, in particular you need less time learn the language and less time to write programs that work correctly. Bye, bearophile

I think the key here is "on the whole" and in opinion. I'm not really interested in D vs C++ one sided arguments but apart from the constness in D2 what other features does C++ have over D?

The most prominent feature is value semantics for classes

I don't agree with this one. Classes and structs are identical in C++ (except for default protection). In D, they differ. For value semantics, use structs in D.
 and better support 
 for RAII style resource management compared to D1. Furthermore C++ allows 
 you much more flexibility when it comes to operator overloading, but if that 
 is a good thing is up for debate. And finally in C++ we have the 
 preprocessor of course...
 
 Other than that, I can't think of anything in the language itself. If you 
 could argue that STL is part of the C++ language, than that counts too.
 
 I don't see MI as a feature of C++ above D1, because everything you can 
 reasonably do with MI can be done in D1 with interfaces and mixins. 
 
 

Feb 26 2009
parent Lutger <lutger.blijdestijn gmail.com> writes:
Jason House wrote:

 Lutger Wrote:
 
 Tim M wrote:


 D2 what other features does C++ have over D?

The most prominent feature is value semantics for classes

I don't agree with this one. Classes and structs are identical in C++

structs in D. I didn't mean to say this is a better design in C++, just that it's different. I probably misunderstood the question, it wasn't meant as a value judgement at all. In fact all the features I mentioned I think are for the worse, not better. Except raii perhaps, although I don't think this is so important when you have GC and scope().
Feb 26 2009
prev sibling parent "Tim M" <a b.com> writes:
On Fri, 27 Feb 2009 01:42:17 +1300, bearophile <bearophileHUGS lycos.com>  
wrote:

 Rainer Deyke:
 My opinion: D 1.0 is, on the whole, worse than C++.

There are many things in D1 better than C++, in particular you need less time learn the language and less time to write programs that work correctly. Bye, bearophile

I think the key here is "on the whole" and in opinion. I'm not really interested in D vs C++ one sided arguments but apart from the constness in D2 what other features does C++ have over D?
Feb 26 2009