Difference between revisions of "D"

From RogueBasin
Jump to navigation Jump to search
(→‎Compilers: added LDC)
 
(18 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==


D is static, compiled language influenced by [[Cpp|C++]]. It was created by Walter Bright, author of the first C++ compiler to compile directly to machine code.
D is static, compiled language influenced by [[Cpp|C++]]. It was created by Walter Bright, author of the first C++ compiler to compile directly to machine code without using C as an intermediate language.<sup>[''citation needed'']</sup>


D has an imperative core, but is a multi-paradigm language that includes support for object-orientated, functional, and generic programming.
D has an imperative core, but is a multi-paradigm language that includes support for object-orientated, functional, and generic programming.
'''NOTE:''' This article will deal with D2, the latest but still-in-development version)


== Advantages ==
== Advantages ==


* Fast language, with performance comparable to C++ while still being garbage collected by default.
* Compiles natively with performance comparable to C++ while still being garbage collected by default.
* Interfaces well with [[C]] libraries, without writing boilerplate or using a foreign function interface, though cannot import headers unmodified - see http://www.digitalmars.com/d/2.0/htomodule.html
* Interfaces well with [[C]] libraries, without writing boilerplate or using a foreign function interface and can import headers unmodified - see https://github.com/atilaneves/dpp. Although C++ interfacing is more limited, it is available (see D Programming Language Specification: Chapter 33).
* Has a modern module system, no need to write header files or deal with a preprocessor.
* Has a modern module system, no need to write header files or deal with a preprocessor.
* Syntax is familiar to C, C++, [[C_Sharp|C#]], [[Java]] etc programmers.
* Syntax is familiar to C, C++, [[C_Sharp|C#]], [[Java]] etc programmers.
* Supports the functional programming paradigm better than other C-like languages, with features such as closures, delegates, transitive immutability, higher order functions, anonymous functions, and the ability to write compiler enforced pure functions.
* Supports the functional programming paradigm better than other C-like languages, with features such as closures, delegates, transitive immutability, higher order functions, anonymous functions, and the ability to write compiler enforced pure functions.
* D2 tries to do the template metaprogramming thing, which C++ supports without really meaning to, in a way that's actually sane to use.
* Supports the template metaprogramming thing, which C++ supports without really meaning to, in a way that's actually sane to use.
* DMD, the official compiler, is very fast, typically an order of magnitude faster than gcc for C/C++.
* DMD builds code incredibly fast, making compile-edit-run cycles comparable to dynamic languages. Build automation tools like make, etc. can be used in the same way as they are used in C/C++ projects.
* Knowledgeable, helpful community (including the D.learn forum for asking questions).
* Unicode native - call the &#9731;.melt() function, or instantiate a &#128161;!T; the basic string type is UTF-8.
* A package registry (http://code.dlang.org/)


== Disadvantages ==
== Disadvantages ==


* Paucity of tools such as IDE's, editor support, debuggers etc compared to more popular languages.
* There aren't as many libraries available if you want pure D implementations.
* Documentation is scarce and incomplete (though this is somewhat offset by the knowledgeable community)
* The language is mostly stable, but still has breaking changes on rare occasions (although these are preceded by deprecation warnings)
* The language is still in development so has some rough edges.
* Documentation sometimes abstruse or lacking examples; paucity of beginner learning resources.
* DMD, the official compiler, has no 64-bit support.
* The community is divided between the stable but inactive D1 and the incompatible and still somewhat unstable D2.


== Compilers ==
== Compilers/Tooling ==


* DMD (official compiler) - http://www.digitalmars.com/d/2.0/dmd-windows.html
* DMD (reference compiler; bleeding edge feature support) - http://dlang.org/download.html
* GDC (for GCC backend, includes support for 64 bit) - http://bitbucket.org/goshawk/gdc/wiki/Home
* GDC (GCC backend; strong optimization; targets the most platforms, but generally a bit behind) - http://gdcproject.org/
* LDC (for LLVM backend, includes support for 64 bit) - http://www.dsource.org/projects/ldc
* LDC (LLVM backend; also strong optimizations, targets almost as many platforms as GDC but generally implements a bit newer version of the language) - http://wiki.dlang.org/LDC
* Dub (Package manager and build tool) - http://code.dlang.org/download
* IDEs and IDE plugins - http://wiki.dlang.org/IDEs
* Editor support - http://wiki.dlang.org/Editors
* Other stuff (debugging, profiling, fixup, etc.) - http://wiki.dlang.org/Development_tools


== Roguelike Libraries ==
== Roguelike Libraries ==


Bindings for [[libtcod]] - http://code.google.com/p/libtcod-d/
* Bindings for [[libtcod]] - https://github.com/jaydg/libtcod-d
* Interface to [[Ncurses]] - https://github.com/D-Programming-Deimos/ncurses
* Bindings to [[BearLibTerminal]] - https://github.com/Elronnd/bearlibterminal-dlang
* Adam Ruppe's arsd collection (simpledisplay, terminal, eventloop, database, script, etc.) - https://github.com/adamdruppe/arsd
* Terminal ANSI colour lib - http://code.dlang.org/packages/rainbow
* Parser for Tiled maps - http://code.dlang.org/packages/dtiled
* ArmageddonEngine, D library for games, network applications etc. (lots of utility code) - https://github.com/CyberShadow/ae
* scone - cross-platform terminal application library - http://code.dlang.org/packages/scone
* [[NotEye|Necklace of the Eye]] includes sample in D.
 
== D Roguelikes ==
 
* {{7DRL}} [[Infection]]
* {{Alpha}} [[Arcan Myth RL]]
* {{Alpha}} [[Tetraworld]]


== Links ==
== Links ==


* [http://www.digitalmars.com/d/ Official Site]
* [http://www.dlang.org/ Official Site]
* [irc://irc.freenode.net/d IRC channel]
* [irc://irc.freenode.net/d IRC channel]
* [http://www.prowiki.org/wiki4d/wiki.cgi?FrontPage D wiki]
* [http://wiki.dlang.org/ wiki]
* [http://www.dsource.org/ dsource]
* [http://code.dlang.org/ DUB registry]


[[Category:Programming languages]]
[[Category:Programming languages]]

Latest revision as of 20:54, 6 November 2020

Introduction

D is static, compiled language influenced by C++. It was created by Walter Bright, author of the first C++ compiler to compile directly to machine code without using C as an intermediate language.[citation needed]

D has an imperative core, but is a multi-paradigm language that includes support for object-orientated, functional, and generic programming.

Advantages

  • Compiles natively with performance comparable to C++ while still being garbage collected by default.
  • Interfaces well with C libraries, without writing boilerplate or using a foreign function interface and can import headers unmodified - see https://github.com/atilaneves/dpp. Although C++ interfacing is more limited, it is available (see D Programming Language Specification: Chapter 33).
  • Has a modern module system, no need to write header files or deal with a preprocessor.
  • Syntax is familiar to C, C++, C#, Java etc programmers.
  • Supports the functional programming paradigm better than other C-like languages, with features such as closures, delegates, transitive immutability, higher order functions, anonymous functions, and the ability to write compiler enforced pure functions.
  • Supports the template metaprogramming thing, which C++ supports without really meaning to, in a way that's actually sane to use.
  • DMD builds code incredibly fast, making compile-edit-run cycles comparable to dynamic languages. Build automation tools like make, etc. can be used in the same way as they are used in C/C++ projects.
  • Knowledgeable, helpful community (including the D.learn forum for asking questions).
  • Unicode native - call the ☃.melt() function, or instantiate a 💡!T; the basic string type is UTF-8.
  • A package registry (http://code.dlang.org/)

Disadvantages

  • There aren't as many libraries available if you want pure D implementations.
  • The language is mostly stable, but still has breaking changes on rare occasions (although these are preceded by deprecation warnings)
  • Documentation sometimes abstruse or lacking examples; paucity of beginner learning resources.

Compilers/Tooling

Roguelike Libraries

D Roguelikes

{{{name}}}
Alpha Project
Developer {{{developer}}}
Theme {{{theme}}}
Influences {{{influences}}}
Released {{{released}}}
Updated {{{updated}}}
Licensing {{{licensing}}}
P. Language {{{language}}}
Platforms {{{platforms}}}
Interface {{{interface}}}
Game Length {{{length}}}
[{{{site}}} Official site of {{{name}}}]


BrogueMCP is my personal experimental project to enhance Brogue with AI-driven narrative elements. I'm not a game developer by trade - I'm actually a robotics entrepreneur with ADHD who's using this as a learning tool.

About Me and This Project

I'm a robotics entrepreneur from Nebraska who grew up in the 90s tinkering with computers between riding dirt bikes and climbing trees. Started playing AOEII on my dad's old accounting computer, later got into map modding. Studied Agricultural Economics at University of Nebraska-Lincoln, but ended up building robotic systems for manufacturers.

This project isn't a commercial game but a weekend hobby that helps me build development tools and learn. I'm a devout Christian and a father of three daughters, and I'm sharing this work because I think it could become something interesting.

Initially, I was too ambitious - I started parsing LOTR lore to build a comprehensive storytelling database. But after watching Brian Walker's lectures on YouTube, I pivoted to focus on enhancing Brogue's storytelling while respecting his brilliant original design.

Description

BrogueMCP connects Brogue with Ollama's local LLM to generate narrative descriptions during gameplay. The system remembers your encounters and discoveries to create a coherent story throughout your dungeon crawling experience.

I've implemented a narrator personality system that lets you customize how the game describes events. Press 'N' during gameplay to choose presets like Gandalf, Galadriel, or Aragorn, or adjust specific attributes to create your own unique narrator style.

Features

  • AI-enhanced storytelling that responds to gameplay events
  • Memory system that remembers your journey for contextual descriptions
  • Customizable narrator with adjustable personality attributes:
    • Core attributes (voice tone, wisdom level, verbosity)
    • Thematic tendencies (nature references, metaphor complexity)
    • Speech patterns (sentence complexity, archaic language)
  • Same great Brogue gameplay you already know and love

Technical Details

My implementation uses C for the game core with Node.js for the Dungeon Master agent server. Everything runs locally using Ollama with the llama3 model, so there's no cloud dependency.

The architecture follows this pattern:

[BrogueMCP Game] <--> [MCP Interface Layer] <--> [MCP Server] <--> [Agent(s)]

I've worked to implement proper error handling, memory management, and security validation to keep everything running smoothly.

Current Status

αlpha

This is very much a work in progress! I'm currently cleaning up my cursor rules to better separate my Brogue code from my other experiments. I'm working through compilation errors in MINGW64 and trying to get the game running so I can see if my menu is showing up properly.

Download

Feedback Welcome

As a kinesthetic learner who has to "do" to understand, I'd appreciate any guidance from more experienced developers. I'm happy to pass the torch to someone who wants to take this further. Feel free to reach out with questions or suggestions about what narrative elements you'd like to see in the game! ``` Arcan Myth RL

  • ```
{{{name}}}
Alpha Project
Developer {{{developer}}}
Theme {{{theme}}}
Influences {{{influences}}}
Released {{{released}}}
Updated {{{updated}}}
Licensing {{{licensing}}}
P. Language {{{language}}}
Platforms {{{platforms}}}
Interface {{{interface}}}
Game Length {{{length}}}
[{{{site}}} Official site of {{{name}}}]


BrogueMCP is my personal experimental project to enhance Brogue with AI-driven narrative elements. I'm not a game developer by trade - I'm actually a robotics entrepreneur with ADHD who's using this as a learning tool.

About Me and This Project

I'm a robotics entrepreneur from Nebraska who grew up in the 90s tinkering with computers between riding dirt bikes and climbing trees. Started playing AOEII on my dad's old accounting computer, later got into map modding. Studied Agricultural Economics at University of Nebraska-Lincoln, but ended up building robotic systems for manufacturers.

This project isn't a commercial game but a weekend hobby that helps me build development tools and learn. I'm a devout Christian and a father of three daughters, and I'm sharing this work because I think it could become something interesting.

Initially, I was too ambitious - I started parsing LOTR lore to build a comprehensive storytelling database. But after watching Brian Walker's lectures on YouTube, I pivoted to focus on enhancing Brogue's storytelling while respecting his brilliant original design.

Description

BrogueMCP connects Brogue with Ollama's local LLM to generate narrative descriptions during gameplay. The system remembers your encounters and discoveries to create a coherent story throughout your dungeon crawling experience.

I've implemented a narrator personality system that lets you customize how the game describes events. Press 'N' during gameplay to choose presets like Gandalf, Galadriel, or Aragorn, or adjust specific attributes to create your own unique narrator style.

Features

  • AI-enhanced storytelling that responds to gameplay events
  • Memory system that remembers your journey for contextual descriptions
  • Customizable narrator with adjustable personality attributes:
    • Core attributes (voice tone, wisdom level, verbosity)
    • Thematic tendencies (nature references, metaphor complexity)
    • Speech patterns (sentence complexity, archaic language)
  • Same great Brogue gameplay you already know and love

Technical Details

My implementation uses C for the game core with Node.js for the Dungeon Master agent server. Everything runs locally using Ollama with the llama3 model, so there's no cloud dependency.

The architecture follows this pattern:

[BrogueMCP Game] <--> [MCP Interface Layer] <--> [MCP Server] <--> [Agent(s)]

I've worked to implement proper error handling, memory management, and security validation to keep everything running smoothly.

Current Status

αlpha

This is very much a work in progress! I'm currently cleaning up my cursor rules to better separate my Brogue code from my other experiments. I'm working through compilation errors in MINGW64 and trying to get the game running so I can see if my menu is showing up properly.

Download

Feedback Welcome

As a kinesthetic learner who has to "do" to understand, I'd appreciate any guidance from more experienced developers. I'm happy to pass the torch to someone who wants to take this further. Feel free to reach out with questions or suggestions about what narrative elements you'd like to see in the game! ``` Tetraworld

Links