Skip to content

A demonstration of DCI in game programming, creating the classic Snake game in Haxe and the Phaser game framework.

Notifications You must be signed in to change notification settings

ciscoheat/SnakeDCI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SnakeDCI

This repository is a supplement to the haxedci library for Haxe. It shows the power of DCI in a larger example, by creating the classic Snake game in Haxe using DCI and the Phaser game library.

If you want to see the result straight away, it's available online here. Use the cursor keys to control the snake.

The most important aspect of SnakeDCI however, is not to show a simple game, it's to show how well DCI maps to Use Cases. You should refer to this spreadsheet when looking at the Context classes. Note how the source code reflects the specification.

How to use

You will need Haxe 4 and Node.js. After cloning or downloading this repository, install some build tools with npm run tools, then use npm start for automatic reloading when recompiling.

Use haxe build.hxml for compiling, or even better, VS Code.

What is DCI?

DCI stands for Data, Context, Interaction. One of the key aspects of DCI is to separate what a system is (data) from what it does (function). Data and function has very different rates of change so they should be separated, not as it currently is, put in classes together. But DCI is so much more, so please explore the resources below. If you are familiar with Haxe already, the haxedci library is a good start.

DCI Resources

Website - fulloo.info
FAQ - DCI FAQ
Support - stackoverflow, tagging the question with dci
Discussions - Object-composition
Wikipedia - DCI entry
Haxe/DCI library with tutorial - haxedci

Credits

A big thanks to Blank101 for the phaser externs!

About

A demonstration of DCI in game programming, creating the classic Snake game in Haxe and the Phaser game framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published