Category Archives: D

New game project in D + OpenGL + SDL2

Oi!

So like I said a few weeks back, I’ve started to mangle with D and OpenGL and SDL2 stuff, and it’s getting better and better all the time. Very small steps in the haxe/flash world are super gratifying in the C++/D world :D I currently have made a small, super simple 2d rendering engine I’ll use for prototyping, and ported a few of my tools from Haxe to D. Plus, I ported a variation of Artemis (http://gamadu.com/artemis/), which is an Entity System framework. So far, I’m loving Entity Systems, but I still need to figure out a few things that would have been easy to do before (nothing too serious, but just cleanly identifying which identities are enemies and who the player is etc.).

The rendering engine currently is using OpenGL immediate mode and fixed pipeline…so both modern “no-no”s, but all that matters for now is that I see something on the screen and I can start designing the actual game!

I seriously recommend anyone who is interested in doing low-level stuff, and that has done Haxe or Flash dev before, check out D. It will feel (and be) low-level, but still give you enough to work with to feel comfortable. Much more than C++ imo.

The new game project will remain “secret” for now…the main reason being that I still haven’t figured out all the details of it, and I want to post some sort of screenies or demos first to see how the gameplay could work! :) So far I’ve been calling it “Planet Ranger”.

It might be something between Minecraft/Starforge/Osmos/Civilization/SimCity? :D Not very specific I guess…

P.

D + OpenGL = Fun

Thought I’d inform everyone on what I’m currently doing. Between working on a few games, and university, I’m starting to get into D programming as well as OpenGL and SDL.

You probably won’t have heard of D, but you can check it out here: www.dlang.org < The homepage lists a lot of it’s features!

It’s like C++, but I like to think a more modern version, as well as has several snazzy features built into it, so it’s also convenient. The whole style of it feels way more comfortable to me than when I tried getting started with C++, and…well…I can’t really explain why I like it, and perhaps that’s a bad sign, but I like learning new things, so why not!

I figured if I’m coming from an AS3 background, then D is closer to what I’m used to than C++, seeing that it has garbage collection, and from what I read a few handy functions built-in that C++ doesn’t have (yes, you can use libraries either way, but why the hassle if the feature’s in the language itself?). Even the way you import modules is with dots, which is obviously really minor, but feels more like home:

import derelict.sdl.sdl2;

And of course, learning something new is hard if you don’t have motivation, so my motivation to learn D is to also learn OpenGL and SDL2 with it (and also vice versa), and make a simple game engine I could use to make some “real” games from scratch!

I just needed to quickly wrap my head around the general working of OpenGL, and now I’m already starting to understand it’s pipeline, and how it works (I think…). I haven’t really touched SDL too much, except to open up a GL window etc.. Either way, should get interesting. (I think any programmer (but nobody else :( ) will understand the rush of excitement I got when I saw a triangle with red, green, and blue corners rotating in a black window! To know that I commanded my GPU to do such things…the power I now wield!)

Seriously check out the D programming language though! The IRC is pretty active, and has a friendly community there that will help you if you ever get stuck on something, and all in all it’s new, interesting, and without it you’ll be useless.

P.