[OT] Previously: DMD - Windows -> C# in gamedev

F i L witte2008 at gmail.com
Sat Jan 7 22:03:58 PST 2012


Chad J wrote:
> On 01/07/2012 08:47 PM, Manu wrote:
>> On 8 January 2012 03:40, Nick Sabalausky <a at a.a> wrote:
>> 
>>  "Froglegs" <lugtug at gmail.com <mailto:lugtug at gmail.com>> wrote 
>> in message
>>  news:lwcqnrvamqlnjjlxzbqa at dfeed.kimsufi.thecybershadow.net...
>>  >
>>  > can reload scripts while program is executing. Neither D 
>> nor C++ work
>>  > here.
>>  >
>> 
>>  Why not a dll? Those can be compiled/loaded/reloaded at 
>> runtime. And
>>  since
>>  it's just scripts, it wouldn't take long to compile at all, 
>> at least
>>  in D
>>  (maybe not so much in C++).
>> 
>> 
>> It's common for designers to edit scripts, and they don't 
>> usually have
>> coding environments on their machines.
>
> Meh, just link/package a D compiler into/with the game and
> recompile/reload a file whenever it changes.  It would probably 
> help if
> DMD ditched its non-redistributable license stuff, but there's 
> also
> LDC/GDC (LDC is probably the most promising for this kind of 
> thing).

My thoughts exactly. A D compiler/linker should be able to be 
packaged with an game engine editor rather easily, and if I'm not 
mistaken LDC has the potential to offer JIT/AOT compiling.




Manu wrote:
> I'm generally shovelling large, strictly controlled buffers 
> which need
> proper placement/alignment, pool allocation, or allocation from 
> temporal
> ring buffers and that sort of thing. I don't typically find 
> C/C++
> intolerable, or even particularly unpleasant for engine level 
> code as it
> is, it's the higher level code I'm keen to escape.

As I understand it, most low level game engine code deals with 
reusable memory pools to reduce memory thrashing with large 
amounts of dynamically allocated/deallocated objects (correct me 
if I'm wrong). C/C++ is great for this because in C memory is 
memory, whereas in C#/Java memory is objects. Which makes general 
purpose memory pools difficult to manage. I know there are 
engines like the Delta Engine which, to my knowledge, is written 
entirely in C# (minus a few minor bits).
I'm currently porting over our Reign SDK 
(code.google.com/p/reign-sdk) which is a modest set of libraries 
attempting to wrap DirectX, OpenGL, and other 3D media libraries 
into a universal interface. I've plans on enhancing, d-atizing, 
and expanding these libraries into a more full featured game 
engine one day. I've got some interesting ideas on how 
pre-written code packages could be easily designer-style 
assembled in-editor and compiled into efficient native logic 
blocks "on the fly". Only D's fast native compile times and 
easy-to-grasp syntax would really allow for what I'm thinking.

Given your experience in this area, I would appreciate any 
insight you could offer about the potential pros/cons for writing 
low level game engine components in D. Would you say D is a 
effective tool to write a general purpose memory pool, or would 
something like that be better written in C? Or.. is it common to 
have an array of specialized object pools? I'd imagine such an 
engine would sacrifice flexibility and eat up more memory, but 
most likely easier to implement.


More information about the Digitalmars-d mailing list