Jump to content
  • Advertisement
Sign in to follow this  
stefu

D for game programming anyone?

This topic is 4934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! Is anyone using D programming language for games programming? I am only asking because I looked at it for two days and I like it very much now. Maybe it gives little less performance in some cases but I love it because it code looks clean and it has carbage collection and compiletime is almost nothing.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by stefu
Is anyone using D programming language for games programming? I am only asking because I looked at it for two days and I like it very much now. Maybe it gives little less performance in some cases but I love it because it code looks clean and it has carbage collection and compiletime is almost nothing.


Yes, there are a few people on the D newsgroup who have been using it, and a Japanese fellow has put out 3 or 4 freeware games with D. If you wish to pursue this further, be sure to check out some of the projects at DSource. One of the projects there, called Derelict, is a collection of bindings for several C libraries useful for game programming. So far it includes bindings for: OpenGL, GLU, OpenAL, SDL, SDL_image, SDL_mixer, and SDL_net. Someone just completed a GLFW package which will be added soon. Be sure to check out the current source from the repository via subversion. The zip archive available for download there is rather old and does not contain all of the packages. A new release archive is coming soon.

If you need any help with D, the DigialMars D newsgroup is the place to look for it.

Share this post


Link to post
Share on other sites
I've used D for a number of programs, and it's a very good language. This was a year or so ago though, and the community support, compiler and libraries were not quite there yet. If there are OpenGL, DirectX, SDL, etc bindings and the compiler is stable enough for "serious" programs, there's no reason why you couldn't use it.

There might be a small problem with the garbage collection though. I'm not sure which implementation it's using, but there should be a way to define when it should collect. You definately don't want it collecting in the middle of rendering a frame.

Share this post


Link to post
Share on other sites
D is great for game programming!

I was using D for a game engine that was interrupted by my current project. Just little things like _no preprocessor_, no cpp/h file division, nice delegates, associative arrays (fast ones, too!) were really nice in setting up a clean, object oriented engine/base.

You're welcome to look at it--right now the scripting engine loads some configuration from a Lua script and it draws an ugly space scene. Oh and it uses SDL for the underlying windowing system so technically you could port it to Mac/Linux with a bit of effort. It builds with a program called "Scons," I highly recommend you try it if you're going to get into D. If you want to build it yuo'll have to edit the "Sconstruct" file in the main directory to point to where you have the D compiler stored on your PC. Other than that, it should be okay--SDL and OpenGL Win32 libraries are sitting where they need to be.

Point sprites for the stars is a nice performance thing...the "space scene" around you is drawn sky-box style, i.e. it inherits the camera's rotation but not its direction. There's some CG framework stuff in there too. Oh and the Model class is ugly as all sin at the moment (probably indefinitely) but its based on a RealSoonNow tutorial for loading Milkshape models. Also the beginnings of a GUI system are in there, I think buttons and dragging windows around works.

Anyways there's not much documentation, but you're welcome to take a look through it and maybe you can find it helpful :)

The "kengine" -- download link here (4mb). (Taken down, message me if you'd like me to email it to you.)

[Edited by - snowblind329 on February 17, 2005 1:17:13 AM]

Share this post


Link to post
Share on other sites
Other stuff: compile time, like you mentioned, is blazingly fast. I went back to C++ after working with the D compiler for awhile and that's probably what I missed the most.

And for garbage collection...I didn't get far enough with the object system to really see how much of an impact it would have. Heavy-weight game objects, each associated with a Lua coroutine--it might have become an issue. But the Digital Mars website has some good starter tips for memory management, and they're big on pointing out that you can do everything from use freelists to write your own custom allocator, so don't let it stop you from at least trying out the language.

Share this post


Link to post
Share on other sites
The garbage collector shouldn't get in the way unless you're doing something that's very gc-unfriendly, like allocating hundreds of objects each frame. If it ever does, D allows you to bypass it completely. You can write an entire program without the GC if you so desire. You can also delete GC-allocated objects at any time. So there's a lot of flexibility there. But really, for the large majority of cases it is unlikely that the GC will be an issue at all. Code to the GC first. If it proves to be a bottleneck, either make your code more GC-friendly (as you would in Java) or use one of the other options D provides.

Share this post


Link to post
Share on other sites
Hi!
Thank you fo all comments, very helpful. Not many tutorials out there for D. But the language manual is good.

I think I will do somthing in D now just for fun. Opengl, glfw, glee, vbo mesh and ttfont works already. I have always failed memory management in C++ when project grows and this is gift for me.

D indeed seems to allow manual gc through std.gc module, like disable(), enable(), fullCollect(), genCollect(). And there are method explained hot to get smooth operation so I don't believe it will be a problem, but I'll be more clever later.

@snowblind329
Thanks for the kengine, it is very good for learning language. It is much the same I am doing. I'll compile later, I have to take a look at Scons first.

Share this post


Link to post
Share on other sites
I've heard of D in the past, and this thread sort of caught my interest in it. So I went to their website to see it, and it really does look interesting. I made a post in the D newsgroup a minute ago, if you care to look. I'm going to try it and see how it works; hopefully it will be okay.

Thanks guys.

Share this post


Link to post
Share on other sites
The stuff at DedicateD is old, old, old and will not compile properly under the current version of DMD without heavy modification. Everything at the DedicateD has been rewritten and updated. You can find various versions around the net, but the best place to look is DSource.org. The socket bindings are no longer needed as there is now a binding in D's standard library, Phobos (std.socket and std.sockstream). You can also find a higher level server API in the Mango project at DSource, built on top of std.socket.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!