Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Godot DCI

An asset by baifeng
The page banner background of a mountain and forest
Godot DCI hero image

Quick Information

0 ratings
Godot DCI icon image
baifeng
Godot DCI

lightweight dci framework wirtten with gdscript.- Lightweight and non-intrusive.- Easy to use.

Supported Engine Version
4.2
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

godot-dci

Lightweight dci framework wirtten with gdscript.

README

Features

  • Lightweight and non-intrusive.
  • Easy to use.

How To Use

  • Copy the 'dci' directory to any location within your Godot project.
  • Begin your DCI coding journey with the following code:

# define data
class Person extends dci_data:
    var name: String = "Player"

# define role (Interactions)
class swimmer extends dci_behavior:
    func swim() -> dci_behavior:
        print("%s Swim." % data().name)
        return self
    
class superman extends dci_behavior:
    func fly() -> dci_behavior:
        print("%s Fly." % data().name)
        return self

# define context
class FlyContext extends dci_context:
    # override
    func _on_execute(data):
        assert(sender() is superman, "type not match!")
        sender().fly()

# create dci environment
var dci = dci_env.new()

# register role
dci.add_behavior("swimmer", swimmer)
dci.add_behavior("superman", superman)

# register context
dci.add_context("FlyContext", FlyContext.new())
dci.add_callable("FlyLambda", func(ctx: dci_context, data):
    assert(ctx.sender() is superman, "type not match!")
    ctx.sender().fly()
)

# data usage
var man: Person = Person.new().with(dci)

# cast role
man.cast("swimmer").swim() \
    .cast("superman").fly()

# cast and context execute
man.cast("superman").execute("FlyContext")
man.cast("superman").execute("FlyLambda")

lightweight dci framework wirtten with gdscript.

- Lightweight and non-intrusive.
- Easy to use.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Godot DCI icon image
baifeng
Godot DCI

lightweight dci framework wirtten with gdscript.- Lightweight and non-intrusive.- Easy to use.

Supported Engine Version
4.2
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers