Giter Site home page Giter Site logo

defold-quest's Introduction

GitHub release (latest by date) GitHub Workflow Status codecov

Github-sponsors Ko-Fi BuyMeACoffee

Disclaimer

The library in development stage. May be not fully tested and README may be not full. If you have any questions, please, create an issue. This library is an adoptation of Quest module from my Defold-Eva library.

Quest

Quest - module is a comprehensive system for managing quests in a game. It allows for the registration, tracking, and completion of quests, with various events and callbacks to handle quest-related activities.

Features

  • Quest Management - Create, start, and complete quests with ease.
  • Quest Progress - Track the progress of quests and their tasks.
  • Quest Events - Listen for quest-related events and adjust it for your needs.

Setup

Open your game.project file and add the following line to the dependencies field under the project section:

Defold Event

https://github.com/Insality/defold-event/archive/refs/tags/5.zip

Defold Quest

https://github.com/Insality/defold-quest/archive/refs/tags/1.zip

After that, select Project ▸ Fetch Libraries to update library dependencies. This happens automatically whenever you open a project so you will only need to do this if the dependencies change without re-opening the project.

Library Size

Note: The library size is calculated based on the build report per platform

Platform Library Size
HTML5 3.91 KB
Desktop / Mobile 7.57 KB

Quest Configuration File

Create a configuration file for the Quest module.. Place your configuration file inside your custom resources folder to ensure they are included in the build.

The configuration file should be a JSON file with the following structure:

{
	"001_hidden": {
		"autostart": true,
		"autofinish": true,
		"tasks": [
			{ "action": "complete_cell", "object": "141" }
		]
	},
	"002_destroy_them_all": {
		"category": "quest",
		"autostart": true,
		"autofinish": true,
		"required_quests": [ "001_hidden" ],
		"tasks": [
			{ "action": "destroy_object", "object": "tree", "required": 10 }
		]
	}
}

Note: for more quest fields check the annotations.lua to see the available properties.

When you have created the configuration file, you can initialize the Quest module with the following code:

quest.init("/resources/quest_config.json")

API Reference

Quick API Reference

quest.init(quest_config_path)
quest.reset_state()

-- Events
quest.on_quest_register -- event (quest_id, quest_config)
quest.on_quest_start -- event (quest_id, quest_config)
quest.on_quest_completed -- event (quest_id, quest_config)
quest.on_quest_progress -- event (quest_id, quest_config, delta, total, task_index)
quest.on_quest_task_completed -- event (quest_id, quest_config, task_index)
quest.is_can_start -- event (quest_id, quest_config): boolean
quest.is_can_complete -- event (quest_id, quest_config): boolean
quest.is_can_event -- event (quest_id, quest_config): boolean

quest.quest_event(action, object, amount)
quest.get_current(category)
quest.get_progress(quest_id)
quest.get_completed(category)
quest.is_active(quest_id)
quest.is_completed(quest_id)
quest.is_current_with_task(action, object)
quest.is_can_start_quest(quest_id)
quest.start_quest(quest_id)
quest.is_can_complete_quest(quest_id)
quest.complete_quest(quest_id)
quest.force_complete_quest(quest_id)
quest.reset_progress(quest_id)
quest.get_quest_config(quest_id)
quest.update_quests()
quest.set_logger(logger_instance)

API Reference

Read the API Reference file to see the full API documentation for the module.

Use Cases

Read the Use Cases file to see several examples of how to use the this module in your Defold game development projects.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Issues and Suggestions

For any issues, questions, or suggestions, please create an issue.

👏 Contributors

❤️ Support project ❤️

Your donation helps me stay engaged in creating valuable projects for Defold. If you appreciate what I'm doing, please consider supporting me!

Github-sponsors Ko-Fi BuyMeACoffee

defold-quest's People

Contributors

insality avatar

Stargazers

 avatar Alexandr Xenofontov avatar rayraytime avatar Roman Silin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.