Phantasmal MUD Lib for DGD

Phantasmal Site > DGD > What Does It Do?

What, Exactly, Does DGD Do?

Different programming languages have different runtime models. Most languages have a stack, for instance, where functions' copies of local variables get stored. Some languages have garbage collection, automatic locking or other features that operate at different times. DGD has its own set of interesting features that do interesting things at interesting times.

When Does DGD Code Execute?

DGD retains more control over its execution model than most languages. Almost all code written in DGD is meant to run very briefly in response to an event of some kind, and then exit. When code is run in response to an event and then completes, it is called a single 'Execution Round'. You may also see it called a 'thread' or 'DGD thread', though this is not similar to the way threading works in other languages.

An Execution Round may be triggered by any of the following events:

  • A new network connection
  • Input on an existing network connection
  • A programmatically scheduled event, called a call_out

The End of the Execution Round

When an execution round completes, DGD does a number of things. If any objects are to be recompiled or destructed, that happens after the execution round that requested the change is complete, but before the next round starts. If the server is going to shut down, reboot, or make a statedump file, that will also happen at that time. A lot of memory management happens at the end of the execution round as well.